summaryrefslogtreecommitdiff
path: root/project
diff options
context:
space:
mode:
authorJosh Suereth <joshua.suereth@gmail.com>2012-06-12 10:42:24 -0400
committerJosh Suereth <joshua.suereth@gmail.com>2012-06-12 10:42:24 -0400
commited1b1b1d4544d4c2dba088e923c362151dd9eed2 (patch)
treefca317e4b6a587eac9c87e2a4e40eaaf47cd4c9c /project
parent87e23f5f523fc1c5b6ece12f6a812f26820e4da7 (diff)
downloadscala-ed1b1b1d4544d4c2dba088e923c362151dd9eed2.tar.gz
scala-ed1b1b1d4544d4c2dba088e923c362151dd9eed2.tar.bz2
scala-ed1b1b1d4544d4c2dba088e923c362151dd9eed2.zip
Fix for reflection. Review/Use by @adriaanm
Diffstat (limited to 'project')
-rw-r--r--project/Build.scala18
-rw-r--r--project/Layers.scala27
-rw-r--r--project/ScalaBuildKeys.scala22
3 files changed, 53 insertions, 14 deletions
diff --git a/project/Build.scala b/project/Build.scala
index 610f756a34..e2658e3405 100644
--- a/project/Build.scala
+++ b/project/Build.scala
@@ -177,20 +177,20 @@ object ScalaBuild extends Build with Layers {
}
// Locker is a lockable Scala compiler that can be built of 'current' source to perform rapid development.
- lazy val (lockerLib, lockerComp) = makeLayer("locker", STARR, autoLock = true)
- lazy val locker = Project("locker", file(".")) aggregate(lockerLib, lockerComp)
+ lazy val (lockerLib, lockerReflect, lockerComp) = makeLayer("locker", STARR, autoLock = true)
+ lazy val locker = Project("locker", file(".")) aggregate(lockerLib, lockerReflect, lockerComp)
// Quick is the general purpose project layer for the Scala compiler.
- lazy val (quickLib, quickComp) = makeLayer("quick", makeScalaReference("locker", lockerLib, lockerComp))
- lazy val quick = Project("quick", file(".")) aggregate(quickLib, quickComp)
+ lazy val (quickLib, quickReflect, quickComp) = makeLayer("quick", makeScalaReference("locker", lockerLib, lockerReflect, lockerComp))
+ lazy val quick = Project("quick", file(".")) aggregate(quickLib, quickReflect, quickComp)
// Reference to quick scala instance.
- lazy val quickScalaInstance = makeScalaReference("quick", quickLib, quickComp)
+ lazy val quickScalaInstance = makeScalaReference("quick", quickLib, quickReflect, quickComp)
def quickScalaLibraryDependency = unmanagedClasspath in Compile <++= (exportedProducts in quickLib in Compile).identity
def quickScalaCompilerDependency = unmanagedClasspath in Compile <++= (exportedProducts in quickComp in Compile).identity
// Strapp is used to test binary 'sameness' between things built with locker and things built with quick.
- lazy val (strappLib, strappComp) = makeLayer("strapp", quickScalaInstance)
+ lazy val (strappLib, strappReflect, strappComp) = makeLayer("strapp", quickScalaInstance)
// --------------------------------------------------------------
// Projects dependent on layered compilation (quick)
@@ -282,6 +282,8 @@ object ScalaBuild extends Build with Layers {
)
lazy val scalaLibrary = Project("scala-library", file(".")) settings(publishSettings:_*) settings(scalaLibArtifactSettings:_*)
+ // TODO - Real Reflect instance
+
// --------------------------------------------------------------
// Real Compiler Artifact
// --------------------------------------------------------------
@@ -297,7 +299,7 @@ object ScalaBuild extends Build with Layers {
target <<= (baseDirectory, name) apply (_ / "target" / _)
)
lazy val scalaCompiler = Project("scala-compiler", file(".")) settings(publishSettings:_*) settings(scalaBinArtifactSettings:_*) dependsOn(scalaLibrary)
- lazy val fullQuickScalaReference = makeScalaReference("pack", scalaLibrary, scalaCompiler)
+ lazy val fullQuickScalaReference = makeScalaReference("pack", scalaLibrary, quickReflect, scalaCompiler)
// --------------------------------------------------------------
// Testing
@@ -341,7 +343,7 @@ object ScalaBuild extends Build with Layers {
// TODO - Migrate this into the dist project.
// Scaladocs
- def distScalaInstance = makeScalaReference("dist", scalaLibrary, scalaCompiler)
+ def distScalaInstance = makeScalaReference("dist", scalaLibrary, quickReflect, scalaCompiler)
lazy val documentationSettings: Seq[Setting[_]] = dependentProjectSettings ++ Seq(
// TODO - Make these work for realz.
defaultExcludes in unmanagedSources in Compile := ((".*" - ".") || HiddenFileFilter ||
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)
}
}
diff --git a/project/ScalaBuildKeys.scala b/project/ScalaBuildKeys.scala
new file mode 100644
index 0000000000..dbde6bd18c
--- /dev/null
+++ b/project/ScalaBuildKeys.scala
@@ -0,0 +1,22 @@
+import sbt._
+import Keys._
+
+object ScalaBuildKeys {
+ val lockerLock: TaskKey[Unit] = TaskKey("locker-lock",
+ "Locks the locker layer of the compiler build such that it won't rebuild on changed source files.")
+ val lockerUnlock: TaskKey[Unit] = TaskKey("locker-unlock",
+ "Unlocks the locker layer of the compiler so that it will be recompiled on changed source files.")
+ val lockFile: SettingKey[File] = SettingKey("lock-file",
+ "Location of the lock file compiling this project.")
+ // New tasks/settings specific to the scala build.
+ val lock: TaskKey[Unit] = TaskKey("lock", "Locks this project so it won't be recompiled.")
+ val unlock: TaskKey[Unit] = TaskKey("unlock", "Unlocks this project so it will be recompiled.")
+ val makeDist: TaskKey[File] = TaskKey("make-dist",
+ "Creates a mini-distribution (scala home directory) for this build in a zip file.")
+ val makeExplodedDist: TaskKey[File] = TaskKey("make-exploded-dist",
+ "Creates a mini-distribution (scala home directory) for this build in a directory.")
+ val makeDistMappings: TaskKey[Map[File, String]] = TaskKey("make-dist-mappings",
+ "Creates distribution mappings for creating zips,jars,directorys,etc.")
+ val buildFixed = AttributeKey[Boolean]("build-uri-fixed")
+
+}