mirror of https://github.com/sbt/sbt.git
Merge pull request #3701 from retronym/ticket/bootclasspath
Fix over-compilation bug with Java 9, scala.ext.dir
This commit is contained in:
commit
a5bd564307
|
|
@ -63,7 +63,13 @@ final class Dependency(val global: CallbackGlobal) extends LocateClassFile with
|
|||
case Some((f, className, inOutDir)) =>
|
||||
if (inOutDir && on.isJavaDefined) registerTopLevelSym(on)
|
||||
f match {
|
||||
case ze: ZipArchive#Entry => for (zip <- ze.underlyingSource; zipFile <- Option(zip.file)) binaryDependency(zipFile, className)
|
||||
case ze: ZipArchive#Entry =>
|
||||
// Scala 2.10/2.11 give back $JAVA_HOME as the underlying source for the platform classloader
|
||||
// See https://github.com/scala/scala/pull/6113. Treating that as not having an underlying source
|
||||
// is the least bad option for now. We would not trigger a recompile if the JDK is updated, but that
|
||||
// is better than recompiling *every* time, which seems to happen if we let the directory propagate
|
||||
// to `binaryDependency`.
|
||||
for (zip <- ze.underlyingSource; zipFile <- Option(zip.file).filterNot(_.isDirectory)) binaryDependency(zipFile, className)
|
||||
case pf: PlainFile => binaryDependency(pf.file, className)
|
||||
case _ => ()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,14 @@ final class CompilerArguments(scalaInstance: xsbti.compile.ScalaInstance, cp: xs
|
|||
/** Add the correct Scala library jar to the boot classpath if `addLibrary` is true.*/
|
||||
def createBootClasspath(addLibrary: Boolean) =
|
||||
{
|
||||
val originalBoot = System.getProperty("sun.boot.class.path", "")
|
||||
def findBoot: String =
|
||||
{
|
||||
import scala.collection.JavaConverters._
|
||||
System.getProperties.asScala.iterator.collectFirst {
|
||||
case (k, v) if k.endsWith(".boot.class.path") => v
|
||||
}.getOrElse("")
|
||||
}
|
||||
val originalBoot = Option(System.getProperty("sun.boot.class.path")).getOrElse(findBoot)
|
||||
if (addLibrary) {
|
||||
val newBootPrefix = if (originalBoot.isEmpty) "" else originalBoot + File.pathSeparator
|
||||
newBootPrefix + scalaInstance.libraryJar.getAbsolutePath
|
||||
|
|
@ -63,7 +70,7 @@ final class CompilerArguments(scalaInstance: xsbti.compile.ScalaInstance, cp: xs
|
|||
def bootClasspathFor(classpath: Seq[File]) = bootClasspath(hasLibrary(classpath))
|
||||
|
||||
import Path._
|
||||
def extClasspath: Seq[File] = (IO.parseClasspath(System.getProperty("java.ext.dirs", "")) * "*.jar").get
|
||||
def extClasspath: Seq[File] = List("java.ext.dirs", "scala.ext.dirs").flatMap(k => (IO.parseClasspath(System.getProperty(k, "")) * "*.jar").get)
|
||||
}
|
||||
object CompilerArguments {
|
||||
val BootClasspathOption = "-bootclasspath"
|
||||
|
|
|
|||
Loading…
Reference in New Issue