summaryrefslogtreecommitdiff
path: root/project
diff options
context:
space:
mode:
authorJosh Suereth <joshua.suereth@gmail.com>2012-05-10 10:37:59 -0400
committerJosh Suereth <joshua.suereth@gmail.com>2012-05-10 10:37:59 -0400
commitb84cbda870b81f51af7928002073a67ac89558e1 (patch)
treeded67903cc493f8fbc5e0619e0151473797185e9 /project
parentd9ca44bd31532c91df124cdd2f6f2a417bb4a0e1 (diff)
downloadscala-b84cbda870b81f51af7928002073a67ac89558e1.tar.gz
scala-b84cbda870b81f51af7928002073a67ac89558e1.tar.bz2
scala-b84cbda870b81f51af7928002073a67ac89558e1.zip
Everything now builds. Partest is bombing about reflection issue.
Diffstat (limited to 'project')
-rw-r--r--project/Build.scala9
-rw-r--r--project/CheatingComponentCompiler.scala148
-rw-r--r--project/Layers.scala1
3 files changed, 5 insertions, 153 deletions
diff --git a/project/Build.scala b/project/Build.scala
index c753b4901f..ea0e84f0cc 100644
--- a/project/Build.scala
+++ b/project/Build.scala
@@ -148,13 +148,14 @@ object ScalaBuild extends Build with Layers {
lazy val externalDeps: Setting[_] = libraryDependencies <<= (sbtVersion)(v =>
Seq(
"org.apache.ant" % "ant" % "1.8.2",
- "org.scala-tools.sbt" % "compiler-interface" % v % "provided"
+ "org.scala-sbt" % "compiler-interface" % v % "provided"
)
)
// These are setting overrides for most artifacts in the Scala build file.
def settingOverrides: Seq[Setting[_]] = publishSettings ++ Seq(
crossPaths := false,
+ autoScalaLibrary := false,
publishArtifact in packageDoc := false,
publishArtifact in packageSrc := false,
target <<= (baseDirectory, name) apply (_ / "target" / _),
@@ -170,7 +171,7 @@ object ScalaBuild extends Build with Layers {
skip in Compile <<= lockFile.map(_ exists),
lock <<= lockFile map { f => IO.touch(f) },
unlock <<= lockFile map IO.delete
- ) ++ CheatingCompilerSettings.settings
+ )
// --------------------------------------------------------------
// Libraries used by Scalac that change infrequently
@@ -327,7 +328,7 @@ object ScalaBuild extends Build with Layers {
// Testing
// --------------------------------------------------------------
/* lazy val scalacheckSettings: Seq[Setting[_]] = Seq(fullQuickScalaReference, crossPaths := false)*/
- lazy val scalacheck = uri("git://github.com/rickynils/scalacheck.git")
+ lazy val scalacheck = uri("git://github.com/jsuereth/scalacheck.git#scala-build")
lazy val testsuiteSettings: Seq[Setting[_]] = compilerDependentProjectSettings ++ partestTaskSettings ++ VerifyClassLoad.settings ++ Seq(
unmanagedBase <<= baseDirectory / "test/files/lib",
@@ -518,7 +519,7 @@ object ScalaBuild extends Build with Layers {
// Add in some more dependencies
makeDistMappings <<= (makeDistMappings,
packageBin in swing in Compile) map {
- (dist, s, d) =>
+ (dist, s) =>
dist ++ Seq(s -> "lib/scala-swing.jar")
},
makeDist <<= (makeDistMappings, baseDirectory, streams) map { (maps, dir, s) =>
diff --git a/project/CheatingComponentCompiler.scala b/project/CheatingComponentCompiler.scala
deleted file mode 100644
index e23acfd946..0000000000
--- a/project/CheatingComponentCompiler.scala
+++ /dev/null
@@ -1,148 +0,0 @@
-import sbt._
-
-import xsbti.{Logger => _,_}
-import compiler._
-import inc._
-import Locate.DefinesClass
-import java.io.File
-
-import java.util.concurrent._
-import Keys._
-import Compiler.Compilers
-
-
-object CheatingCompilerSettings {
- val hackedmodules = TaskKey[Map[String,File]]("hacked-sbt-components")
-
- def settings: Seq[Setting[_]] = Seq(
- hackedmodules := Map.empty,
-
- // Now look for org.scala-sbt compiler-interface-src!
- hackedmodules <<= (hackedmodules, target, streams) map { (h, t, s) => Map(sbtCompilerInterface(t,s)) ++ h },
-
- compilers <<= (hackedmodules, scalaInstance, appConfiguration, streams, classpathOptions, javaHome) map {
- (hacks, si, app, s, co, jh) => CheatingCompilers.compilers(hacks, si, co, jh)(app, s.log)
- }
- )
-
-
- def sbtCompilerInterface(cacheDir: File, s: TaskStreams): (String, File) =
- "compiler-interface-src" -> pullFile("compiler-interface-src", "http://typesafe.artifactoryonline.com/typesafe/ivy-releases/org.scala-sbt/compiler-interface/0.12.0-M2/jars/compiler-interface-src.jar", cacheDir, s)
-
- import dispatch.{url=>_,_}
- def pullFile(name: String, url: String, cacheDir: File, s: TaskStreams): File = {
- val cachedFile = cacheDir / (name + ".jar")
- if (!cachedFile.exists) {
- // Ensure the directory for the cache exists.
- cachedFile.getParentFile.mkdirs()
- val fous = new java.io.FileOutputStream(cachedFile)
- try Http(dispatch.url(url) >>> fous) finally fous.close()
- val sha = pullSha(url)
- if(!isShaOk(cachedFile, sha)) sys.error("Downloaded sha does not match file: " + cachedFile.getAbsolutePath)
- IO.write(file(cachedFile.getAbsolutePath + ".sha1"), sha)
- }
- cachedFile
- }
-
- def isShaOk(f: File, sha: String): Boolean =
- ShaResolve.calculateSha(f) == sha
-
- def isCached(f: File, url: String): Boolean =
- if(f.exists) {
- val savedsha = file(f.getAbsolutePath + ".sha1")
- savedsha.exists && isShaOk(f, IO.read(savedsha))
- } else false
-
- def pullSha(url: String): String =
- Http(dispatch.url(url + ".sha1") >- identity)
-}
-
-
-object CheatingCompilers {
-
- def compilers(hacks: Map[String,File], instance: ScalaInstance, cpOptions: ClasspathOptions, javaHome: Option[File])(implicit app: AppConfiguration, log: Logger): Compilers = {
- val javac = Compiler.directOrFork(instance, cpOptions, javaHome)
- val scalac = scalaCompiler(hacks, instance, cpOptions)
- new Compilers(scalac, javac)
- }
-
- def scalaCompiler(hacks: Map[String,File], instance: ScalaInstance, cpOptions: ClasspathOptions)(implicit app: AppConfiguration, log: Logger): AnalyzingCompiler = {
- val launcher = app.provider.scalaProvider.launcher
- val componentManager = new CheatingComponentManager(hacks, launcher.globalLock, app.provider.components, Option(launcher.ivyHome), log)
- new AnalyzingCompiler(instance, componentManager, cpOptions, log)
- }
-}
-
-
-class CheatingComponentManager(val hacks: Map[String,File], globalLock: xsbti.GlobalLock, provider: xsbti.ComponentProvider, ivyHome: Option[File], log: Logger)
- extends ComponentManager(globalLock, provider, ivyHome, log) {
-
- private[this] val ivyCache = new IvyCache(ivyHome)
- /** Get all of the files for component 'id', throwing an exception if no files exist for the component. */
- override def files(id: String)(ifMissing: IfMissing): Iterable[File] = {
- def fromGlobal1 =
- lockGlobalCache {
- try { update(id); getOrElse1(createAndCache1) }
- catch { case e: NotInCache => createAndCache1 }
- }
- def getOrElse1(orElse: => Iterable[File]): Iterable[File] = {
- val existing = provider.component(hacked(id))
- if(existing.isEmpty) orElse else existing
- }
- def notFound1 = invalid("Could not find required component '" + id + "'")
- def createAndCache1 =
- ifMissing match {
- case IfMissing.Fail => notFound1
- case d: IfMissing.Define =>
- d()
- if(d.cache) cache(id)
- getOrElse1(notFound1)
- }
- val result = lockLocalCache { getOrElse1(fromGlobal1) }
- println("cheating-component-manager.files("+id+")")
- result foreach println
- result
- }
- private def isHacked(id: String) = hacks.keySet contains id
- private def hacked(id: String) = if(isHacked(id)) "hacked-"+id else id
- /** This is used to lock the local cache in project/boot/. By checking the local cache first, we can avoid grabbing a global lock. */
- private def lockLocalCache[T](action: => T): T = lock(provider.lockFile)( action )
- /** This is used to ensure atomic access to components in the global Ivy cache.*/
- private def lockGlobalCache[T](action: => T): T = lock(ivyCache.lockFile)( action )
- private def lock[T](file: File)(action: => T): T = globalLock(file, new Callable[T] { def call = action })
- private def invalid(msg: String) = throw new InvalidComponent(msg)
- private def invalid(e: NotInCache) = throw new InvalidComponent(e.getMessage, e)
-
- override def define(id: String, files: Iterable[File]) = lockLocalCache { provider.defineComponent(hacked(id), files.toSeq.toArray) }
- /** Retrieve the file for component 'id' from the local repository. */
- private def update(id: String): Unit =
- if(isHacked(id)) {
- // Grab jar magically
- println("Grabbing hacked jar for ["+id+"] = " + hacks.get(id))
- define(hacked(id), Seq(hacks(id)))
- } else ivyCache.withCachedJar(sbtModuleID(id), Some(globalLock), log) {jar =>
- define(id, Seq(jar))
- }
-
-
- //---------------------!!!!!!!!!!!!!!!!----------------------------------------
- // YUK - Ugly hack to use newer compiler interface - YUK
- //---------------------!!!!!!!!!!!!!!!!----------------------------------------
- private def sbtModuleID(id: String) = if(isHacked(id)) {
- println("Making hackd module id!")
- val version = "0.12.0-M2" // HACKED 20120314203952
- val timestamp = "20120315T001212" // Hacked "20120314203952" //
- val stampedVersion = version + "_" + timestamp
- val result = ModuleID("org.scala-sbt", id, stampedVersion)
- println("Looking for hacked module id: " + result)
- result
- } else ModuleID("org.scala-tools.sbt", id, ComponentManager.stampedVersion)
- //---------------------!!!!!!!!!!!!!!!!----------------------------------------
- // ENDYUK - Ugly hack to use newer compiler interface - ENDYUK
- //---------------------!!!!!!!!!!!!!!!!----------------------------------------
-
- /** Install the files for component 'id' to the local repository. This is usually used after writing files to the directory returned by 'location'. */
- override def cache(id: String): Unit = ivyCache.cacheJar(sbtModuleID(id), file(id)(IfMissing.Fail), Some(globalLock), log)
- override def clearCache(id: String): Unit = lockGlobalCache { ivyCache.clearCachedJar(sbtModuleID(id), Some(globalLock), log) }
-}
-
diff --git a/project/Layers.scala b/project/Layers.scala
index b15b327895..9438c752b5 100644
--- a/project/Layers.scala
+++ b/project/Layers.scala
@@ -70,7 +70,6 @@ trait Layers extends Build {
resourceDirectory in Compile <<= baseDirectory apply (_ / "src" / "compiler"),
unmanagedSourceDirectories in Compile <+= (baseDirectory) apply (_ / "src" / "msil"),
defaultExcludes := ("tests"),
- javacOptions ++= Seq("-source", "1.4"),
defaultExcludes in unmanagedResources := "*.scala",
resourceGenerators in Compile <+= (resourceManaged, Versions.scalaVersions, streams) map Versions.generateVersionPropertiesFile("compiler.properties"),
// Note, we might be able to use the default task, but for some reason ant was filtering files out. Not sure what's up, but we'll