From 7cbcb67dfa9624d78184cb1185a3048613f6dcb1 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Thu, 20 Aug 2015 00:38:50 -0400 Subject: [PATCH] Remove all interface classes except for the ones used by the logger. --- build.sbt | 3 +- .../src/main/java/xsbti/AnalysisCallback.java | 62 -------------- .../src/main/java/xsbti/ArtifactInfo.java | 9 -- .../src/main/java/xsbti/CompileCancelled.java | 9 -- .../src/main/java/xsbti/CompileFailed.java | 7 -- .../main/java/xsbti/DependencyContext.java | 22 ----- interface/src/main/java/xsbti/Reporter.java | 22 ----- .../src/main/java/xsbti/api/AbstractLazy.java | 26 ------ interface/src/main/java/xsbti/api/Lazy.java | 9 -- .../src/main/java/xsbti/api/Modifiers.java | 83 ------------------- .../java/xsbti/compile/CachedCompiler.java | 13 --- .../xsbti/compile/CachedCompilerProvider.java | 10 --- .../java/xsbti/compile/ClasspathOptions.java | 29 ------- .../main/java/xsbti/compile/CompileOrder.java | 34 -------- .../java/xsbti/compile/CompileProgress.java | 12 --- .../main/java/xsbti/compile/Compilers.java | 8 -- .../main/java/xsbti/compile/DefinesClass.java | 12 --- .../java/xsbti/compile/DependencyChanges.java | 13 --- .../main/java/xsbti/compile/GlobalsCache.java | 13 --- .../xsbti/compile/IncrementalCompiler.java | 71 ---------------- .../src/main/java/xsbti/compile/Inputs.java | 14 ---- .../main/java/xsbti/compile/JavaCompiler.java | 27 ------ .../java/xsbti/compile/MultipleOutput.java | 20 ----- .../src/main/java/xsbti/compile/Options.java | 27 ------ .../src/main/java/xsbti/compile/Output.java | 7 -- .../java/xsbti/compile/ScalaInstance.java | 37 --------- .../src/main/java/xsbti/compile/Setup.java | 47 ----------- .../main/java/xsbti/compile/SingleOutput.java | 12 --- util/log/src/main/scala/sbt/Logger.scala | 5 ++ 29 files changed, 6 insertions(+), 657 deletions(-) delete mode 100644 interface/src/main/java/xsbti/AnalysisCallback.java delete mode 100644 interface/src/main/java/xsbti/ArtifactInfo.java delete mode 100644 interface/src/main/java/xsbti/CompileCancelled.java delete mode 100644 interface/src/main/java/xsbti/CompileFailed.java delete mode 100644 interface/src/main/java/xsbti/DependencyContext.java delete mode 100644 interface/src/main/java/xsbti/Reporter.java delete mode 100644 interface/src/main/java/xsbti/api/AbstractLazy.java delete mode 100644 interface/src/main/java/xsbti/api/Lazy.java delete mode 100644 interface/src/main/java/xsbti/api/Modifiers.java delete mode 100644 interface/src/main/java/xsbti/compile/CachedCompiler.java delete mode 100644 interface/src/main/java/xsbti/compile/CachedCompilerProvider.java delete mode 100644 interface/src/main/java/xsbti/compile/ClasspathOptions.java delete mode 100644 interface/src/main/java/xsbti/compile/CompileOrder.java delete mode 100755 interface/src/main/java/xsbti/compile/CompileProgress.java delete mode 100644 interface/src/main/java/xsbti/compile/Compilers.java delete mode 100644 interface/src/main/java/xsbti/compile/DefinesClass.java delete mode 100644 interface/src/main/java/xsbti/compile/DependencyChanges.java delete mode 100644 interface/src/main/java/xsbti/compile/GlobalsCache.java delete mode 100644 interface/src/main/java/xsbti/compile/IncrementalCompiler.java delete mode 100644 interface/src/main/java/xsbti/compile/Inputs.java delete mode 100644 interface/src/main/java/xsbti/compile/JavaCompiler.java delete mode 100755 interface/src/main/java/xsbti/compile/MultipleOutput.java delete mode 100644 interface/src/main/java/xsbti/compile/Options.java delete mode 100755 interface/src/main/java/xsbti/compile/Output.java delete mode 100644 interface/src/main/java/xsbti/compile/ScalaInstance.java delete mode 100644 interface/src/main/java/xsbti/compile/Setup.java delete mode 100755 interface/src/main/java/xsbti/compile/SingleOutput.java diff --git a/build.sbt b/build.sbt index 66a045d8f..fcc99e21b 100644 --- a/build.sbt +++ b/build.sbt @@ -109,7 +109,7 @@ lazy val utilComplete = (project in utilPath / "complete"). // logging lazy val utilLogging = (project in utilPath / "log"). - dependsOn(utilInterface/*, processProj*/). + dependsOn(utilInterface). settings( testedBaseSettings, name := "Util Logging", @@ -118,7 +118,6 @@ lazy val utilLogging = (project in utilPath / "log"). // Relation lazy val utilRelation = (project in utilPath / "relation"). - dependsOn(utilInterface/*, processProj*/). settings( testedBaseSettings, name := "Util Relation" diff --git a/interface/src/main/java/xsbti/AnalysisCallback.java b/interface/src/main/java/xsbti/AnalysisCallback.java deleted file mode 100644 index a51628f15..000000000 --- a/interface/src/main/java/xsbti/AnalysisCallback.java +++ /dev/null @@ -1,62 +0,0 @@ -/* sbt -- Simple Build Tool - * Copyright 2008, 2009 Mark Harrah - */ -package xsbti; - -import java.io.File; - -public interface AnalysisCallback -{ - /** Called to indicate that the source file source depends on the source file - * dependsOn. Note that only source files included in the current compilation will - * passed to this method. Dependencies on classes generated by sources not in the current compilation will - * be passed as class dependencies to the classDependency method. - * If publicInherited is true, this dependency is a result of inheritance by a - * template accessible outside of the source file. - * @deprecated Use `sourceDependency(File dependsOn, File source, DependencyContext context)` instead. */ - @Deprecated - void sourceDependency(File dependsOn, File source, boolean publicInherited); - /** Called to indicate that the source file source depends on the source file - * dependsOn. Note that only source files included in the current compilation will - * passed to this method. Dependencies on classes generated by sources not in the current compilation will - * be passed as class dependencies to the classDependency method. - * context gives information about the context in which this dependency has been extracted. - * See xsbti.DependencyContext for the list of existing dependency contexts. */ - void sourceDependency(File dependsOn, File source, DependencyContext context); - /** Called to indicate that the source file source depends on the top-level - * class named name from class or jar file binary. - * If publicInherited is true, this dependency is a result of inheritance by a - * template accessible outside of the source file. - * @deprecated Use `binaryDependency(File binary, String name, File source, DependencyContext context)` instead. */ - @Deprecated - void binaryDependency(File binary, String name, File source, boolean publicInherited); - /** Called to indicate that the source file source depends on the top-level - * class named name from class or jar file binary. - * context gives information about the context in which this dependency has been extracted. - * See xsbti.DependencyContext for the list of existing dependency contexts. */ - void binaryDependency(File binary, String name, File source, DependencyContext context); - /** Called to indicate that the source file source produces a class file at - * module contain class name.*/ - void generatedClass(File source, File module, String name); - /** Called when the public API of a source file is extracted. */ - void api(File sourceFile, xsbti.api.SourceAPI source); - void usedName(File sourceFile, String names); - /** Provides problems discovered during compilation. These may be reported (logged) or unreported. - * Unreported problems are usually unreported because reporting was not enabled via a command line switch. */ - void problem(String what, Position pos, String msg, Severity severity, boolean reported); - /** - * Determines whether method calls through this interface should be interpreted as serving - * name hashing algorithm needs in given compiler run. - * - * In particular, it indicates whether member reference and inheritance dependencies should be - * extracted. - * - * As the signature suggests, this method's implementation is meant to be side-effect free. It's added - * to AnalysisCallback because it indicates how other callback calls should be interpreted by both - * implementation of AnalysisCallback and it's clients. - * - * NOTE: This method is an implementation detail and can be removed at any point without deprecation. - * Do not depend on it, please. - */ - boolean nameHashing(); -} \ No newline at end of file diff --git a/interface/src/main/java/xsbti/ArtifactInfo.java b/interface/src/main/java/xsbti/ArtifactInfo.java deleted file mode 100644 index 6f2eedae5..000000000 --- a/interface/src/main/java/xsbti/ArtifactInfo.java +++ /dev/null @@ -1,9 +0,0 @@ -package xsbti; - -public final class ArtifactInfo -{ - public static final String ScalaOrganization = "org.scala-lang"; - public static final String ScalaLibraryID = "scala-library"; - public static final String ScalaCompilerID = "scala-compiler"; - public static final String SbtOrganization = "org.scala-sbt"; -} \ No newline at end of file diff --git a/interface/src/main/java/xsbti/CompileCancelled.java b/interface/src/main/java/xsbti/CompileCancelled.java deleted file mode 100644 index bcd3695dd..000000000 --- a/interface/src/main/java/xsbti/CompileCancelled.java +++ /dev/null @@ -1,9 +0,0 @@ -package xsbti; - -/** - * An exception thrown when compilation cancellation has been requested during - * Scala compiler run. - */ -public abstract class CompileCancelled extends RuntimeException { - public abstract String[] arguments(); -} diff --git a/interface/src/main/java/xsbti/CompileFailed.java b/interface/src/main/java/xsbti/CompileFailed.java deleted file mode 100644 index f1cbbc61b..000000000 --- a/interface/src/main/java/xsbti/CompileFailed.java +++ /dev/null @@ -1,7 +0,0 @@ -package xsbti; - -public abstract class CompileFailed extends RuntimeException -{ - public abstract String[] arguments(); - public abstract Problem[] problems(); -} \ No newline at end of file diff --git a/interface/src/main/java/xsbti/DependencyContext.java b/interface/src/main/java/xsbti/DependencyContext.java deleted file mode 100644 index 15cfa76d1..000000000 --- a/interface/src/main/java/xsbti/DependencyContext.java +++ /dev/null @@ -1,22 +0,0 @@ -package xsbti; - -/** - * Enumeration of existing dependency contexts. - * Dependency contexts represent the various kind of dependencies that - * can exist between symbols. - */ -public enum DependencyContext { - /** - * Represents a direct dependency between two symbols : - * object Foo - * object Bar { def foo = Foo } - */ - DependencyByMemberRef, - - /** - * Represents an inheritance dependency between two symbols : - * class A - * class B extends A - */ - DependencyByInheritance -} diff --git a/interface/src/main/java/xsbti/Reporter.java b/interface/src/main/java/xsbti/Reporter.java deleted file mode 100644 index d76be8ea6..000000000 --- a/interface/src/main/java/xsbti/Reporter.java +++ /dev/null @@ -1,22 +0,0 @@ -/* sbt -- Simple Build Tool - * Copyright 2008, 2009, 2010 Mark Harrah - */ -package xsbti; - -public interface Reporter -{ - /** Resets logging, including any accumulated errors, warnings, messages, and counts.*/ - void reset(); - /** Returns true if this logger has seen any errors since the last call to reset.*/ - boolean hasErrors(); - /** Returns true if this logger has seen any warnings since the last call to reset.*/ - boolean hasWarnings(); - /** Logs a summary of logging since the last reset.*/ - void printSummary(); - /** Returns a list of warnings and errors since the last reset.*/ - Problem[] problems(); - /** Logs a message.*/ - void log(Position pos, String msg, Severity sev); - /** Reports a comment. */ - void comment(Position pos, String msg); -} diff --git a/interface/src/main/java/xsbti/api/AbstractLazy.java b/interface/src/main/java/xsbti/api/AbstractLazy.java deleted file mode 100644 index bd21f166f..000000000 --- a/interface/src/main/java/xsbti/api/AbstractLazy.java +++ /dev/null @@ -1,26 +0,0 @@ -/* sbt -- Simple Build Tool - * Copyright 2010 Mark Harrah - */ -package xsbti.api; - - import java.io.ObjectStreamException; - -public abstract class AbstractLazy implements Lazy, java.io.Serializable -{ - private Object writeReplace() throws ObjectStreamException - { - return new StrictLazy(get()); - } - private static final class StrictLazy implements Lazy, java.io.Serializable - { - private final T value; - StrictLazy(T t) - { - value = t; - } - public T get() - { - return value; - } - } -} \ No newline at end of file diff --git a/interface/src/main/java/xsbti/api/Lazy.java b/interface/src/main/java/xsbti/api/Lazy.java deleted file mode 100644 index 1ee29b013..000000000 --- a/interface/src/main/java/xsbti/api/Lazy.java +++ /dev/null @@ -1,9 +0,0 @@ -/* sbt -- Simple Build Tool - * Copyright 2010 Mark Harrah - */ -package xsbti.api; - -public interface Lazy -{ - T get(); -} \ No newline at end of file diff --git a/interface/src/main/java/xsbti/api/Modifiers.java b/interface/src/main/java/xsbti/api/Modifiers.java deleted file mode 100644 index 5e103c7ec..000000000 --- a/interface/src/main/java/xsbti/api/Modifiers.java +++ /dev/null @@ -1,83 +0,0 @@ -package xsbti.api; - -public final class Modifiers implements java.io.Serializable -{ - private static final int AbstractBit = 0; - private static final int OverrideBit = 1; - private static final int FinalBit = 2; - private static final int SealedBit = 3; - private static final int ImplicitBit = 4; - private static final int LazyBit = 5; - private static final int MacroBit = 6; - - private static int flag(boolean set, int bit) - { - return set ? (1 << bit) : 0; - } - - public Modifiers(boolean isAbstract, boolean isOverride, boolean isFinal, boolean isSealed, boolean isImplicit, boolean isLazy, boolean isMacro) - { - this.flags = (byte)( - flag(isAbstract, AbstractBit) | - flag(isOverride, OverrideBit) | - flag(isFinal, FinalBit) | - flag(isSealed, SealedBit) | - flag(isImplicit, ImplicitBit) | - flag(isLazy, LazyBit) | - flag(isMacro, MacroBit) - ); - } - - private final byte flags; - - private boolean flag(int bit) - { - return (flags & (1 << bit)) != 0; - } - - public final byte raw() - { - return flags; - } - - public final boolean isAbstract() - { - return flag(AbstractBit); - } - public final boolean isOverride() - { - return flag(OverrideBit); - } - public final boolean isFinal() - { - return flag(FinalBit); - } - public final boolean isSealed() - { - return flag(SealedBit); - } - public final boolean isImplicit() - { - return flag(ImplicitBit); - } - public final boolean isLazy() - { - return flag(LazyBit); - } - public final boolean isMacro() - { - return flag(MacroBit); - } - public boolean equals(Object o) - { - return (o instanceof Modifiers) && flags == ((Modifiers)o).flags; - } - public int hashCode() - { - return flags; - } - public String toString() - { - return "Modifiers(" + "isAbstract: " + isAbstract() + ", " + "isOverride: " + isOverride() + ", " + "isFinal: " + isFinal() + ", " + "isSealed: " + isSealed() + ", " + "isImplicit: " + isImplicit() + ", " + "isLazy: " + isLazy() + ", " + "isMacro: " + isMacro()+ ")"; - } -} diff --git a/interface/src/main/java/xsbti/compile/CachedCompiler.java b/interface/src/main/java/xsbti/compile/CachedCompiler.java deleted file mode 100644 index 1d37f0883..000000000 --- a/interface/src/main/java/xsbti/compile/CachedCompiler.java +++ /dev/null @@ -1,13 +0,0 @@ -package xsbti.compile; - -import xsbti.AnalysisCallback; -import xsbti.Logger; -import xsbti.Reporter; -import java.io.File; - -public interface CachedCompiler -{ - /** Returns an array of arguments representing the nearest command line equivalent of a call to run but without the command name itself.*/ - String[] commandArguments(File[] sources); - 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 deleted file mode 100644 index 313f27505..000000000 --- a/interface/src/main/java/xsbti/compile/CachedCompilerProvider.java +++ /dev/null @@ -1,10 +0,0 @@ -package xsbti.compile; - -import xsbti.Logger; -import xsbti.Reporter; - -public interface CachedCompilerProvider -{ - ScalaInstance scalaInstance(); - 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/ClasspathOptions.java b/interface/src/main/java/xsbti/compile/ClasspathOptions.java deleted file mode 100644 index e4aba32b7..000000000 --- a/interface/src/main/java/xsbti/compile/ClasspathOptions.java +++ /dev/null @@ -1,29 +0,0 @@ -package xsbti.compile; - -/** -* Configures modifications to the classpath based on the Scala instance used for compilation. -* This is typically used for the Scala compiler only and all values set to false for the Java compiler. -*/ -public interface ClasspathOptions -{ - /** If true, includes the Scala library on the boot classpath. This should usually be true.*/ - boolean bootLibrary(); - - /** If true, includes the Scala compiler on the standard classpath. - * This is typically false and is instead managed by the build tool or environment. - */ - boolean compiler(); - - /** If true, includes extra jars from the Scala instance on the standard classpath. - * This is typically false and is instead managed by the build tool or environment. - */ - boolean extra(); - - /** If true, automatically configures the boot classpath. This should usually be true.*/ - boolean autoBoot(); - - /** If true, the Scala library jar is filtered from the standard classpath. - * This should usually be true because the library should be included on the boot classpath of the Scala compiler and not the standard classpath. - */ - boolean filterLibrary(); -} \ No newline at end of file diff --git a/interface/src/main/java/xsbti/compile/CompileOrder.java b/interface/src/main/java/xsbti/compile/CompileOrder.java deleted file mode 100644 index 5683f75d9..000000000 --- a/interface/src/main/java/xsbti/compile/CompileOrder.java +++ /dev/null @@ -1,34 +0,0 @@ -package xsbti.compile; - -/** -* Defines the order in which Scala and Java sources are compiled when compiling a set of sources with both Java and Scala sources. -* This setting has no effect if only Java sources or only Scala sources are being compiled. -* It is generally more efficient to use JavaThenScala or ScalaThenJava when mixed compilation is not required. -*/ -public enum CompileOrder -{ - /** - * Allows Scala sources to depend on Java sources and allows Java sources to depend on Scala sources. - * - * In this mode, both Java and Scala sources are passed to the Scala compiler, which generates class files for the Scala sources. - * Then, Java sources are passed to the Java compiler, which generates class files for the Java sources. - * The Scala classes compiled in the first step are included on the classpath to the Java compiler. - */ - Mixed, - /** - * Allows Scala sources to depend on the Java sources in the compilation, but does not allow Java sources to depend on Scala sources. - * - * In this mode, both Java and Scala sources are passed to the Scala compiler, which generates class files for the Scala sources. - * Then, Java sources are passed to the Java compiler, which generates class files for the Java sources. - * The Scala classes compiled in the first step are included on the classpath to the Java compiler. - */ - JavaThenScala, - /** - * Allows Java sources to depend on the Scala sources in the compilation, but does not allow Scala sources to depend on Java sources. - * - * In this mode, both Java and Scala sources are passed to the Scala compiler, which generates class files for the Scala sources. - * Then, Java sources are passed to the Java compiler, which generates class files for the Java sources. - * The Scala classes compiled in the first step are included on the classpath to the Java compiler. - */ - ScalaThenJava -} \ 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 deleted file mode 100755 index 17174ff6a..000000000 --- a/interface/src/main/java/xsbti/compile/CompileProgress.java +++ /dev/null @@ -1,12 +0,0 @@ -package xsbti.compile; - -/** - * An API for reporting when files are being compiled. - * - * Note; This is tied VERY SPECIFICALLY to scala. - */ -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/Compilers.java b/interface/src/main/java/xsbti/compile/Compilers.java deleted file mode 100644 index 0bb194534..000000000 --- a/interface/src/main/java/xsbti/compile/Compilers.java +++ /dev/null @@ -1,8 +0,0 @@ -package xsbti.compile; - -public interface Compilers -{ - JavaCompiler javac(); - // should be cached by client if desired - ScalaCompiler scalac(); -} diff --git a/interface/src/main/java/xsbti/compile/DefinesClass.java b/interface/src/main/java/xsbti/compile/DefinesClass.java deleted file mode 100644 index 261c6ca22..000000000 --- a/interface/src/main/java/xsbti/compile/DefinesClass.java +++ /dev/null @@ -1,12 +0,0 @@ -package xsbti.compile; - -/** -* Determines if an entry on a classpath contains a class. -*/ -public interface DefinesClass -{ - /** - * Returns true if the classpath entry contains the requested class. - */ - boolean apply(String className); -} diff --git a/interface/src/main/java/xsbti/compile/DependencyChanges.java b/interface/src/main/java/xsbti/compile/DependencyChanges.java deleted file mode 100644 index 4f6bda55a..000000000 --- a/interface/src/main/java/xsbti/compile/DependencyChanges.java +++ /dev/null @@ -1,13 +0,0 @@ -package xsbti.compile; - - import java.io.File; - -// only includes changes to dependencies outside of the project -public interface DependencyChanges -{ - boolean isEmpty(); - // class files or jar files - File[] modifiedBinaries(); - // class names - String[] modifiedClasses(); -} \ 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 deleted file mode 100644 index c8540e2d2..000000000 --- a/interface/src/main/java/xsbti/compile/GlobalsCache.java +++ /dev/null @@ -1,13 +0,0 @@ -package xsbti.compile; - -import xsbti.Logger; -import xsbti.Reporter; - -/** - * An interface which lets us know how to retrieve cached compiler instances form the current JVM. - */ -public interface GlobalsCache -{ - CachedCompiler apply(String[] args, Output output, boolean forceNew, CachedCompilerProvider provider, Logger log, Reporter reporter); - void clear(); -} diff --git a/interface/src/main/java/xsbti/compile/IncrementalCompiler.java b/interface/src/main/java/xsbti/compile/IncrementalCompiler.java deleted file mode 100644 index c98263e7f..000000000 --- a/interface/src/main/java/xsbti/compile/IncrementalCompiler.java +++ /dev/null @@ -1,71 +0,0 @@ -package xsbti.compile; - -import xsbti.Logger; -import java.io.File; - -/* -* This API is subject to change. -* -* It is the client's responsibility to: -* 1. Manage class loaders. Usually the client will want to: -* i. Keep the class loader used by the ScalaInstance warm. -* ii. Keep the class loader of the incremental recompilation classes (xsbti.compile) warm. -* iii. Share the class loader for Scala classes between the incremental compiler implementation and the ScalaInstance where possible (must be binary compatible) -* 2. Manage the compiler interface jar. The interface must be compiled against the exact Scala version used for compilation and a compatible Java version. -* 3. Manage compilation order between different compilations. -* i. Execute a compilation for each dependency, obtaining an Analysis for each. -* ii. Provide the Analysis from previous compilations to dependent compilations in the analysis map. -* 4. Provide an implementation of JavaCompiler for compiling Java sources. -* 5. Define a function that determines if a classpath entry contains a class (Setup.definesClass). -* i. This is provided by the client so that the client can cache this information across compilations when compiling multiple sets of sources. -* ii. The cache should be cleared for each new compilation run or else recompilation will not properly account for changes to the classpath. -* 6. Provide a cache directory. -* i. This directory is used by IncrementalCompiler to persist data between compilations. -* ii. It should be a different directory for each set of sources being compiled. -* 7. Manage parallel execution. -* i. Each compilation may be performed in a different thread as long as the dependencies have been compiled already. -* ii. Implementations of all types should be immutable and arrays treated as immutable. -* 8. Ensure general invariants: -* i. The implementations of all types are immutable, except for the already discussed Setup.definesClass. -* ii. Arrays are treated as immutable. -* iii. No value is ever null. -*/ -public interface IncrementalCompiler -{ - /** - * Performs an incremental compilation as configured by `in`. - * The returned Analysis should be provided to compilations depending on the classes from this compilation. - */ - Analysis compile(Inputs in, Logger log); - - /** - * Creates a compiler instance that can be used by the `compile` method. - * - * @param instance The Scala version to use - * @param interfaceJar The compiler interface jar compiled for the Scala version being used - * @param options Configures how arguments to the underlying Scala compiler will be built. - * - */ - @Deprecated - ScalaCompiler newScalaCompiler(ScalaInstance instance, File interfaceJar, ClasspathOptions options, Logger log); - /** - * Creates a compiler instance that can be used by the `compile` method. - * - * @param instance The Scala version to use - * @param interfaceJar The compiler interface jar compiled for the Scala version being used - * @param options Configures how arguments to the underlying Scala compiler will be built. - */ - ScalaCompiler newScalaCompiler(ScalaInstance instance, File interfaceJar, ClasspathOptions options); - - /** - * Compiles the source interface for a Scala version. The resulting jar can then be used by the `newScalaCompiler` method - * to create a ScalaCompiler for incremental compilation. It is the client's responsibility to manage compiled jars for - * different Scala versions. - * - * @param label A brief name describing the source component for use in error messages - * @param sourceJar The jar file containing the compiler interface sources. These are published as sbt's compiler-interface-src module. - * @param targetJar Where to create the output jar file containing the compiled classes. - * @param instance The ScalaInstance to compile the compiler interface for. - * @param log The logger to use during compilation. */ - void compileInterfaceJar(String label, File sourceJar, File targetJar, File interfaceJar, ScalaInstance instance, Logger log); -} diff --git a/interface/src/main/java/xsbti/compile/Inputs.java b/interface/src/main/java/xsbti/compile/Inputs.java deleted file mode 100644 index 5c9ded425..000000000 --- a/interface/src/main/java/xsbti/compile/Inputs.java +++ /dev/null @@ -1,14 +0,0 @@ -package xsbti.compile; - -/** Configures a single compilation of a single set of sources.*/ -public interface Inputs -{ - /** The Scala and Java compilers to use for compilation.*/ - Compilers compilers(); - - /** Standard compilation options, such as the sources and classpath to use. */ - Options options(); - - /** Configures incremental compilation.*/ - Setup setup(); -} diff --git a/interface/src/main/java/xsbti/compile/JavaCompiler.java b/interface/src/main/java/xsbti/compile/JavaCompiler.java deleted file mode 100644 index 18b3f5bea..000000000 --- a/interface/src/main/java/xsbti/compile/JavaCompiler.java +++ /dev/null @@ -1,27 +0,0 @@ -package xsbti.compile; - -import java.io.File; -import xsbti.Logger; -import xsbti.Reporter; - -/** -* Interface to a Java compiler. -*/ -public interface JavaCompiler -{ - /** Compiles Java sources using the provided classpath, output directory, and additional options. - * Output should be sent to the provided logger. - * - * @deprecated 0.13.8 - Use compileWithReporter instead - */ - @Deprecated - 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); -} diff --git a/interface/src/main/java/xsbti/compile/MultipleOutput.java b/interface/src/main/java/xsbti/compile/MultipleOutput.java deleted file mode 100755 index 6ba3479e6..000000000 --- a/interface/src/main/java/xsbti/compile/MultipleOutput.java +++ /dev/null @@ -1,20 +0,0 @@ -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 deleted file mode 100644 index 78643202d..000000000 --- a/interface/src/main/java/xsbti/compile/Options.java +++ /dev/null @@ -1,27 +0,0 @@ -package xsbti.compile; - -import java.io.File; - -/** Standard compilation options.*/ -public interface Options -{ - /** The classpath to use for compilation. - * This will be modified according to the ClasspathOptions used to configure the ScalaCompiler.*/ - File[] classpath(); - - /** All sources that should be recompiled. - * This should include Scala and Java sources, which are identified by their extension. */ - File[] sources(); - - /** Output for the compilation. */ - Output output(); - - /** The options to pass to the Scala compiler other than the sources and classpath to use. */ - String[] options(); - - /** The options to pass to the Java compiler other than the sources and classpath to use. */ - String[] javacOptions(); - - /** Controls the order in which Java and Scala sources are compiled.*/ - CompileOrder order(); -} diff --git a/interface/src/main/java/xsbti/compile/Output.java b/interface/src/main/java/xsbti/compile/Output.java deleted file mode 100755 index 4f785884e..000000000 --- a/interface/src/main/java/xsbti/compile/Output.java +++ /dev/null @@ -1,7 +0,0 @@ -package xsbti.compile; -/** 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/ScalaInstance.java b/interface/src/main/java/xsbti/compile/ScalaInstance.java deleted file mode 100644 index c7f3984e3..000000000 --- a/interface/src/main/java/xsbti/compile/ScalaInstance.java +++ /dev/null @@ -1,37 +0,0 @@ -package xsbti.compile; - -import java.io.File; - -/** -* Defines Scala instance, which is a reference version String, a unique version String, a set of jars, and a class loader for a Scala version. -* -* Note that in this API a 'jar' can actually be any valid classpath entry. -*/ -public interface ScalaInstance -{ - /** The version used to refer to this Scala version. - * It need not be unique and can be a dynamic version like 2.10.0-SNAPSHOT. - */ - String version(); - - /** A class loader providing access to the classes and resources in the library and compiler jars. */ - ClassLoader loader(); - - /**@deprecated Only `jars` can be reliably provided for modularized Scala. (Since 0.13.0) */ - @Deprecated - File libraryJar(); - - /**@deprecated Only `jars` can be reliably provided for modularized Scala. (Since 0.13.0) */ - @Deprecated - File compilerJar(); - - /**@deprecated Only `jars` can be reliably provided for modularized Scala. (Since 0.13.0) */ - @Deprecated - File[] otherJars(); - - /** All jar files provided by this Scala instance.*/ - File[] allJars(); - - /** The unique identifier for this Scala instance. An implementation should usually obtain this from the compiler.properties file in the compiler jar. */ - String actualVersion(); -} diff --git a/interface/src/main/java/xsbti/compile/Setup.java b/interface/src/main/java/xsbti/compile/Setup.java deleted file mode 100644 index edf250b8b..000000000 --- a/interface/src/main/java/xsbti/compile/Setup.java +++ /dev/null @@ -1,47 +0,0 @@ -package xsbti.compile; - -import java.io.File; -import java.util.Map; - -import xsbti.Maybe; -import xsbti.Reporter; - -/** Configures incremental recompilation. */ -public interface Setup -{ - /** Provides the Analysis for the given classpath entry.*/ - Maybe analysisMap(File file); - - /** Provides a function to determine if classpath entry `file` contains a given class. - * The returned function should generally cache information about `file`, such as the list of entries in a jar. - */ - DefinesClass definesClass(File file); - - /** If true, no sources are actually compiled and the Analysis from the previous compilation is returned.*/ - boolean skip(); - - /** The file used to cache information across compilations. - * This file can be removed to force a full recompilation. - * The file should be unique and not shared between compilations. */ - File cacheFile(); - - GlobalsCache cache(); - - /** If returned, the progress that should be used to report scala compilation to. */ - Maybe progress(); - - /** The reporter that should be used to report scala compilation to. */ - Reporter reporter(); - - /** - * Returns incremental compiler options. - * - * @see sbt.inc.IncOptions for details - * - * You can get default options by calling sbt.inc.IncOptions.toStringMap(sbt.inc.IncOptions.Default). - * - * In the future, we'll extend API in xsbti to provide factory methods that would allow to obtain - * defaults values so one can depend on xsbti package only. - **/ - Map incrementalCompilerOptions(); -} diff --git a/interface/src/main/java/xsbti/compile/SingleOutput.java b/interface/src/main/java/xsbti/compile/SingleOutput.java deleted file mode 100755 index cb200c9b7..000000000 --- a/interface/src/main/java/xsbti/compile/SingleOutput.java +++ /dev/null @@ -1,12 +0,0 @@ -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 diff --git a/util/log/src/main/scala/sbt/Logger.scala b/util/log/src/main/scala/sbt/Logger.scala index 848d45b3f..ddba892d2 100644 --- a/util/log/src/main/scala/sbt/Logger.scala +++ b/util/log/src/main/scala/sbt/Logger.scala @@ -5,6 +5,7 @@ package sbt import xsbti.{ Logger => xLogger, F0 } import xsbti.{ Maybe, Position, Problem, Severity } +import sys.process.ProcessLogger import java.io.File @@ -117,6 +118,10 @@ trait Logger extends xLogger { final def info(message: => String): Unit = log(Level.Info, message) final def warn(message: => String): Unit = log(Level.Warn, message) final def error(message: => String): Unit = log(Level.Error, message) + // Added by sys.process.ProcessLogger + final def err(message: => String): Unit = log(Level.Error, message) + // sys.process.ProcessLogger + final def out(message: => String): Unit = log(Level.Info, message) def ansiCodesSupported: Boolean = false