From 456799bf08d27e1572a479c6b8d09a7d2d2445a0 Mon Sep 17 00:00:00 2001 From: Josh Suereth Date: Wed, 13 Jun 2012 19:55:57 -0400 Subject: Refactoring and temporary commit before finishing the fix. --- project/RemoteDependencies.scala | 46 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 project/RemoteDependencies.scala (limited to 'project/RemoteDependencies.scala') diff --git a/project/RemoteDependencies.scala b/project/RemoteDependencies.scala new file mode 100644 index 0000000000..3f0fc2abf8 --- /dev/null +++ b/project/RemoteDependencies.scala @@ -0,0 +1,46 @@ +import sbt._ +import Keys._ +import ScalaBuildKeys._ + + +object RemoteDependencies { + def buildSettings(externalProjects: Set[URI], localScala: Setting[_]): Seq[Setting[_]] = Seq( + commands += Command.command("fix-uri-projects") { (state: State) => + if(state.get(buildFixed) getOrElse false) state + else { + // TODO -fix up scalacheck's dependencies! + val extracted = Project.extract(state) + import extracted._ + def fix(s: Setting[_]): Setting[_] = s match { + case ScopedExternalSetting(p, scalaInstance.key, setting) if externalProjects(p) => localScala mapKey Project.mapScope(_ => s.key.scope) + case s => s + } + val transformed = session.mergeSettings map ( s => fix(s) ) + val scopes = transformed collect { case ScopedExternalSetting(p, _, s) if externalProjects(p) => s.key.scope } toSet + // Create some fixers so we don't download scala or rely on it. + val fixers = for { scope <- scopes + setting <- Seq(autoScalaLibrary := false, crossPaths := false) + } yield setting mapKey Project.mapScope(_ => scope) + val newStructure = Load.reapply(transformed ++ fixers, structure) + Project.setProject(session, newStructure, state).put(buildFixed, true) + } + }, + onLoad in Global <<= (onLoad in Global) apply (_ andThen { (state: State) => + "fix-uri-projects" :: state + }) + ) +} + + + +/** Matcher to make updated remote project references easier. */ +object ScopedExternalSetting { + def unapply[T](s: Setting[_]): Option[(URI, AttributeKey[_], Setting[_])] = + s.key.scope.project match { + case Select(p @ ProjectRef(uri, _)) => Some((uri, s.key.key, s)) + case _ => None + } +} + + + -- cgit v1.2.3 From 48fc0393808408cd974a80d6ca65b33003599e14 Mon Sep 17 00:00:00 2001 From: Josh Suereth Date: Thu, 14 Jun 2012 09:08:37 -0400 Subject: More fixups. --- project/Build.scala | 9 ++++----- project/RemoteDependencies.scala | 29 ++++++++++++++++++----------- project/ScalaBuildKeys.scala | 1 - 3 files changed, 22 insertions(+), 17 deletions(-) (limited to 'project/RemoteDependencies.scala') diff --git a/project/Build.scala b/project/Build.scala index 42c84c0edd..6a69e00da2 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -112,7 +112,6 @@ object ScalaBuild extends Build with Layers with Packaging with Testing { javacOptions ++= Seq("-target", "1.5", "-source", "1.5"), scalaSource in Compile <<= (baseDirectory, name) apply (_ / "src" / _), javaSource in Compile <<= (baseDirectory, name) apply (_ / "src" / _), - autoScalaLibrary := false, unmanagedJars in Compile := Seq(), // Most libs in the compiler use this order to build. compileOrder in Compile := CompileOrder.JavaThenScala, @@ -200,9 +199,9 @@ object ScalaBuild extends Build with Layers with Packaging with Testing { // TODO - in sabbus, these all use locker to build... I think tihs way is better, but let's farm this idea around. lazy val dependentProjectSettings = settingOverrides ++ Seq(quickScalaInstance, quickScalaLibraryDependency, addCheaterDependency("scala-library")) - lazy val actors = Project("actors", file(".")) settings(dependentProjectSettings:_*) dependsOn(forkjoin % "provided") - lazy val swing = Project("swing", file(".")) settings(dependentProjectSettings:_*) dependsOn(actors % "provided") - lazy val actorsMigration = Project("actors-migration", file(".")) settings(dependentProjectSettings:_*) dependsOn(actors % "provided") + lazy val actors = Project("scala-actors", file(".")) settings(dependentProjectSettings:_*) dependsOn(forkjoin % "provided") + lazy val swing = Project("scala-swing", file(".")) settings(dependentProjectSettings:_*) dependsOn(actors % "provided") + lazy val actorsMigration = Project("scala-actors-migration", file(".")) settings(dependentProjectSettings:_*) dependsOn(actors % "provided") // This project will generate man pages (in man1 and html) for scala. lazy val manmakerSettings: Seq[Setting[_]] = dependentProjectSettings :+ externalDeps lazy val manmaker = Project("manual", file(".")) settings(manmakerSettings:_*) @@ -263,7 +262,7 @@ object ScalaBuild extends Build with Layers with Packaging with Testing { // -------------------------------------------------------------- lazy val packageScalaReflect = Seq(quickReflect).map(p => products in p in Compile).join.map(_.flatten).map(productTaskToMapping) - lazy val scalaReflectArtifactSettings : Seq[Setting[_]] = inConfig(Compile)(Defaults.packageTasks(packageBin, packageScalaBinTask)) ++ Seq( + lazy val scalaReflectArtifactSettings : Seq[Setting[_]] = inConfig(Compile)(Defaults.packageTasks(packageBin, packageScalaReflect)) ++ Seq( name := "scala-reflect", crossPaths := false, exportJars := true, diff --git a/project/RemoteDependencies.scala b/project/RemoteDependencies.scala index 3f0fc2abf8..705b9dc402 100644 --- a/project/RemoteDependencies.scala +++ b/project/RemoteDependencies.scala @@ -11,18 +11,25 @@ object RemoteDependencies { // TODO -fix up scalacheck's dependencies! val extracted = Project.extract(state) import extracted._ + val scalaVersionString = extracted get version + def fix(s: Setting[_]): Setting[_] = s match { - case ScopedExternalSetting(p, scalaInstance.key, setting) if externalProjects(p) => localScala mapKey Project.mapScope(_ => s.key.scope) - case s => s - } - val transformed = session.mergeSettings map ( s => fix(s) ) - val scopes = transformed collect { case ScopedExternalSetting(p, _, s) if externalProjects(p) => s.key.scope } toSet - // Create some fixers so we don't download scala or rely on it. - val fixers = for { scope <- scopes - setting <- Seq(autoScalaLibrary := false, crossPaths := false) - } yield setting mapKey Project.mapScope(_ => scope) - val newStructure = Load.reapply(transformed ++ fixers, structure) - Project.setProject(session, newStructure, state).put(buildFixed, true) + case ScopedExternalSetting(p, scalaInstance.key, setting) if externalProjects(p) => localScala mapKey Project.mapScope(_ => s.key.scope) + // TODO - Fix Actors dependency... + //case ScopedExternalSetting(p, libraryDependencies.key, setting) if externalProjects(p) => fixProjectDeps(s) + case s => s + } + val transformed = session.mergeSettings map ( s => fix(s) ) + val scopes = transformed collect { case ScopedExternalSetting(p, _, s) if externalProjects(p) => s.key.scope } toSet + // Create some fixers so we don't download scala or rely on it. + // Also add dependencies that disappear in 2.10 for now... + val fixers = for { scope <- scopes + setting <- Seq(autoScalaLibrary := false, + crossPaths := false, + scalaVersion := scalaVersionString) + } yield setting mapKey Project.mapScope(_ => scope) + val newStructure = Load.reapply(transformed ++ fixers, structure) + Project.setProject(session, newStructure, state).put(buildFixed, true) } }, onLoad in Global <<= (onLoad in Global) apply (_ andThen { (state: State) => diff --git a/project/ScalaBuildKeys.scala b/project/ScalaBuildKeys.scala index e846a884b9..9e495de19f 100644 --- a/project/ScalaBuildKeys.scala +++ b/project/ScalaBuildKeys.scala @@ -20,5 +20,4 @@ object ScalaBuildKeys { val checkSame = TaskKey[Unit]("check-same-binaries", "checks whether or not the class files generated by scala are the same.") val checkSameLibrary = TaskKey[Unit]("check-same-lib-binaries", "checks whether or not the librayr class files generated by scala are the same.") val checkSameCompiler = TaskKey[Unit]("check-same-comp-binaries", "checks whether or not the compiler class files generated by scala are the same.") - } -- cgit v1.2.3