-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reluctantly restore compatiblity of xsbti.*
Fixes #779 As it stands, compiler-interface and compiler bridge implementation is an internal concern of Zinc implementation. We _should_ be able to remove methods or change the method signatures. The word "interface" here is between Scalac and Zinc internal, not to the world. In reality, the situation is more complicated because we have Dotty compiler out there that is bound to specific version of compiler-interface. So when I released sbt 1.4.0-M1 this resulted in NoSuchMethodErrors: ``` [error] ## Exception when compiling 1 sources to /private/tmp/hello-dotty/target/scala-0.24/classes [error] java.lang.RuntimeException: java.lang.reflect.InvocationTargetException [error] xsbt.CompilerInterface.newCompiler(CompilerInterface.java:35) .... [error] Caused by: java.lang.NoSuchMethodError: xsbti.compile.SingleOutput.getOutputDirectory()Ljava/io/File; [error] at xsbt.CachedCompilerImpl.<init>(CachedCompilerImpl.java:35) ``` To smooth things out, one approach we've discussed is to create a separate compiler-interface (in a different package) that is less dependent on Zinc specifics. Related to that, in #661 I've created Java interface for `CompilerInterface1`, and we can use pattern matching to see which capability the compiler bridge implementation supports. This creates brings in those Java interfaces as well. In any case, this commit brings back the old `java.io.File`-based methods, and locally I was able to get hello world from Dotty.
- Loading branch information
Showing
37 changed files
with
688 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
internal/compiler-interface/src/main/java/xsbti/compile/CachedCompiler2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Zinc - The incremental compiler for Scala. | ||
* Copyright Lightbend, Inc. and Mark Harrah | ||
* | ||
* Licensed under Apache License 2.0 | ||
* (http://www.apache.org/licenses/LICENSE-2.0). | ||
* | ||
* See the NOTICE file distributed with this work for | ||
* additional information regarding copyright ownership. | ||
*/ | ||
|
||
package xsbti.compile; | ||
|
||
import xsbti.AnalysisCallback; | ||
import xsbti.Logger; | ||
import xsbti.Reporter; | ||
import xsbti.VirtualFile; | ||
import java.io.File; | ||
|
||
/** | ||
* Define the interface of a cached Scala compiler that can be run. | ||
* | ||
* This cached compiler hides the implementation of a compiler by just | ||
* defining two operations: {@link #commandArguments(File[])} and | ||
* | ||
*/ | ||
public interface CachedCompiler2 extends CachedCompiler { | ||
/** | ||
* Run the cached Scala compiler with inputs of incremental compilation. | ||
* | ||
* @param sources The source files to be compiled. | ||
* @param changes The changes that have occurred since last compilation. | ||
* @param callback The callback injected by the incremental compiler. | ||
* @param logger The logger of the incremental compilation. | ||
* @param delegate The reporter that informs on the compiler's output. | ||
* @param progress The compiler progress associated with a Scala compiler. | ||
*/ | ||
void run(VirtualFile[] sources, DependencyChanges changes, AnalysisCallback callback, Logger logger, Reporter delegate, CompileProgress progress); | ||
} | ||
|
Oops, something went wrong.