Add `scala-reflect.jar` to JARs of `StaticScalaProvider`

It turns out we need to have `scala-reflect.jar` on classpath to compile
the compiler bridge for the static scala instance of the launcher.
This commit is contained in:
Martin Duhem 2016-04-08 17:55:38 +02:00
parent 6beb8f2c85
commit fab20c73bf
2 changed files with 8 additions and 2 deletions

View File

@ -375,7 +375,7 @@ lazy val compilerIvyProj = (project in compilePath / "ivy").
val compilerBridgeSrc = (Keys.packageSrc in (compileInterfaceProj, Compile)).value
val xsbtiJAR = (Keys.packageBin in (interfaceProj, Compile)).value
// They are immediately used by the static launcher.
val included = Set("scala-compiler.jar", "scala-library.jar")
val included = Set("scala-compiler.jar", "scala-library.jar", "scala-reflect.jar")
val scalaJars = (externalDependencyClasspath in Compile).value.map(_.data).filter(j => included contains j.getName)
Seq(compilerBridgeSrc, xsbtiJAR) ++ scalaJars
}

View File

@ -20,6 +20,8 @@ private object StaticUtils {
val COMPILER_JAR = "scala-compiler.jar"
val LIBRARY = "library"
val LIBRARY_JAR = "scala-library.jar"
val REFLECT = "reflect"
val REFLECT_JAR = "scala-reflect.jar"
val XSBTI = "xsbti"
val XSBTI_JAR = s"interface-${sbtApplicationID.version}.jar"
val thisJAR: File = new File(getClass.getProtectionDomain().getCodeSource().getLocation().toURI().getPath())
@ -109,7 +111,7 @@ private class StaticScalaProvider(appProvider: StaticAppProvider) extends xsbti.
override def app(id: xsbti.ApplicationID): xsbti.AppProvider = appProvider
override def compilerJar(): File = getComponent(StaticUtils.COMPILER)
override def libraryJar(): File = getComponent(StaticUtils.LIBRARY)
override def jars(): Array[File] = Array(compilerJar, libraryJar)
override def jars(): Array[File] = Array(compilerJar, libraryJar, getComponent(StaticUtils.REFLECT))
override def loader(): ClassLoader = new URLClassLoader(jars map (_.toURI.toURL))
override def version(): String = StaticUtils.getProperty(loader, "compiler.properties", "version.number") getOrElse "unknown"
}
@ -124,6 +126,10 @@ private class StaticAppProvider(appConfig: StaticAppConfiguration) extends xsbti
installFromResources(StaticUtils.LIBRARY_JAR, StaticUtils.LIBRARY)
}
if (components.component(StaticUtils.REFLECT).isEmpty) {
installFromResources(StaticUtils.REFLECT_JAR, StaticUtils.REFLECT)
}
if (components.component(StaticUtils.XSBTI).isEmpty) {
installFromResources(StaticUtils.XSBTI_JAR, StaticUtils.XSBTI)
}