mirror of https://github.com/sbt/sbt.git
Merge pull request #8571 from eed3si9n/bport/8566
[1.x] Backport runner script changes
This commit is contained in:
commit
d54989915b
|
|
@ -74,4 +74,13 @@ object RunnerMemoryScriptTest extends verify.BasicTestSuite with ShellScriptUtil
|
|||
assert(out.contains[String]("-Xms111m"))
|
||||
assert(out.contains[String]("-Xss12m"))
|
||||
|
||||
// Test for issue #5742: -X options passed directly on command line
|
||||
testOutput("sbt -Xmx1G directly on command line")("-Xmx1G", "-v"): (out: List[String]) =>
|
||||
assert(out.contains[String]("-Xmx1G"))
|
||||
|
||||
testOutput("sbt -Xms512M -Xmx1G directly on command line")("-Xms512M", "-Xmx1G", "-v"):
|
||||
(out: List[String]) =>
|
||||
assert(out.contains[String]("-Xms512M"))
|
||||
assert(out.contains[String]("-Xmx1G"))
|
||||
|
||||
end RunnerMemoryScriptTest
|
||||
|
|
|
|||
|
|
@ -547,6 +547,28 @@ if not "%g:~0,5%" == "-XX:+" if not "%g:~0,5%" == "-XX:-" if "%g:~0,3%" == "-XX"
|
|||
)
|
||||
)
|
||||
|
||||
rem handle -X JVM options (e.g., -Xmx1G, -Xms512M, -Xss4M) - fixes #5742
|
||||
if "%g:~0,2%" == "-X" (
|
||||
call :dlog [args_loop] -X JVM argument %~0
|
||||
call :addJava %~0
|
||||
goto args_loop
|
||||
)
|
||||
|
||||
if defined sbt_new if "%g:~0,2%" == "--" (
|
||||
rem special handling for -- template arguments since '=' gets parsed away on Windows
|
||||
for /F "tokens=1 delims==" %%a in ("%g%") do (
|
||||
rem make sure it doesn't have the '=' already
|
||||
if "%g%" == "%%a" (
|
||||
if not "%~1" == "" (
|
||||
call :dlog [args_loop] -- argument %~0=%~1
|
||||
set "SBT_ARGS=!SBT_ARGS! %~0=%~1"
|
||||
shift
|
||||
goto args_loop
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
rem the %0 (instead of %~0) preserves original argument quoting
|
||||
set SBT_ARGS=!SBT_ARGS! %0
|
||||
|
||||
|
|
@ -782,6 +804,18 @@ if not "%p:~0,5%" == "-XX:+" if not "%p:~0,5%" == "-XX:-" if "%p:~0,3%" == "-XX"
|
|||
)
|
||||
)
|
||||
|
||||
if defined sbt_new if "%p:~0,2%" == "--" (
|
||||
rem special handling for -- template arguments since '=' gets parsed away on Windows
|
||||
for /F "tokens=1 delims==" %%a in ("%p%") do (
|
||||
rem make sure it doesn't have the '=' already
|
||||
if "%p%" == "%%a" if not "%~1" == "" (
|
||||
echo %0=%1
|
||||
shift
|
||||
goto echolist
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if "%p:~0,14%" == "-agentlib:jdwp" (
|
||||
rem special handling for --jvm-debug since '=' and ',' gets parsed away
|
||||
for /F "tokens=1 delims==" %%a in ("%p%") do (
|
||||
|
|
@ -926,6 +960,11 @@ for /f "delims=.-_ tokens=1-2" %%v in ("!JAVA_VERSION!") do (
|
|||
|
||||
rem parse the first two segments of sbt.version and set run_native_client to
|
||||
rem 1 if the user has also indicated they want to use native client.
|
||||
rem sbt new/init should not use native client as it needs to run outside a project
|
||||
if defined sbt_new (
|
||||
set run_native_client=
|
||||
exit /B 0
|
||||
)
|
||||
set sbtV=!build_props_sbt_version!
|
||||
set sbtBinaryV_1=
|
||||
set sbtBinaryV_2=
|
||||
|
|
@ -1064,6 +1103,8 @@ echo are prepended to the runner args
|
|||
echo !SBT_CONFIG!
|
||||
echo if this file exists, it is prepended to the runner args
|
||||
echo -Dkey=val pass -Dkey=val directly to the java runtime
|
||||
echo -X^<flag^> pass -X^<flag^> directly to the java runtime
|
||||
echo ^(e.g., -Xmx1G, -Xms512M, -Xss4M^)
|
||||
rem echo -J-X pass option -X directly to the java runtime
|
||||
rem echo ^(-J is stripped^)
|
||||
rem echo -S-X add -X to sbt's scalacOptions ^(-S is stripped^)
|
||||
|
|
|
|||
5
sbt
5
sbt
|
|
@ -802,6 +802,11 @@ detectNativeClient() {
|
|||
|
||||
# Run native client if build.properties points to 1.4+ and has SBT_NATIVE_CLIENT
|
||||
isRunNativeClient() {
|
||||
# sbt new/init should not use native client as it needs to run outside a project
|
||||
if [[ "$sbt_new" == "true" ]]; then
|
||||
echo "false"
|
||||
return
|
||||
fi
|
||||
sbtV="$build_props_sbt_version"
|
||||
[[ "$sbtV" == "" ]] && sbtV="$init_sbt_version"
|
||||
[[ "$sbtV" == "" ]] && sbtV="0.0.0"
|
||||
|
|
|
|||
Loading…
Reference in New Issue