diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 000000000..a467cd4a4 --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,29 @@ +build: off + +init: + - git config --global core.autocrlf input + +install: + - cinst jdk8 -params 'installdir=C:\\jdk8' + - cinst jdk9 -version 9.0.1.11 -params 'installdir=C:\\jdk9' + - SET JAVA_HOME=C:\jdk8 + - SET PATH=C:\jdk8\bin;%PATH% + + - ps: | + Add-Type -AssemblyName System.IO.Compression.FileSystem + if (!(Test-Path -Path "C:\sbt" )) { + (new-object System.Net.WebClient).DownloadFile( + 'https://cocl.us/sbt-0.13.16.zip', + 'C:\sbt-bin.zip' + ) + [System.IO.Compression.ZipFile]::ExtractToDirectory("C:\sbt-bin.zip", "C:\sbt") + } + - SET PATH=C:\sbt\sbt\bin;%PATH% + - SET SBT_OPTS=-XX:MaxPermSize=2g -Xmx4g -Dfile.encoding=UTF8 + +test_script: + - sbt "-Dsbt.build.version=1.0.4" universal:packageBin + - cd citest + - test.bat + - test1.bat + - test2.bat diff --git a/citest/build.sbt b/citest/build.sbt new file mode 100644 index 000000000..81b1532b6 --- /dev/null +++ b/citest/build.sbt @@ -0,0 +1,27 @@ +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 + + println(ys) + + assert(ys.size == 2) + assert(ys(0) startsWith "Java HotSpot(TM) 64-Bit Server VM warning") + assert(ys(1) startsWith "Java HotSpot(TM) 64-Bit Server VM warning") + } + ) diff --git a/citest/project/build.properties b/citest/project/build.properties new file mode 100644 index 000000000..394cb75cf --- /dev/null +++ b/citest/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.0.4 diff --git a/citest/test.bat b/citest/test.bat new file mode 100644 index 000000000..609959707 --- /dev/null +++ b/citest/test.bat @@ -0,0 +1,16 @@ +@echo on + +cd "%~dp0" + +mkdir freshly-baked +unzip ..\target\universal\sbt.zip -d freshly-baked + +SETLOCAL + +SET JAVA_HOME=C:\jdk9 +SET PATH=C:\jdk9\bin;%PATH% +SET SBT_OPTS=-Xmx4g -Dfile.encoding=UTF8 + +"freshly-baked\sbt\bin\sbt" about + +ENDLOCAL diff --git a/citest/test1.bat b/citest/test1.bat new file mode 100644 index 000000000..b02954cd9 --- /dev/null +++ b/citest/test1.bat @@ -0,0 +1,11 @@ +@echo on + +SETLOCAL + +SET JAVA_HOME=C:\jdk9 +SET PATH=C:\jdk9\bin;%PATH% +SET SBT_OPTS=-Xmx4g -Dfile.encoding=UTF8 + +"freshly-baked\sbt\bin\sbt" about 1> output.txt 2> err.txt + +ENDLOCAL diff --git a/citest/test2.bat b/citest/test2.bat new file mode 100644 index 000000000..b02598217 --- /dev/null +++ b/citest/test2.bat @@ -0,0 +1,11 @@ +@echo on + +SETLOCAL + +SET JAVA_HOME=C:\jdk9 +SET PATH=C:\jdk9\bin;%PATH% +SET SBT_OPTS=-Xmx4g -Dfile.encoding=UTF8 + +"freshly-baked\sbt\bin\sbt" check + +ENDLOCAL diff --git a/src/universal/bin/sbt.bat b/src/universal/bin/sbt.bat index 8a43b1fb9..2fec638ac 100644 --- a/src/universal/bin/sbt.bat +++ b/src/universal/bin/sbt.bat @@ -131,16 +131,15 @@ exit /B 1 if /I "%JAVA_VERSION%" GEQ "9" ( 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 java9_rt=%java9_ext%\rt.jar + set java9_rt=!java9_ext!\rt.jar - if not exist "%java9_rt%" ( - echo Copying runtime jar. - mkdir "%java9_ext%" - "%_JAVACMD%" %_JAVA_OPTS% %SBT_OPTS% -jar "%rtexport%" "%java9_rt%" + if not exist "!java9_rt!" ( + mkdir "!java9_ext!" + "%_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 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" ( where robocopy >nul 2>nul if %ERRORLEVEL% equ 0 ( - echo %PRELOAD_SBT_JAR% + REM echo %PRELOAD_SBT_JAR% if not exist %PRELOAD_SBT_JAR% ( if exist "%SBT_HOME%\..\lib\local-preloaded\" ( echo 'about to robocopy'