From a1a784bf912c975e5f4a630c5fa21c60ebf02f1d Mon Sep 17 00:00:00 2001 From: Josh Suereth Date: Fri, 16 May 2014 16:50:34 -0400 Subject: [PATCH] Add the ability to cross publish libraries and create a command to automatically do so. --- project/Sbt.scala | 26 +++++++++++++++++++++++--- project/Util.scala | 7 +++++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/project/Sbt.scala b/project/Sbt.scala index b8f4da141..215ccffb0 100644 --- a/project/Sbt.scala +++ b/project/Sbt.scala @@ -36,6 +36,26 @@ object Sbt extends Build { commands += Command.command("safeUnitTests") { state => "all launcher/test main-settings/test main/test ivy/test logic/test completion/test actions/test classpath/test collections/test incremental-compiler/test logging/test run/test task-system/test" :: state + }, + // TODO - To some extent these should take args to figure out what to do. + commands += Command.command("release-libs-211") { state => + def lameAgregateTask(task: String): String = + s"all control/$task collectoins/$task io/$task" + // TODO - Pull scala version from setting somewhere useful + "++ 2.11.0" :: + /// First test + lameAgregateTask("test") :: + // Note: You need the sbt-pgp plugin installed to release. + lameAgregateTask("publishSigned") :: + // Now restore the defaults. + "reload" :: state + }, + commands += Command.command("release-sbt") { state => + // TODO - Any sort of validation + "publishSigned" :: + "publishLauncher" :: + "release-libs-211" :: + state } ) @@ -65,13 +85,13 @@ object Sbt extends Build { /* **** Utilities **** */ - lazy val controlSub = baseProject(utilPath / "control", "Control") - lazy val collectionSub = testedBaseProject(utilPath / "collection", "Collections") settings (Util.keywordsSettings: _*) + lazy val controlSub = baseProject(utilPath / "control", "Control") settings (Util.crossBuild:_*) + lazy val collectionSub = testedBaseProject(utilPath / "collection", "Collections") settings (Util.keywordsSettings: _*) settings (Util.crossBuild:_*) lazy val applyMacroSub = testedBaseProject(utilPath / "appmacro", "Apply Macro") dependsOn (collectionSub) settings (scalaCompiler) // The API for forking, combining, and doing I/O with system processes lazy val processSub = baseProject(utilPath / "process", "Process") dependsOn (ioSub % "test->test") settings (scalaXml) // Path, IO (formerly FileUtilities), NameFilter and other I/O utility classes - lazy val ioSub = testedBaseProject(utilPath / "io", "IO") dependsOn (controlSub) settings (ioSettings: _*) + lazy val ioSub = testedBaseProject(utilPath / "io", "IO") dependsOn (controlSub) settings (ioSettings: _*) settings (Util.crossBuild:_*) // Utilities related to reflection, managing Scala versions, and custom class loaders lazy val classpathSub = testedBaseProject(utilPath / "classpath", "Classpath") dependsOn (launchInterfaceSub, interfaceSub, ioSub) settings (scalaCompiler) // Command line-related utilities. diff --git a/project/Util.scala b/project/Util.scala index 7be84a09e..ee2d34c17 100644 --- a/project/Util.scala +++ b/project/Util.scala @@ -29,6 +29,13 @@ object Util { nightly211 <<= scalaVersion(_.startsWith("2.11.")), includeTestDependencies <<= nightly211(x => !x) ) + def crossBuild: Seq[Setting[_]] = + Seq( + crossPaths := (scalaBinaryVersion.value match { + case "2.11" => true + case _ => false + }) + ) def commonSettings(nameString: String) = Seq( crossVersion in update <<= (crossVersion, nightly211) { (cv, n) => if (n) CrossVersion.full else cv }, name := nameString,