diff --git a/.appveyor.yml b/.appveyor.yml index 4800e33c2..c822f2293 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -27,3 +27,4 @@ test_script: - test.bat - test1.bat - test2.bat + - test3/test3.bat diff --git a/citest/test3/.jvmopts b/citest/test3/.jvmopts new file mode 100644 index 000000000..ecacefc9a --- /dev/null +++ b/citest/test3/.jvmopts @@ -0,0 +1,3 @@ +-XX:+CMSClassUnloadingEnabled +#-XX:ReservedCodeCacheSize=192m +#-Duser.timezone=GMT \ No newline at end of file diff --git a/citest/test3/build.sbt b/citest/test3/build.sbt new file mode 100644 index 000000000..3ff4eae20 --- /dev/null +++ b/citest/test3/build.sbt @@ -0,0 +1,24 @@ +lazy val check = taskKey[Unit]("") + +lazy val root = (project in file(".")) + .settings( + scalaVersion := "2.12.4", + name := "Hello", + check := { + val xs = IO.readLines(file("output.txt")).toVector + + println(xs) + + assert(xs(0) startsWith "[info] Loading project definition") + assert(xs(1) startsWith "[info] Loading settings from build.sbt") + assert(xs(2) startsWith "[info] Set current project to Hello") + assert(xs(3) startsWith "[info] This is sbt") + assert(xs(4) startsWith "[info] The current project") + assert(xs(5) startsWith "[info] The current project is built against Scala 2.12.4") + + val ys = IO.readLines(file("err.txt")).toVector.distinct + + assert(ys.size == 1, s"ys has more than one item: $ys") + assert(ys(0) startsWith "Java HotSpot(TM) 64-Bit Server VM warning") + } + ) diff --git a/citest/test3/test3.bat b/citest/test3/test3.bat new file mode 100644 index 000000000..8b3fe5a94 --- /dev/null +++ b/citest/test3/test3.bat @@ -0,0 +1,17 @@ +@echo on + +SETLOCAL + +SET JAVA_HOME=C:\jdk9 +SET PATH=C:\jdk9\bin;%PATH% +SET SBT_OPTS=-Xmx4g -Dfile.encoding=UTF8 + +SET BASE_DIR=%CD% +SET SCRIPT_DIR=%~dp0 + +CD %SCRIPT_DIR% +"%BASE_DIR%freshly-baked\sbt\bin\sbt" about 1> output.txt 2> err.txt +"%BASE_DIR%freshly-baked\sbt\bin\sbt" check +CD %BASE_DIR% + +ENDLOCAL diff --git a/src/universal/bin/sbt.bat b/src/universal/bin/sbt.bat index 4e966daac..237accc05 100644 --- a/src/universal/bin/sbt.bat +++ b/src/universal/bin/sbt.bat @@ -35,9 +35,11 @@ IF DEFINED JAVA_HOME SET "PATH=%JAVA_HOME%\bin;%PATH%" rem users can set JAVA_OPTS via .jvmopts (sbt-extras style) IF EXIST .jvmopts FOR /F %%A IN (.jvmopts) DO ( - SET JAVA_OPTS=%%A !JAVA_OPTS! + SET _jvmopts_line=%%A + IF NOT "!_jvmopts_line:~0,1!"=="#" ( + SET JAVA_OPTS=%%A !JAVA_OPTS! + ) ) - rem We use the value of the JAVACMD environment variable if defined set _JAVACMD=%JAVACMD%