Create a new API for calling Java toolchains.

* Create a new sbt.compiler.javac package
* Create new interfaces to control running `javac` and `javadoc` whether forked or local.
* Ensure new interfaces make use of `xsbti.Reporter`.
* Create new method on `xsbti.compiler.JavaCompiler` which takes a `xsbti.Reporter`
* Create a new mechanism to parse (more accurately) Warnings + Errors, to distinguish the two.
* Ensure older xsbti.Compiler implementations still succeed via catcing NoSuchMethodError.
* Feed new toolchain through sbt.actions.Compiler API via dirty hackery until we can break things in sbt 1.0
* Added a set of unit tests for parsing errors from Javac/Javadoc
* Added a new integration test for hidden compilerReporter key, including testing threading of javac reports.

Fixes #875, Fixes #1542,  Related #1178 could be looked into/cleaned up.
This commit is contained in:
Josh Suereth 2014-10-28 16:44:23 -04:00
parent 5d00a9f5cd
commit f0a8f5d44f
2 changed files with 15 additions and 2 deletions

View File

@ -2,6 +2,7 @@ package xsbti.compile;
import java.io.File;
import xsbti.Logger;
import xsbti.Reporter;
/**
* Interface to a Java compiler.
@ -9,6 +10,17 @@ import xsbti.Logger;
public interface JavaCompiler
{
/** Compiles Java sources using the provided classpath, output directory, and additional options.
* Output should be sent to the provided logger.*/
* Output should be sent to the provided logger.
*
* @deprecated 0.13.8 - Use compileWithReporter instead
*/
void compile(File[] sources, File[] classpath, Output output, String[] options, Logger log);
}
/**
* Compiles java sources using the provided classpath, output directory and additional options.
*
* Output should be sent to the provided logger.
* Failures should be passed to the provided Reporter.
*/
void compileWithReporter(File[] sources, File[] classpath, Output output, String[] options, Reporter reporter, Logger log);
}

View File

@ -104,6 +104,7 @@ object Logger {
val position = pos
val message = msg
val severity = sev
override def toString = s"[$severity] $pos: $message"
}
}