diff options
Diffstat (limited to 'project/Layers.scala')
-rw-r--r-- | project/Layers.scala | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/project/Layers.scala b/project/Layers.scala index 6d0c68f2a4..35cc79c130 100644 --- a/project/Layers.scala +++ b/project/Layers.scala @@ -25,15 +25,16 @@ trait Layers extends Build { /** Creates a reference Scala version that can be used to build other projects. This takes in the raw * library, compiler and fjbg libraries as well as a string representing the layer name (used for compiling the compile-interface). */ - def makeScalaReference(layer: String, library: Project, compiler: Project) = + def makeScalaReference(layer: String, library: Project, reflect: Project, compiler: Project) = scalaInstance <<= (appConfiguration in library, version in library, (exportedProducts in library in Compile), + (exportedProducts in reflect in Compile), (exportedProducts in compiler in Compile), (exportedProducts in fjbg in Compile), (fullClasspath in jline in Runtime), (exportedProducts in asm in Runtime)) map { - (app, version: String, lib: Classpath, comp: Classpath, fjbg: Classpath, jline: Classpath, asm: Classpath) => + (app, version: String, lib: Classpath, reflect: Classpath, comp: Classpath, fjbg: Classpath, jline: Classpath, asm: Classpath) => val launcher = app.provider.scalaProvider.launcher (lib,comp) match { case (Seq(libraryJar), Seq(compilerJar)) => @@ -42,7 +43,7 @@ trait Layers extends Build { libraryJar.data, compilerJar.data, launcher, - ((fjbg.files++jline.files ++ asm.files):_*)) + ((fjbg.files ++ jline.files ++ asm.files ++ reflect.files):_*)) case _ => error("Cannot build a ScalaReference with more than one classpath element") } } @@ -51,7 +52,7 @@ trait Layers extends Build { * Returns the library project and compiler project from the next layer. * Note: The library and compiler are not *complete* in the sense that they are missing things like "actors" and "fjbg". */ - def makeLayer(layer: String, referenceScala: Setting[Task[ScalaInstance]], autoLock: Boolean = false) : (Project, Project) = { + def makeLayer(layer: String, referenceScala: Setting[Task[ScalaInstance]], autoLock: Boolean = false) : (Project, Project, Project) = { val autoLockSettings: Seq[Setting[_]] = if(autoLock) Seq(compile in Compile <<= (compile in Compile, lock) apply { (c, l) => c flatMapR { cResult => @@ -76,6 +77,20 @@ trait Layers extends Build { referenceScala ) + // Define the reflection + val reflect = Project(layer + "-reflect", file(".")) settings(settingOverrides:_*) settings(autoLockSettings:_*) settings( + version := layer, + scalaSource in Compile <<= (baseDirectory) apply (_ / "src" / "reflect"), + resourceDirectory in Compile <<= baseDirectory apply (_ / "src" / "reflect"), + defaultExcludes := ("tests"), + defaultExcludes in unmanagedResources := "*.scala", + resourceGenerators in Compile <+= (resourceManaged, Versions.scalaVersions, skip in Compile, streams) map Versions.generateVersionPropertiesFile("reflect.properties"), + // TODO - Use depends on *and* SBT's magic dependency mechanisms... + unmanagedClasspath in Compile <<= Seq(forkjoin, library).map(exportedProducts in Compile in _).join.map(_.flatten), + externalDeps, + referenceScala + ) + // Define the compiler val compiler = Project(layer + "-compiler", file(".")) settings(settingOverrides:_*) settings(autoLockSettings:_*) settings( version := layer, @@ -93,13 +108,13 @@ trait Layers extends Build { dirs.descendentsExcept( ("*.xml" | "*.html" | "*.gif" | "*.png" | "*.js" | "*.css" | "*.tmpl" | "*.swf" | "*.properties" | "*.txt"),"*.scala").get }, // TODO - Use depends on *and* SBT's magic dependency mechanisms... - unmanagedClasspath in Compile <<= Seq(forkjoin, library, fjbg, jline, asm).map(exportedProducts in Compile in _).join.map(_.flatten), + unmanagedClasspath in Compile <<= Seq(forkjoin, library, reflect, fjbg, jline, asm).map(exportedProducts in Compile in _).join.map(_.flatten), externalDeps, referenceScala ) // Return the generated projects. - (library, compiler) + (library, reflect, compiler) } } |