sbt.bat 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. @REM SBT launcher script
  2. @REM
  3. @REM Envioronment:
  4. @REM JAVA_HOME - location of a JDK home dir (mandatory)
  5. @REM SBT_OPTS - JVM options (optional)
  6. @REM Configuration:
  7. @REM sbtconfig.txt found in the SBT_HOME.
  8. @REM ZOMG! We need delayed expansion to build up CFG_OPTS later
  9. @setlocal enabledelayedexpansion
  10. @echo off
  11. set SBT_HOME=%~dp0
  12. set SBT_OPTS=-Xmx3g -Xms2g -Xmn1g -Xss8M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=384M
  13. set ERROR_CODE=0
  14. rem FIRST we load the config file of extra options.
  15. set FN=%SBT_HOME%\..\conf\sbtconfig.txt
  16. set CFG_OPTS=
  17. FOR /F "tokens=* eol=# usebackq delims=" %%i IN ("%FN%") DO (
  18. set DO_NOT_REUSE_ME=%%i
  19. rem ZOMG (Part #2) WE use !! here to delay the expansion of
  20. rem CFG_OPTS, otherwise it remains "" for this loop.
  21. set CFG_OPTS=!CFG_OPTS! !DO_NOT_REUSE_ME!
  22. )
  23. rem We use the value of the JAVACMD environment variable if defined
  24. set _JAVACMD=%JAVACMD%
  25. if "%_JAVACMD%"=="" (
  26. if not "%JAVA_HOME%"=="" (
  27. if exist "%JAVA_HOME%\bin\java.exe" set "_JAVACMD=%JAVA_HOME%\bin\java.exe"
  28. )
  29. )
  30. if "%_JAVACMD%"=="" set _JAVACMD=java
  31. rem We use the value of the JAVA_OPTS environment variable if defined, rather than the config.
  32. set _JAVA_OPTS=%JAVA_OPTS%
  33. if "%_JAVA_OPTS%"=="" set _JAVA_OPTS=%CFG_OPTS%
  34. :run
  35. "%_JAVACMD%" %_JAVA_OPTS% %SBT_OPTS% -cp "%SBT_HOME%sbt-launch.jar" xsbt.boot.Boot %*
  36. if ERRORLEVEL 1 goto error
  37. goto end
  38. :error
  39. set ERROR_CODE=1
  40. :end
  41. @endlocal
  42. exit /B %ERROR_CODE%