mirror of https://github.com/sbt/sbt.git
handle custom -bootclasspath in incremental recompilation
This commit is contained in:
parent
a19d5a799c
commit
980e906ca1
|
|
@ -5,7 +5,7 @@ package sbt
|
|||
package compiler
|
||||
|
||||
import java.io.File
|
||||
import CompilerArguments.{abs, absString}
|
||||
import CompilerArguments.{abs, absString, BootClasspathOption}
|
||||
|
||||
/** Forms the list of options that is passed to the compiler from the required inputs and other options.
|
||||
* The directory containing scala-library.jar and scala-compiler.jar (scalaLibDirectory) is required in
|
||||
|
|
@ -45,11 +45,12 @@ final class CompilerArguments(scalaInstance: ScalaInstance, cp: ClasspathOptions
|
|||
}
|
||||
def filterLibrary(classpath: Seq[File]) =
|
||||
if(cp.filterLibrary) classpath.filterNot(_.getName contains ScalaArtifacts.LibraryID) else classpath
|
||||
def bootClasspathOption = if(cp.autoBoot) Seq("-bootclasspath", createBootClasspath) else Nil
|
||||
def bootClasspath = if(cp.autoBoot) sbt.IO.pathSplit(createBootClasspath).map(new File(_)).toSeq else Nil
|
||||
def bootClasspathOption = if(cp.autoBoot) Seq(BootClasspathOption, createBootClasspath) else Nil
|
||||
def bootClasspath = if(cp.autoBoot) IO.parseClasspath(createBootClasspath) else Nil
|
||||
}
|
||||
object CompilerArguments
|
||||
{
|
||||
val BootClasspathOption = "-bootclasspath"
|
||||
def abs(files: Seq[File]): Seq[String] = files.map(_.getAbsolutePath)
|
||||
def abs(files: Set[File]): Seq[String] = abs(files.toSeq)
|
||||
def absString(files: Seq[File]): String = abs(files).mkString(File.pathSeparator)
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ class AggressiveCompile(cacheDirectory: File)
|
|||
val absClasspath = classpath.map(_.getCanonicalFile)
|
||||
val apiOption= (api: Either[Boolean, Source]) => api.right.toOption
|
||||
val cArgs = new CompilerArguments(compiler.scalaInstance, compiler.cp)
|
||||
val searchClasspath = withBootclasspath(cArgs, absClasspath)
|
||||
val searchClasspath = explicitBootClasspath(options.options) ++ withBootclasspath(cArgs, absClasspath)
|
||||
val entry = Locate.entry(searchClasspath, definesClass)
|
||||
|
||||
val compile0 = (include: Set[File], callback: AnalysisCallback) => {
|
||||
|
|
@ -106,6 +106,9 @@ class AggressiveCompile(cacheDirectory: File)
|
|||
}
|
||||
def javaOnly(f: File) = f.getName.endsWith(".java")
|
||||
|
||||
private[this] def explicitBootClasspath(options: Seq[String]): Seq[File] =
|
||||
options.dropWhile(_ != CompilerArguments.BootClasspathOption).drop(1).take(1).headOption.toList.flatMap(IO.parseClasspath)
|
||||
|
||||
import AnalysisFormats._
|
||||
val store = AggressiveCompile.staticCache(cacheDirectory, AnalysisStore.sync(AnalysisStore.cached(FileBasedStore(cacheDirectory))))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -627,4 +627,6 @@ object IO
|
|||
}
|
||||
def assertAbsolute(f: File) = assert(f.isAbsolute, "Not absolute: " + f)
|
||||
def assertAbsolute(uri: URI) = assert(uri.isAbsolute, "Not absolute: " + uri)
|
||||
|
||||
def parseClasspath(s: String): Seq[File] = IO.pathSplit(s).map(new File(_)).toSeq
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue