@@ -25,15 +25,16 @@ trait Layers extends Build {
2525 /** Creates a reference Scala version that can be used to build other projects. This takes in the raw
2626 * library, compiler and fjbg libraries as well as a string representing the layer name (used for compiling the compile-interface).
2727 */
28- def makeScalaReference (layer : String , library : Project , compiler : Project ) =
28+ def makeScalaReference (layer : String , library : Project , reflect : Project , compiler : Project ) =
2929 scalaInstance <<= (appConfiguration in library,
3030 version in library,
3131 (exportedProducts in library in Compile ),
32+ (exportedProducts in reflect in Compile ),
3233 (exportedProducts in compiler in Compile ),
3334 (exportedProducts in fjbg in Compile ),
3435 (fullClasspath in jline in Runtime ),
3536 (exportedProducts in asm in Runtime )) map {
36- (app, version : String , lib : Classpath , comp : Classpath , fjbg : Classpath , jline : Classpath , asm : Classpath ) =>
37+ (app, version : String , lib : Classpath , reflect : Classpath , comp : Classpath , fjbg : Classpath , jline : Classpath , asm : Classpath ) =>
3738 val launcher = app.provider.scalaProvider.launcher
3839 (lib,comp) match {
3940 case (Seq (libraryJar), Seq (compilerJar)) =>
@@ -42,7 +43,7 @@ trait Layers extends Build {
4243 libraryJar.data,
4344 compilerJar.data,
4445 launcher,
45- ((fjbg.files++ jline.files ++ asm.files):_* ))
46+ ((fjbg.files ++ jline.files ++ asm.files ++ reflect .files):_* ))
4647 case _ => error(" Cannot build a ScalaReference with more than one classpath element" )
4748 }
4849 }
@@ -51,7 +52,7 @@ trait Layers extends Build {
5152 * Returns the library project and compiler project from the next layer.
5253 * Note: The library and compiler are not *complete* in the sense that they are missing things like "actors" and "fjbg".
5354 */
54- def makeLayer (layer : String , referenceScala : Setting [Task [ScalaInstance ]], autoLock : Boolean = false ) : (Project , Project ) = {
55+ def makeLayer (layer : String , referenceScala : Setting [Task [ScalaInstance ]], autoLock : Boolean = false ) : (Project , Project , Project ) = {
5556 val autoLockSettings : Seq [Setting [_]] =
5657 if (autoLock) Seq (compile in Compile <<= (compile in Compile , lock) apply { (c, l) =>
5758 c flatMapR { cResult =>
@@ -76,6 +77,20 @@ trait Layers extends Build {
7677 referenceScala
7778 )
7879
80+ // Define the reflection
81+ val reflect = Project (layer + " -reflect" , file(" ." )) settings(settingOverrides:_* ) settings(autoLockSettings:_* ) settings(
82+ version := layer,
83+ scalaSource in Compile <<= (baseDirectory) apply (_ / " src" / " reflect" ),
84+ resourceDirectory in Compile <<= baseDirectory apply (_ / " src" / " reflect" ),
85+ defaultExcludes := (" tests" ),
86+ defaultExcludes in unmanagedResources := " *.scala" ,
87+ resourceGenerators in Compile <+= (resourceManaged, Versions .scalaVersions, skip in Compile , streams) map Versions .generateVersionPropertiesFile(" reflect.properties" ),
88+ // TODO - Use depends on *and* SBT's magic dependency mechanisms...
89+ unmanagedClasspath in Compile <<= Seq (forkjoin, library).map(exportedProducts in Compile in _).join.map(_.flatten),
90+ externalDeps,
91+ referenceScala
92+ )
93+
7994 // Define the compiler
8095 val compiler = Project (layer + " -compiler" , file(" ." )) settings(settingOverrides:_* ) settings(autoLockSettings:_* ) settings(
8196 version := layer,
@@ -93,13 +108,13 @@ trait Layers extends Build {
93108 dirs.descendentsExcept( (" *.xml" | " *.html" | " *.gif" | " *.png" | " *.js" | " *.css" | " *.tmpl" | " *.swf" | " *.properties" | " *.txt" )," *.scala" ).get
94109 },
95110 // TODO - Use depends on *and* SBT's magic dependency mechanisms...
96- unmanagedClasspath in Compile <<= Seq (forkjoin, library, fjbg, jline, asm).map(exportedProducts in Compile in _).join.map(_.flatten),
111+ unmanagedClasspath in Compile <<= Seq (forkjoin, library, reflect, fjbg, jline, asm).map(exportedProducts in Compile in _).join.map(_.flatten),
97112 externalDeps,
98113 referenceScala
99114 )
100115
101116 // Return the generated projects.
102- (library, compiler)
117+ (library, reflect, compiler)
103118 }
104119
105120}
0 commit comments