@@ -25,15 +25,16 @@ trait Layers extends Build {
25
25
/** Creates a reference Scala version that can be used to build other projects. This takes in the raw
26
26
* library, compiler and fjbg libraries as well as a string representing the layer name (used for compiling the compile-interface).
27
27
*/
28
- def makeScalaReference (layer : String , library : Project , compiler : Project ) =
28
+ def makeScalaReference (layer : String , library : Project , reflect : Project , compiler : Project ) =
29
29
scalaInstance <<= (appConfiguration in library,
30
30
version in library,
31
31
(exportedProducts in library in Compile ),
32
+ (exportedProducts in reflect in Compile ),
32
33
(exportedProducts in compiler in Compile ),
33
34
(exportedProducts in fjbg in Compile ),
34
35
(fullClasspath in jline in Runtime ),
35
36
(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 ) =>
37
38
val launcher = app.provider.scalaProvider.launcher
38
39
(lib,comp) match {
39
40
case (Seq (libraryJar), Seq (compilerJar)) =>
@@ -42,7 +43,7 @@ trait Layers extends Build {
42
43
libraryJar.data,
43
44
compilerJar.data,
44
45
launcher,
45
- ((fjbg.files++ jline.files ++ asm.files):_* ))
46
+ ((fjbg.files ++ jline.files ++ asm.files ++ reflect .files):_* ))
46
47
case _ => error(" Cannot build a ScalaReference with more than one classpath element" )
47
48
}
48
49
}
@@ -51,7 +52,7 @@ trait Layers extends Build {
51
52
* Returns the library project and compiler project from the next layer.
52
53
* Note: The library and compiler are not *complete* in the sense that they are missing things like "actors" and "fjbg".
53
54
*/
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 ) = {
55
56
val autoLockSettings : Seq [Setting [_]] =
56
57
if (autoLock) Seq (compile in Compile <<= (compile in Compile , lock) apply { (c, l) =>
57
58
c flatMapR { cResult =>
@@ -76,6 +77,20 @@ trait Layers extends Build {
76
77
referenceScala
77
78
)
78
79
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
+
79
94
// Define the compiler
80
95
val compiler = Project (layer + " -compiler" , file(" ." )) settings(settingOverrides:_* ) settings(autoLockSettings:_* ) settings(
81
96
version := layer,
@@ -93,13 +108,13 @@ trait Layers extends Build {
93
108
dirs.descendentsExcept( (" *.xml" | " *.html" | " *.gif" | " *.png" | " *.js" | " *.css" | " *.tmpl" | " *.swf" | " *.properties" | " *.txt" )," *.scala" ).get
94
109
},
95
110
// 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),
97
112
externalDeps,
98
113
referenceScala
99
114
)
100
115
101
116
// Return the generated projects.
102
- (library, compiler)
117
+ (library, reflect, compiler)
103
118
}
104
119
105
120
}
0 commit comments