From 7b69501c8b05c56cbd2da73f40d29a8d8f86ae0a Mon Sep 17 00:00:00 2001 From: Josh Suereth Date: Wed, 18 Jul 2012 10:40:29 -0400 Subject: [PATCH] Fixes for 0.12.0-RC4 release of launcher package. --- build.sbt | 10 +++++++++- project/packaging.scala | 23 +++++++++++++++-------- src/scripts/sbt | 7 +++++-- 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/build.sbt b/build.sbt index 692ad3837..2b89cd7be 100644 --- a/build.sbt +++ b/build.sbt @@ -2,9 +2,17 @@ sbtPlugin := true name := "sbt-launcher-package" -organization := "org.scalasbt" +organization := "org.scala-sbt" version := "0.1.0" crossTarget <<= target +publishTo in Global := { + val nativeReleaseUrl = "http://scalasbt.artifactoryonline.com/scalasbt/sbt-native-packages" + val nativeReleasePattern = "[organization]/[module]/[revision]/[module].[ext]" + val resolver = Resolver.url("native-releases", new URL(nativeReleaseUrl))(Patterns(nativeReleasePattern)) +// Resolver.file("native-releases-local", file("/home/jsuereth/repos/native-packages"))(Patterns(nativeReleasePattern)) + Some(resolver) +} + diff --git a/project/packaging.scala b/project/packaging.scala index 6110155eb..0bd2d3294 100644 --- a/project/packaging.scala +++ b/project/packaging.scala @@ -13,8 +13,6 @@ object Packaging { val jansiJarLocation = SettingKey[File]("jansi-jar-location") val jansiJar = TaskKey[File]("jansi-jar", "Resolves Jansi jar") - val winowsReleaseUrl = "http://typesafe.artifactoryonline.com/typesafe/windows-releases" - val fixedScriptDir = SettingKey[File]("fixed-script-dir") val fixedLinuxScriptDir = SettingKey[File]("fixed-linux-script-dir") val fixedUniversalScriptDir = SettingKey[File]("fixed-universal-script-dir") @@ -22,8 +20,11 @@ object Packaging { val universalFixedScripts = TaskKey[File]("universal-fixed-scripts") def localWindowsPattern = "[organisation]/[module]/[revision]/[module].[ext]" - - def downloadUrlForVersion(v: String) = (v split "[^\\d]" map (_.toInt)) match { + + import util.control.Exception.catching + + def downloadUrlForVersion(v: String) = (v split "[^\\d]" flatMap (i => catching(classOf[Exception]) opt (i.toInt))) match { + case Array(0, 11, 3, _*) => "http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/0.11.3-2/sbt-launch.jar" case Array(0, 11, x, _*) if x >= 3 => "http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/"+v+"/sbt-launch.jar" case Array(0, y, _*) if y >= 12 => "http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/"+v+"/sbt-launch.jar" case _ => "http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/sbt-launch/"+v+"/sbt-launch.jar" @@ -43,7 +44,7 @@ object Packaging { target } - val settings: Seq[Setting[_]] = packagerSettings ++ Seq( + val settings: Seq[Setting[_]] = packagerSettings ++ deploymentSettings ++ Seq( fixedScriptDir <<= sourceDirectory / "scripts", fixedLinuxScriptDir <<= target / "linux-scripts", fixedUniversalScriptDir <<= target / "universal-scripts", @@ -118,10 +119,10 @@ object Packaging { jar -> ("/usr/lib/sbt/sbt-launch.jar")) withPerms "0755" }, // DEBIAN SPECIFIC - name in Debian <<= (sbtVersion) apply { (sv) => "sbt-" + (sv split "[^\\d]" take 3 mkString ".") }, + name in Debian <<= (sbtVersion) apply { (sv) => "sbt" /* + "-" + (sv split "[^\\d]" take 3 mkString ".")*/ }, version in Debian <<= (version, sbtVersion) apply { (v, sv) => val nums = (v split "[^\\d]") - "%s-build-%03d" format ((nums.init mkString "."), nums.last.toInt + 1) + "%s-%s-build-%03d" format (sv, (nums.init mkString "."), nums.last.toInt + 1) }, debianPackageDependencies in Debian ++= Seq("curl", "java2-runtime", "bash (>= 2.05a-11)"), debianPackageRecommends in Debian += "git", @@ -178,8 +179,14 @@ object Packaging { mappings in Universal <+= (compile in Compile, classDirectory in Compile) map { (c, d) => compile; (d / "SbtJansiLaunch.class") -> "bin/classes/SbtJansiLaunch.class" - } + }, // TODO - Adapt global `sbt`/`sbt-launch-lib` scripts for universal install... + + // Misccelaneous publishing stuff... + projectID in Debian <<= (organization, sbtVersion) apply { (o,v) => ModuleID(o,"sbt",v) }, + projectID in Windows <<= (organization, sbtVersion) apply { (o,v) => ModuleID(o,"sbt",v) }, + projectID in Rpm <<= (organization, sbtVersion) apply { (o,v) => ModuleID(o,"sbt",v) }, + projectID in Universal <<= (organization, sbtVersion) apply { (o,v) => ModuleID(o,"sbt",v) } ) def makeWindowsXml(sbtVersion: String, sourceDir: File): scala.xml.Node = { diff --git a/src/scripts/sbt b/src/scripts/sbt index 2ae5d37c3..502747d88 100755 --- a/src/scripts/sbt +++ b/src/scripts/sbt @@ -57,7 +57,7 @@ process_my_args () { case "$1" in -no-colors) addJava "-Dsbt.log.noformat=true" && shift ;; -no-share) addJava "$noshare_opts" && shift ;; - -no-global) addJava "-Dsbt.global.base=project/.sbtboot" && shift ;; + -no-global) addJava "-Dsbt.global.base=$(pwd)/project/.sbtboot" && shift ;; -sbt-boot) require_arg path "$1" "$2" && addJava "-Dsbt.boot.directory=$2" && shift 2 ;; -sbt-dir) require_arg path "$1" "$2" && addJava "-Dsbt.global.base=$2" && shift 2 ;; -debug-inc) addJava "-Dxsbt.inc.debug=true" && shift ;; @@ -68,6 +68,9 @@ process_my_args () { *) addResidual "$1" && shift ;; esac done + + # Now, ensure sbt version is used. + [[ "${sbt_version}XXX" != "XXX" ]] && addJava "-Dsbt.version=$sbt_version" } loadConfigFile() { @@ -78,4 +81,4 @@ loadConfigFile() { [[ -f "$etc_sbt_opts_file" ]] && set -- $(loadConfigFile "$etc_sbt_opts_file") "$@" [[ -f "$sbt_opts_file" ]] && set -- $(loadConfigFile "$sbt_opts_file") "$@" -run $@ \ No newline at end of file +run $@