More general boot classpath discovery

This commit is contained in:
Jason Zaugg 2017-11-01 08:48:12 +10:00
parent e3c4db5ae8
commit 3cd4815fe4
1 changed files with 7 additions and 1 deletions

View File

@ -45,7 +45,13 @@ 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 = System.getProperty("sun.boot.class.path", findBoot)
if (addLibrary) {
val newBootPrefix = if (originalBoot.isEmpty) "" else originalBoot + File.pathSeparator
newBootPrefix + scalaInstance.libraryJar.getAbsolutePath