Include jars from java.ext.dirs in incremental classpath. Fixes #678.

Ideally, we wouldn't need to construct the classpath ourselves and instead
reuse the classpath construction code from a compiler (scalac or javac).
However, we need to ensure that we only call the compiler when needed.
Because we need to construct the classpath even when compilation might
not happen, we have to duplicate classpath construction.
This commit is contained in:
Mark Harrah 2013-02-22 16:31:32 -05:00
parent 010b9d1c10
commit a1c70c7462
2 changed files with 7 additions and 4 deletions

View File

@ -47,7 +47,7 @@ class AggressiveCompile(cacheFile: File)
}
def withBootclasspath(args: CompilerArguments, classpath: Seq[File]): Seq[File] =
args.bootClasspathFor(classpath) ++ args.finishClasspath(classpath)
args.bootClasspathFor(classpath) ++ args.extClasspath ++ args.finishClasspath(classpath)
def compile1(sources: Seq[File],
classpath: Seq[File],

View File

@ -29,9 +29,9 @@ final class CompilerArguments(scalaInstance: xsbti.compile.ScalaInstance, cp: xs
}
def finishClasspath(classpath: Seq[File]): Seq[File] =
filterLibrary(classpath) ++ include(cp.compiler, scalaInstance.compilerJar) ++ include(cp.extra, scalaInstance.otherJars : _*)
private def include(flag: Boolean, jars: File*) = if(flag) jars else Nil
protected def abs(files: Seq[File]) = files.map(_.getAbsolutePath).sortWith(_ < _)
protected def checkScalaHomeUnset()
private[this] def include(flag: Boolean, jars: File*) = if(flag) jars else Nil
private[this] def abs(files: Seq[File]) = files.map(_.getAbsolutePath).sortWith(_ < _)
private[this] def checkScalaHomeUnset()
{
val scalaHome = System.getProperty("scala.home")
assert((scalaHome eq null) || scalaHome.isEmpty, "'scala.home' should not be set (was " + scalaHome + ")")
@ -59,6 +59,9 @@ final class CompilerArguments(scalaInstance: xsbti.compile.ScalaInstance, cp: xs
def bootClasspathOption(addLibrary: Boolean) = if(cp.autoBoot) Seq(BootClasspathOption, createBootClasspath(addLibrary)) else Nil
def bootClasspath(addLibrary: Boolean) = if(cp.autoBoot) IO.parseClasspath(createBootClasspath(addLibrary)) else Nil
def bootClasspathFor(classpath: Seq[File]) = bootClasspath(hasLibrary(classpath))
import Path._
def extClasspath: Seq[File] = ( IO.parseClasspath(System.getProperty("java.ext.dirs")) * "*.jar" ).get
}
object CompilerArguments
{