From 41c21b9ed789b527b92d0884e5b293849ceef1b5 Mon Sep 17 00:00:00 2001 From: Josh Suereth Date: Thu, 19 Jul 2012 11:12:15 -0400 Subject: [PATCH 01/12] Modified SBT launcher bat file so it can load a config file with default settings. --- src/windows/sbt.bat | 26 +++++++++++++++++++++----- src/windows/sbtconfig.txt | 8 ++++++++ 2 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 src/windows/sbtconfig.txt diff --git a/src/windows/sbt.bat b/src/windows/sbt.bat index 84881fdb4..386c3ba81 100644 --- a/src/windows/sbt.bat +++ b/src/windows/sbt.bat @@ -3,14 +3,29 @@ @REM Envioronment: @REM JAVA_HOME - location of a JDK home dir (mandatory) @REM SBT_OPTS - JVM options (optional) +@REM Configuration: +@REM sbtconfig.txt found in the SBT_HOME. - -@setlocal +@REM ZOMG! We need delayed expansion to build up CFG_OPTS later +@setlocal enabledelayedexpansion @echo off set SBT_HOME=%~dp0 set ERROR_CODE=0 +rem FIRST we load the config file of extra options. +set FN=%SBT_HOME%/sbtconfig.txt +set CFG_OPTS= +FOR /F "tokens=* eol=#" %%i IN (%FN%) DO ( + set TMP=%%i + rem ZOMG (Part #2) WE use !! here to delay the expansion of + rem CFG_OPTS, otherwise it remains "" for this loop. + set CFG_OPTS=!CFG_OPTS! !TMP! +) + +echo CFG_OPTS = %CFG_OPTS% +exit /B 1 + rem We use the value of the JAVACMD environment variable if defined set _JAVACMD=%JAVACMD% @@ -22,12 +37,13 @@ if "%_JAVACMD%"=="" ( if "%_JAVACMD%"=="" set _JAVACMD=java -rem We use the value of the JAVA_OPTS environment variable if defined +rem We use the value of the JAVA_OPTS environment variable if defined, rather than the config. set _JAVA_OPTS=%JAVA_OPTS% -if "%_JAVA_OPTS%"=="" set _JAVA_OPTS=-Xmx512M -XX:MaxPermSize=256m -XX:ReservedCodeCacheSize=128m -Dsbt.log.format=true +if "%_JAVA_OPTS%"=="" set _JAVA_OPTS=%CFG_OPTS% :run +echo "%_JAVACMD%" %_JAVA_OPTS% %SBT_OPTS% -cp "%SBT_HOME%jansi.jar;%SBT_HOME%sbt-launch.jar;%SBT_HOME%classes" SbtJansiLaunch %* "%_JAVACMD%" %_JAVA_OPTS% %SBT_OPTS% -cp "%SBT_HOME%jansi.jar;%SBT_HOME%sbt-launch.jar;%SBT_HOME%classes" SbtJansiLaunch %* if ERRORLEVEL 1 goto error goto end @@ -39,4 +55,4 @@ set ERROR_CODE=1 @endlocal -exit /B %ERROR_CODE% \ No newline at end of file +exit /B %ERROR_CODE% diff --git a/src/windows/sbtconfig.txt b/src/windows/sbtconfig.txt new file mode 100644 index 000000000..d49f3fae3 --- /dev/null +++ b/src/windows/sbtconfig.txt @@ -0,0 +1,8 @@ +# Set the java args to high +-Xmx512M +-XX:MaxPermSize=256m +-XX:ReservedCodeCacheSize=128m + +# Set the extra SBT options +-Dsbt.log.format=true + From df31ed1fcbc25f96a7c76fe8690468ac0566c985 Mon Sep 17 00:00:00 2001 From: Josh Suereth Date: Thu, 19 Jul 2012 11:13:03 -0400 Subject: [PATCH 02/12] Fixed issue with sbt versioning for RC releases in windows. --- project/packaging.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/packaging.scala b/project/packaging.scala index 0bd2d3294..fc5486d36 100644 --- a/project/packaging.scala +++ b/project/packaging.scala @@ -190,7 +190,7 @@ object Packaging { ) def makeWindowsXml(sbtVersion: String, sourceDir: File): scala.xml.Node = { - val version = (sbtVersion split "\\.") match { + val version = (sbtVersion split "[^\\d]" filterNot (_.isEmpty)) match { case Array(major,minor,bugfix, _*) => Seq(major,minor,bugfix, "1") mkString "." case Array(major,minor) => Seq(major,minor,"0","1") mkString "." case Array(major) => Seq(major,"0","0","1") mkString "." From 1f600d049ba7c6858d4a7b9b3a364587804a1f56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=8D=9A?= Date: Fri, 10 Aug 2012 12:14:56 +0800 Subject: [PATCH 03/12] Check JAVA_HOME --- src/windows/sbt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/windows/sbt b/src/windows/sbt index e2fbdb5e6..70cdcfbe3 100644 --- a/src/windows/sbt +++ b/src/windows/sbt @@ -1,7 +1,12 @@ #!/bin/sh # sbt launcher script for Cygwin and MSYS +if [ -z "$JAVA_HOME" ]; then JAVA_CMD=java +else +JAVA_CMD=$JAVA_HOME/bin/java +fi + JAVA_OPTS=-Xmx512M UDIR=`dirname "$0"` From edecd0f1bdd12ad485150e7cb27725c746678120 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=8D=9A?= Date: Fri, 10 Aug 2012 12:15:45 +0800 Subject: [PATCH 04/12] Quote arguments and $JAVA_CMD --- src/windows/sbt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/windows/sbt b/src/windows/sbt index 70cdcfbe3..d1a88bdc8 100644 --- a/src/windows/sbt +++ b/src/windows/sbt @@ -19,9 +19,9 @@ fi if [ "_$TERM" = "_xterm" ]; then # Let the terminal handle ANSI sequences stty -icanon min 1 -echo > /dev/null 2>&1 - $JAVA_CMD $JAVA_OPTS -Djline.terminal=jline.UnixTerminal -jar "$WDIR/sbt-launch.jar" $@ + "$JAVA_CMD" $JAVA_OPTS -Djline.terminal=jline.UnixTerminal -jar "$WDIR/sbt-launch.jar" "$@" stty icanon echo > /dev/null 2>&1 else # Use Jansi to intercept ANSI sequences - $JAVA_CMD $JAVA_OPTS -Dsbt.log.format=true -cp "$WDIR/jansi.jar;$WDIR/sbt-launch.jar;$WDIR/classes" SbtJansiLaunch $@ -fi + "$JAVA_CMD" $JAVA_OPTS -Dsbt.log.format=true -cp "$WDIR/jansi.jar;$WDIR/sbt-launch.jar;$WDIR/classes" SbtJansiLaunch "$@" +fi \ No newline at end of file From 7820d3deea1b4f2025ec9cc76923273af1acbcaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=8D=9A?= Date: Sun, 2 Sep 2012 14:31:59 +0800 Subject: [PATCH 05/12] Update src/scripts/sbt Enable space in arguments. Like: sbt 'run-main com.myhostname.myproject.Main' --- src/scripts/sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts/sbt b/src/scripts/sbt index 502747d88..8e50f8f03 100755 --- a/src/scripts/sbt +++ b/src/scripts/sbt @@ -81,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 $@ +run "$@" From 872d88ea237301a32f98dac0db1acd75c1b333bb Mon Sep 17 00:00:00 2001 From: Josh Suereth Date: Fri, 7 Sep 2012 12:58:02 -0400 Subject: [PATCH 06/12] Updated build so you can specify SBT version on the command line. --- project/build.scala | 6 +++++- project/project/plugins.scala | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/project/build.scala b/project/build.scala index b3e4ba4ab..82e6e13aa 100644 --- a/project/build.scala +++ b/project/build.scala @@ -3,7 +3,11 @@ import Keys._ object SbtExtras extends Build { // This build creates a SBT plugin with handy features *and* bundles the SBT script for distribution. - val root = Project("sbt-packaging", file(".")) settings(Packaging.settings:_*) + val root = Project("sbt-packaging", file(".")) settings(Packaging.settings:_*) settings( + sbtVersion <<= sbtVersion apply { v => + sys.props.getOrElse("sbt.build.version", v) + } + ) val meta = Project("metapackage", file("metapackage")) settings(MetaPackaging.settings(root):_*) } diff --git a/project/project/plugins.scala b/project/project/plugins.scala index b9561d413..5ce8cb116 100644 --- a/project/project/plugins.scala +++ b/project/project/plugins.scala @@ -7,6 +7,6 @@ object PluginBuild extends Build { val root = Project("root", file(".")) settings( resolvers += Resolver.url("scalasbt", new URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases"))(Resolver.ivyStylePatterns), addSbtPlugin("com.typesafe" % "sbt-native-packager" % "0.4.3"), - libraryDependencies += "net.databinder" %% "dispatch-http" % "0.8.6" + libraryDependencies += "net.databinder" % "dispatch-http_2.9.1" % "0.8.6" ) } From 5407a218034bdc2e60e4702ced0431bae9bbe8c9 Mon Sep 17 00:00:00 2001 From: Josh Suereth Date: Fri, 7 Sep 2012 13:52:05 -0400 Subject: [PATCH 07/12] Use environment variable thanks to lame sbt jenkins plugin --- project/build.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.scala b/project/build.scala index 82e6e13aa..61adf4122 100644 --- a/project/build.scala +++ b/project/build.scala @@ -5,7 +5,7 @@ object SbtExtras extends Build { // This build creates a SBT plugin with handy features *and* bundles the SBT script for distribution. val root = Project("sbt-packaging", file(".")) settings(Packaging.settings:_*) settings( sbtVersion <<= sbtVersion apply { v => - sys.props.getOrElse("sbt.build.version", v) + sys.props.getOrElse("sbt.build.version", sys.env.getOrElse("sbt.build.version", v)) } ) From 0ac0a4767d944b8b8f04416a45a2b4b5f8b5199c Mon Sep 17 00:00:00 2001 From: Josh Suereth Date: Fri, 7 Sep 2012 14:08:46 -0400 Subject: [PATCH 08/12] Bumped to new sbt launcher that supports publishing universal packages. --- project/project/plugins.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/project/plugins.scala b/project/project/plugins.scala index 5ce8cb116..cf7cd2c8f 100644 --- a/project/project/plugins.scala +++ b/project/project/plugins.scala @@ -6,7 +6,7 @@ object PluginBuild extends Build { val root = Project("root", file(".")) settings( resolvers += Resolver.url("scalasbt", new URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases"))(Resolver.ivyStylePatterns), - addSbtPlugin("com.typesafe" % "sbt-native-packager" % "0.4.3"), + addSbtPlugin("com.typesafe" % "sbt-native-packager" % "0.4.4"), libraryDependencies += "net.databinder" % "dispatch-http_2.9.1" % "0.8.6" ) } From 37f9d6bf2103f74e246ccf9ccc5c6187f61e4b03 Mon Sep 17 00:00:00 2001 From: Josh Suereth Date: Sat, 22 Sep 2012 10:12:03 -0400 Subject: [PATCH 09/12] Windows config now works. Still an issue with sbt.bat not setting up paths/temp files correctly.... --- .gitattributes | 1 + project/packaging.scala | 49 ++++++++++++++++++++++++++++++++++----- src/windows/sbt.bat | 9 +++---- src/windows/sbtconfig.txt | 6 +++++ 4 files changed, 53 insertions(+), 12 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..09be01613 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +src/windows/sbtconfig.txt eol=crlf diff --git a/project/packaging.scala b/project/packaging.scala index fc5486d36..1018e7ac2 100644 --- a/project/packaging.scala +++ b/project/packaging.scala @@ -143,7 +143,10 @@ object Packaging { // WINDOWS SPECIFIC name in Windows := "sbt", - lightOptions ++= Seq("-ext", "WixUIExtension", "-cultures:en-us"), + candleOptions ++= Seq("-ext", "WixUtilExtension"), + lightOptions ++= Seq("-ext", "WixUIExtension", + "-ext", "WixUtilExtension", + "-cultures:en-us"), wixConfig <<= (sbtVersion, sourceDirectory in Windows) map makeWindowsXml, //wixFile <<= sourceDirectory in Windows map (_ / "sbt.xml"), mappings in packageMsi in Windows <+= sbtLaunchJar map { f => f -> "sbt-launch.jar" }, @@ -151,6 +154,7 @@ object Packaging { mappings in packageMsi in Windows <++= sourceDirectory in Windows map { d => Seq( (d / "sbt.bat") -> "sbt.bat", (d / "sbt") -> "sbt", + (d / "sbtconfig.txt") -> "sbtconfig.txt", (d / "jansi-license.txt") -> "jansi-license.txt" )}, mappings in packageMsi in Windows <+= (compile in Compile, classDirectory in Compile) map { (c, d) => @@ -196,7 +200,8 @@ object Packaging { case Array(major) => Seq(major,"0","0","1") mkString "." } ( - + + + + + + + - + + + + @@ -222,12 +236,19 @@ object Packaging { - + + + + + + + + @@ -243,7 +264,19 @@ object Packaging { - + + + + + + + + + @@ -251,10 +284,14 @@ object Packaging { + - + + + +