Modified SBT launcher bat file so it can load a config file with default settings.

This commit is contained in:
Josh Suereth 2012-07-19 11:12:15 -04:00
parent 7b69501c8b
commit 41c21b9ed7
2 changed files with 29 additions and 5 deletions

View File

@ -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%
exit /B %ERROR_CODE%

View File

@ -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