forked from scala/scala
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '1.0.x' into merge-1.0.x-into-1.x
* 1.0.x: (28 commits) Split compiler bridge tests to another subproject Implement compiler bridge for 2.13.0-M2 Add yourkit acknoledgement in the README "sbt '++ 2.13.0-M2!' compile" does not work with sbt 1.0.0 Add header to cached hashing spec Add headers to missing files Fix scala#332: Add sbt-header back to the build Update sbt-scalafmt to 1.12 Make classpath hashing more lightweight Fix scala#442: Name hash of value class should include underlying type source-dependencies/value-class-underlying: fix test Ignore null in generic lambda tparams Improve and make scripted parallel Fix scala#436: Remove annoying log4j scripted exception Fix scala#127: Use `unexpanded` name instead of `name` Add pending test case for issue/127 source-dependencies / patMat-scope workaround Fixes undercompilation on inheritance on same source Add real reproduction case for sbt/zinc#417 Add trait-trait-212 for Scala 2.12.3 ... Conflicts: internal/zinc-apiinfo/src/main/scala/sbt/internal/inc/ClassToAPI.scala project/build.properties zinc/src/main/scala/sbt/internal/inc/MixedAnalyzingCompiler.scala The ClassToAPI conflict is due to: * sbt/zinc#393 (a 1.x PR), conflicting with * sbt/zinc#446 (a 1.0.x PR). The build.properties conflict is due to different PRs bumping sbt.version from 1.0.0 to 1.0.2 to 1.0.3. (scala#413, scala#418, scala#453). The MixedAnalyzingCompiler conflict is due to: * sbt/zinc#427 (a 1.x PR), conflicting with * sbt/zinc#452 (a 1.0.x PR). Rewritten from sbt/zinc@e245d95
- Loading branch information
Showing
24 changed files
with
302 additions
and
1,474 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,6 @@ | ||
# xsbti Java interfaces must be defined in the compiler interface, not the bridge. | ||
# Bridge implementations are compiled per Zinc, so these are safe to change. | ||
ProblemFilters.exclude[MissingClassProblem]("xsbti.InteractiveConsoleFactory") | ||
ProblemFilters.exclude[MissingClassProblem]("xsbti.InteractiveConsoleResult") | ||
ProblemFilters.exclude[MissingClassProblem]("xsbti.InteractiveConsoleInterface") | ||
ProblemFilters.exclude[MissingClassProblem]("xsbti.InteractiveConsoleResponse") |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
/* | ||
* Zinc - The incremental compiler for Scala. | ||
* Copyright 2011 - 2017, Lightbend, Inc. | ||
* Copyright 2008 - 2010, Mark Harrah | ||
* This software is released under the terms written in LICENSE. | ||
*/ | ||
|
||
package xsbt | ||
|
||
import xsbti.Logger | ||
import scala.tools.nsc.interpreter.{ ILoop, IMain, InteractiveReader, NamedParam } | ||
import scala.tools.nsc.reporters.Reporter | ||
import scala.tools.nsc.{ GenericRunnerCommand, Settings } | ||
|
||
class ConsoleInterface { | ||
def commandArguments( | ||
args: Array[String], | ||
bootClasspathString: String, | ||
classpathString: String, | ||
log: Logger | ||
): Array[String] = | ||
MakeSettings.sync(args, bootClasspathString, classpathString, log).recreateArgs.toArray[String] | ||
|
||
def run( | ||
args: Array[String], | ||
bootClasspathString: String, | ||
classpathString: String, | ||
initialCommands: String, | ||
cleanupCommands: String, | ||
loader: ClassLoader, | ||
bindNames: Array[String], | ||
bindValues: Array[Any], | ||
log: Logger | ||
): Unit = { | ||
lazy val interpreterSettings = MakeSettings.sync(args.toList, log) | ||
val compilerSettings = MakeSettings.sync(args, bootClasspathString, classpathString, log) | ||
|
||
log.info(Message("Starting scala interpreter...")) | ||
log.info(Message("")) | ||
|
||
val loop = new ILoop { | ||
override def createInterpreter() = { | ||
if (loader ne null) { | ||
in = InteractiveReader.apply() | ||
intp = new IMain(settings) { | ||
override protected def parentClassLoader = | ||
if (loader eq null) super.parentClassLoader else loader | ||
|
||
override protected def newCompiler(settings: Settings, reporter: Reporter) = | ||
super.newCompiler(compilerSettings, reporter) | ||
} | ||
intp.setContextClassLoader() | ||
} else | ||
super.createInterpreter() | ||
|
||
for ((id, value) <- bindNames zip bindValues) | ||
intp.quietBind(NamedParam.clazz(id, value)) | ||
|
||
if (!initialCommands.isEmpty) | ||
intp.interpret(initialCommands) | ||
|
||
() | ||
} | ||
|
||
override def closeInterpreter(): Unit = { | ||
if (!cleanupCommands.isEmpty) | ||
intp.interpret(cleanupCommands) | ||
super.closeInterpreter() | ||
} | ||
} | ||
|
||
loop.process(if (loader eq null) compilerSettings else interpreterSettings) | ||
|
||
() | ||
} | ||
} | ||
|
||
object MakeSettings { | ||
def apply(args: List[String], log: Logger): Settings = { | ||
val command = new GenericRunnerCommand(args, message => log.error(Message(message))) | ||
if (command.ok) | ||
command.settings | ||
else | ||
throw new InterfaceCompileFailed(Array(), Array(), command.usageMsg) | ||
} | ||
|
||
def sync( | ||
args: Array[String], | ||
bootClasspathString: String, | ||
classpathString: String, | ||
log: Logger | ||
): Settings = { | ||
val compilerSettings = sync(args.toList, log) | ||
if (!bootClasspathString.isEmpty) | ||
compilerSettings.bootclasspath.value = bootClasspathString | ||
compilerSettings.classpath.value = classpathString | ||
compilerSettings | ||
} | ||
|
||
def sync(options: List[String], log: Logger): Settings = { | ||
val settings = apply(options, log) | ||
settings.Yreplsync.value = true | ||
settings | ||
} | ||
} |
Oops, something went wrong.