mirror of https://github.com/sbt/sbt.git
use delayed expansion
Fixes sbt/sbt#3804 Inside the if, it seems like bunch of variables were set to blank. Using delayed expansion seems to fix this. This is confirmed by the newly added test.
This commit is contained in:
parent
49d85750af
commit
f9b9d082f6
|
|
@ -9,23 +9,19 @@ lazy val root = (project in file("."))
|
||||||
|
|
||||||
println(xs)
|
println(xs)
|
||||||
|
|
||||||
assert(xs(0) startsWith "Copying runtime jar.")
|
assert(xs(0) startsWith "[info] Loading project definition")
|
||||||
// echo of jar name
|
assert(xs(1) startsWith "[info] Loading settings from build.sbt")
|
||||||
assert(xs(2) startsWith "[info] Loading project definition")
|
assert(xs(2) startsWith "[info] Set current project to Hello")
|
||||||
assert(xs(3) startsWith "[info] Loading settings from build.sbt")
|
assert(xs(3) startsWith "[info] This is sbt")
|
||||||
assert(xs(4) startsWith "[info] Set current project to Hello")
|
assert(xs(4) startsWith "[info] The current project")
|
||||||
assert(xs(5) startsWith "[info] This is sbt")
|
assert(xs(5) startsWith "[info] The current project is built against Scala 2.12.4")
|
||||||
assert(xs(6) startsWith "[info] The current project")
|
|
||||||
assert(xs(7) startsWith "[info] The current project is built against Scala 2.12.4")
|
|
||||||
|
|
||||||
val ys = IO.readLines(file("err.txt")).toVector
|
val ys = IO.readLines(file("err.txt")).toVector
|
||||||
|
|
||||||
println(ys)
|
println(ys)
|
||||||
|
|
||||||
assert(ys.size == 4)
|
assert(ys.size == 2)
|
||||||
assert(ys(0) startsWith "Error: Unable to access jarfile")
|
assert(ys(0) startsWith "Java HotSpot(TM) 64-Bit Server VM warning")
|
||||||
assert(ys(1) startsWith "The filename, directory name, or volume label syntax is incorrect.")
|
assert(ys(1) startsWith "Java HotSpot(TM) 64-Bit Server VM warning")
|
||||||
assert(ys(2) startsWith "Error: Unable to access jarfile")
|
|
||||||
assert(ys(3) startsWith "Java HotSpot(TM) 64-Bit Server VM warning")
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -131,16 +131,15 @@ exit /B 1
|
||||||
if /I "%JAVA_VERSION%" GEQ "9" (
|
if /I "%JAVA_VERSION%" GEQ "9" (
|
||||||
set rtexport="%SBT_HOME%java9-rt-export.jar"
|
set rtexport="%SBT_HOME%java9-rt-export.jar"
|
||||||
|
|
||||||
"%_JAVACMD%" %_JAVA_OPTS% %SBT_OPTS% -jar "%rtexport%" --rt-ext-dir > "%TEMP%.\rtext.txt"
|
"%_JAVACMD%" %_JAVA_OPTS% %SBT_OPTS% -jar "!rtexport!" --rt-ext-dir > "%TEMP%.\rtext.txt"
|
||||||
set /p java9_ext= < "%TEMP%.\rtext.txt"
|
set /p java9_ext= < "%TEMP%.\rtext.txt"
|
||||||
set java9_rt=%java9_ext%\rt.jar
|
set java9_rt=!java9_ext!\rt.jar
|
||||||
|
|
||||||
if not exist "%java9_rt%" (
|
if not exist "!java9_rt!" (
|
||||||
echo Copying runtime jar.
|
mkdir "!java9_ext!"
|
||||||
mkdir "%java9_ext%"
|
"%_JAVACMD%" %_JAVA_OPTS% %SBT_OPTS% -jar "!rtexport!" "!java9_rt!"
|
||||||
"%_JAVACMD%" %_JAVA_OPTS% %SBT_OPTS% -jar "%rtexport%" "%java9_rt%"
|
|
||||||
)
|
)
|
||||||
set _JAVA_OPTS=!_JAVA_OPTS! -Dscala.ext.dirs="%java9_ext%"
|
set _JAVA_OPTS=!_JAVA_OPTS! -Dscala.ext.dirs="!java9_ext!"
|
||||||
|
|
||||||
rem check to see if a GC has been set in the opts
|
rem check to see if a GC has been set in the opts
|
||||||
echo !_JAVA_OPTS! | findstr /r "Use.*GC" >nul
|
echo !_JAVA_OPTS! | findstr /r "Use.*GC" >nul
|
||||||
|
|
@ -162,7 +161,7 @@ set PRELOAD_SBT_JAR="%UserProfile%\.sbt\preloaded\org.scala-sbt\sbt\%INIT_SBT_VE
|
||||||
if /I "%JAVA_VERSION%" GEQ "1.8" (
|
if /I "%JAVA_VERSION%" GEQ "1.8" (
|
||||||
where robocopy >nul 2>nul
|
where robocopy >nul 2>nul
|
||||||
if %ERRORLEVEL% equ 0 (
|
if %ERRORLEVEL% equ 0 (
|
||||||
echo %PRELOAD_SBT_JAR%
|
REM echo %PRELOAD_SBT_JAR%
|
||||||
if not exist %PRELOAD_SBT_JAR% (
|
if not exist %PRELOAD_SBT_JAR% (
|
||||||
if exist "%SBT_HOME%\..\lib\local-preloaded\" (
|
if exist "%SBT_HOME%\..\lib\local-preloaded\" (
|
||||||
echo 'about to robocopy'
|
echo 'about to robocopy'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue