diff --git a/interface/other b/interface/other index a8f5ba49c..111896f0b 100644 --- a/interface/other +++ b/interface/other @@ -9,9 +9,13 @@ SourceAPI packages : Package* definitions: Definition* +OutputSetting + sourceDirectory: String + outputDirectory: String + Compilation startTime: Long - target: String + outputs: OutputSetting* Package name: String diff --git a/interface/src/main/java/xsbti/compile/CachedCompiler.java b/interface/src/main/java/xsbti/compile/CachedCompiler.java index 2f97e395b..97a1a33b5 100644 --- a/interface/src/main/java/xsbti/compile/CachedCompiler.java +++ b/interface/src/main/java/xsbti/compile/CachedCompiler.java @@ -7,5 +7,5 @@ import java.io.File; public interface CachedCompiler { - public void run(File[] sources, DependencyChanges cpChanges, AnalysisCallback callback, Logger log, Reporter delegate); + public void run(File[] sources, DependencyChanges cpChanges, AnalysisCallback callback, Logger log, Reporter delegate, CompileProgress progress); } diff --git a/interface/src/main/java/xsbti/compile/CachedCompilerProvider.java b/interface/src/main/java/xsbti/compile/CachedCompilerProvider.java index f32c54e3d..313f27505 100644 --- a/interface/src/main/java/xsbti/compile/CachedCompilerProvider.java +++ b/interface/src/main/java/xsbti/compile/CachedCompilerProvider.java @@ -6,5 +6,5 @@ import xsbti.Reporter; public interface CachedCompilerProvider { ScalaInstance scalaInstance(); - CachedCompiler newCachedCompiler(String[] arguments, Logger log, Reporter reporter, boolean resident); + CachedCompiler newCachedCompiler(String[] arguments, Output output, Logger log, Reporter reporter, boolean resident); } \ No newline at end of file diff --git a/interface/src/main/java/xsbti/compile/CompileProgress.java b/interface/src/main/java/xsbti/compile/CompileProgress.java new file mode 100755 index 000000000..902a50018 --- /dev/null +++ b/interface/src/main/java/xsbti/compile/CompileProgress.java @@ -0,0 +1,7 @@ +package xsbti.compile; + +public interface CompileProgress { + void startUnit(String phase, String unitPath); + + boolean advance(int current, int total); +} \ No newline at end of file diff --git a/interface/src/main/java/xsbti/compile/GlobalsCache.java b/interface/src/main/java/xsbti/compile/GlobalsCache.java index 1e070a1f1..a3a412836 100644 --- a/interface/src/main/java/xsbti/compile/GlobalsCache.java +++ b/interface/src/main/java/xsbti/compile/GlobalsCache.java @@ -5,6 +5,6 @@ import xsbti.Reporter; public interface GlobalsCache { - public CachedCompiler apply(String[] args, boolean forceNew, CachedCompilerProvider provider, Logger log, Reporter reporter); + public CachedCompiler apply(String[] args, Output output, boolean forceNew, CachedCompilerProvider provider, Logger log, Reporter reporter); public void clear(); } diff --git a/interface/src/main/java/xsbti/compile/JavaCompiler.java b/interface/src/main/java/xsbti/compile/JavaCompiler.java index 05bafdfe1..c9947c700 100644 --- a/interface/src/main/java/xsbti/compile/JavaCompiler.java +++ b/interface/src/main/java/xsbti/compile/JavaCompiler.java @@ -11,5 +11,5 @@ public interface JavaCompiler /** Compiles Java sources using the provided classpath, output directory, and additional options. * If supported, the number of reported errors should be limited to `maximumErrors`. * Output should be sent to the provided logger.*/ - void compile(File[] sources, File[] classpath, File outputDirectory, String[] options, int maximumErrors, Logger log); + void compile(File[] sources, File[] classpath, Output output, String[] options, int maximumErrors, Logger log); } diff --git a/interface/src/main/java/xsbti/compile/MultipleOutput.java b/interface/src/main/java/xsbti/compile/MultipleOutput.java new file mode 100755 index 000000000..6ba3479e6 --- /dev/null +++ b/interface/src/main/java/xsbti/compile/MultipleOutput.java @@ -0,0 +1,20 @@ +package xsbti.compile; + +import java.io.File; + +public interface MultipleOutput extends Output { + + interface OutputGroup { + /** The directory where source files are stored for this group. + * Source directories should uniquely identify the group for a source file. */ + File sourceDirectory(); + + /** The directory where class files should be generated. + * Incremental compilation will manage the class files in this directory. + * In particular, outdated class files will be deleted before compilation. + * It is important that this directory is exclusively used for one set of sources. */ + File outputDirectory(); + } + + OutputGroup[] outputGroups(); +} \ No newline at end of file diff --git a/interface/src/main/java/xsbti/compile/Options.java b/interface/src/main/java/xsbti/compile/Options.java index 9e0d03e98..877ff5ebf 100644 --- a/interface/src/main/java/xsbti/compile/Options.java +++ b/interface/src/main/java/xsbti/compile/Options.java @@ -13,11 +13,8 @@ public interface Options * This should include Scala and Java sources, which are identified by their extension. */ File[] sources(); - /** The directory where class files should be generated. - * Incremental compilation will manage the class files in this directory. - * In particular, outdated class files will be deleted before compilation. - * It is important that this directory is exclusively used for one set of sources. */ - File classesDirectory(); + /** Output for the compilation. */ + Output output(); /** The options to pass to the Scala compiler other than the sources and classpath to use. */ String[] options(); diff --git a/interface/src/main/java/xsbti/compile/Output.java b/interface/src/main/java/xsbti/compile/Output.java new file mode 100755 index 000000000..c7f28a2f1 --- /dev/null +++ b/interface/src/main/java/xsbti/compile/Output.java @@ -0,0 +1,9 @@ +package xsbti.compile; + +import java.io.File; +/** Abstract interface denoting the output of the compilation. Inheritors are SingleOutput with a global output directory and + * MultipleOutput that specifies the output directory per source file. + */ +public interface Output +{ +} diff --git a/interface/src/main/java/xsbti/compile/Setup.java b/interface/src/main/java/xsbti/compile/Setup.java index cf261aa7a..1efc08782 100644 --- a/interface/src/main/java/xsbti/compile/Setup.java +++ b/interface/src/main/java/xsbti/compile/Setup.java @@ -23,4 +23,7 @@ public interface Setup File cacheFile(); GlobalsCache cache(); + + /** If returned, the progress that should be used to report scala compilation to. */ + Maybe progress(); } diff --git a/interface/src/main/java/xsbti/compile/SingleOutput.java b/interface/src/main/java/xsbti/compile/SingleOutput.java new file mode 100755 index 000000000..cb200c9b7 --- /dev/null +++ b/interface/src/main/java/xsbti/compile/SingleOutput.java @@ -0,0 +1,12 @@ +package xsbti.compile; + +import java.io.File; + +public interface SingleOutput extends Output { + + /** The directory where class files should be generated. + * Incremental compilation will manage the class files in this directory. + * In particular, outdated class files will be deleted before compilation. + * It is important that this directory is exclusively used for one set of sources. */ + File outputDirectory(); +} \ No newline at end of file