From 41c21b9ed789b527b92d0884e5b293849ceef1b5 Mon Sep 17 00:00:00 2001 From: Josh Suereth Date: Thu, 19 Jul 2012 11:12:15 -0400 Subject: [PATCH 1/3] 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 37f9d6bf2103f74e246ccf9ccc5c6187f61e4b03 Mon Sep 17 00:00:00 2001 From: Josh Suereth Date: Sat, 22 Sep 2012 10:12:03 -0400 Subject: [PATCH 2/3] 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 { + - + + + +