clean up boot classpath handling

This commit is contained in:
Mark Harrah 2011-03-11 16:54:45 -05:00
parent c0c287d50e
commit 700b67c322
3 changed files with 11 additions and 6 deletions

View File

@ -3,9 +3,9 @@
*/
package sbt
final case class ClasspathOptions(autoBoot: Boolean, compiler: Boolean, extra: Boolean)
final case class ClasspathOptions(bootLibrary: Boolean, compiler: Boolean, extra: Boolean, autoBoot: Boolean)
object ClasspathOptions
{
def manual = ClasspathOptions(false, false, false)
def auto = ClasspathOptions(true, true, true)
def manual = ClasspathOptions(false, false, false, true)
def auto = ClasspathOptions(true, true, true, true)
}

View File

@ -35,8 +35,13 @@ final class CompilerArguments(scalaInstance: ScalaInstance, cp: ClasspathOptions
def createBootClasspath =
{
val originalBoot = System.getProperty("sun.boot.class.path", "")
val newBootPrefix = if(originalBoot.isEmpty) "" else originalBoot + File.pathSeparator
newBootPrefix + scalaInstance.libraryJar.getAbsolutePath
if(cp.bootLibrary)
{
val newBootPrefix = if(originalBoot.isEmpty) "" else originalBoot + File.pathSeparator
newBootPrefix + scalaInstance.libraryJar.getAbsolutePath
}
else
originalBoot
}
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

View File

@ -18,7 +18,7 @@ object JavaCompiler
new JavaCompiler {
def apply(sources: Seq[File], classpath: Seq[File], outputDirectory: File, options: Seq[String])(implicit log: Logger) {
val augmentedClasspath = if(cp.autoBoot) classpath ++ Seq(scalaInstance.libraryJar) else classpath
val javaCp = new ClasspathOptions(false, cp.compiler, false)
val javaCp = new ClasspathOptions(false, cp.compiler, false, false)
val arguments = (new CompilerArguments(scalaInstance, javaCp))(sources, augmentedClasspath, outputDirectory, options)
log.debug("running javac with arguments:\n\t" + arguments.mkString("\n\t"))
val code: Int = f(arguments, log)