From a2e30494fe79aeeab6be91c8ff3cfdaf1a8a9012 Mon Sep 17 00:00:00 2001 From: Mark Harrah Date: Mon, 26 Sep 2011 08:20:07 -0400 Subject: [PATCH] use 0.11.0 for building --- project/Sbt.scala | 16 +++++++--------- project/Util.scala | 17 ++++++++++++----- project/build.properties | 2 +- project/plugins/p.sbt | 2 +- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/project/Sbt.scala b/project/Sbt.scala index 99520bc04..9101bf709 100644 --- a/project/Sbt.scala +++ b/project/Sbt.scala @@ -148,12 +148,9 @@ object Sbt extends Build lazy val scriptedSource = SettingKey[File]("scripted-source") lazy val publishAll = TaskKey[Unit]("publish-all") - def deepTasks[T](scoped: ScopedTask[Seq[T]]): Initialize[Task[Seq[T]]] = deep(scoped.task).map { _.flatMap(_.join.map(_.flatten)) } - def deep[T](scoped: ScopedSetting[T]): Initialize[Task[Seq[T]]] = - state map { s => - val sxrProjects = projects filterNot Set(root, sbtSub, scriptedBaseSub, scriptedSbtSub, scriptedPluginSub) map { p => LocalProject(p.id) } - Defaults.inAllProjects(sxrProjects, scoped, Project.extract(s).structure.data) - } + def deepTasks[T](scoped: ScopedTask[Seq[T]]): Initialize[Task[Seq[T]]] = deep(scoped.task) { _.join.map(_.flatten) } + def deep[T](scoped: ScopedSetting[T]): Initialize[Seq[T]] = + Util.inAllProjects(projects filterNot Set(root, sbtSub, scriptedBaseSub, scriptedSbtSub, scriptedPluginSub) map { p => LocalProject(p.id) }, scoped) def launchSettings = inConfig(Compile)(Transform.configSettings) ++ Seq(jline, ivy, crossPaths := false, compile in Test <<= compile in Test dependsOn(publishLocal in interfaceSub, publishLocal in testSamples, publishLocal in launchInterfaceSub) @@ -167,7 +164,7 @@ object Sbt extends Build scripted <<= scriptedTask, scriptedSource <<= (sourceDirectory in sbtSub) / "sbt-test", sources in sxr <<= deepTasks(sources in Compile), - Sxr.sourceDirectories <<= deep(sourceDirectories in Compile).map(_.map(_.flatten)), + Sxr.sourceDirectories <<= deep(sourceDirectories in Compile).map(_.flatten), fullClasspath in sxr <<= (externalDependencyClasspath in Compile in sbtSub).identity, compileInputs in (Compile,sxr) <<= (sources in sxr, compileInputs in sbtSub in Compile, fullClasspath in sxr) map { (srcs, in, cp) => in.copy(config = in.config.copy(sources = srcs, classpath = cp.files)) @@ -189,8 +186,9 @@ object Sbt extends Build ) def precompiledSettings = Seq( - artifact in packageBin <<= scalaInstance in Compile apply { si => - val bincID = binID + "_" + si.actualVersion + artifact in packageBin <<= (appConfiguration, scalaVersion) { (app, sv) => + val launcher = app.provider.scalaProvider.launcher + val bincID = binID + "_" + ScalaInstance(sv, launcher).actualVersion Artifact(binID) extra("e:component" -> bincID) }, target <<= (target, scalaVersion) { (base, sv) => base / ("precompiled_" + sv) }, diff --git a/project/Util.scala b/project/Util.scala index a6d268ff3..9c0bffd8f 100644 --- a/project/Util.scala +++ b/project/Util.scala @@ -6,14 +6,21 @@ object Util { lazy val componentID = SettingKey[Option[String]]("component-id") - def inAll(projects: => Seq[ProjectReference], key: ScopedSetting[Task[Unit]]) = - state flatMap { s => nop dependsOn( Defaults.inAllProjects(projects, key, Project.extract(s).structure.data) : _*) } - + def inAll(projects: => Seq[ProjectReference], key: ScopedSetting[Task[Unit]]): Project.Initialize[Task[Unit]] = + inAllProjects(projects, key) { deps => nop dependsOn( deps : _*) } + + def inAllProjects[T](projects: => Seq[ProjectReference], key: ScopedSetting[T]): Project.Initialize[Seq[T]] = + Project.bind( (loadedBuild, thisProjectRef).identity ) { case (lb, pr) => + def resolve(ref: ProjectReference): ProjectRef = Scope.resolveProjectRef(pr.build, Load.getRootProject(lb.units), ref) + val refs = projects flatMap { base => Defaults.transitiveDependencies(resolve(base.project), lb, includeRoot=true, classpath=true, aggregate=true) } + refs map ( ref => (key in ref).? ) joinWith(_ flatMap { x => x}) + } + + def noPublish(p: Project) = p.copy(settings = noRemotePublish(p.settings)) def noRemotePublish(in: Seq[Setting[_]]) = in filterNot { s => s.key == deliver || s.key == publish } - lazy val noExtra = projectDependencies ~= { _.map(_.copy(extraAttributes = Map.empty)) } // remove after 0.10.2 - def project(path: File, nameString: String) = Project(normalize(nameString), path) settings( name := nameString, noExtra ) + def project(path: File, nameString: String) = Project(normalize(nameString), path) settings( name := nameString ) def baseProject(path: File, nameString: String) = project(path, nameString) settings( base : _*) def testedBaseProject(path: File, nameString: String) = baseProject(path, nameString) settings( testDependencies : _*) diff --git a/project/build.properties b/project/build.properties index 26b173162..f2ccdfa37 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=0.10.1 \ No newline at end of file +sbt.version=0.11.0 diff --git a/project/plugins/p.sbt b/project/plugins/p.sbt index 8a6de8d91..d79f3b69b 100644 --- a/project/plugins/p.sbt +++ b/project/plugins/p.sbt @@ -1 +1 @@ -libraryDependencies += "net.databinder" %% "dispatch-http" % "0.8.3" \ No newline at end of file +libraryDependencies += "net.databinder" %% "dispatch-http" % "0.8.5" \ No newline at end of file