diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9ecdb9634a72..4f5216a1f9dc 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -158,6 +158,10 @@ jobs: run: '"C:\Program Files\Git\bin\bash" ./project/scripts/winCmdTests' shell: cmd + - name: win tests + run: './project/scripts/winCmdTests.bat' + shell: cmd + - name: Scala.js Test run: sbt ";sjsJUnitTests/test ;sjsCompilerTests/test" shell: cmd diff --git a/dist/bin/common.bat b/dist/bin/common.bat new file mode 100644 index 000000000000..9b5a5ed33875 --- /dev/null +++ b/dist/bin/common.bat @@ -0,0 +1,54 @@ +@rem ######################################################################### +@rem ## Code common to scalac.bat, scaladoc.bat and scala.bat + +if defined JAVACMD ( + set "_JAVACMD=%JAVACMD%" +) else if defined JAVA_HOME ( + set "_JAVACMD=%JAVA_HOME%\bin\java.exe" +) else if defined JDK_HOME ( + set "_JAVACMD=%JDK_HOME%\bin\java.exe" +) else ( + where /q java.exe + if !ERRORLEVEL!==0 ( + set __JAVA_BIN_DIR= + for /f "delims=" %%i in ('where /f java.exe') do ( + set "__PATH=%%~dpi" + @rem we take first occurence and ignore Oracle path for java executable + if not defined __JAVA_BIN_DIR if "!__PATH!"=="!__PATH:javapath=!" set "__JAVA_BIN_DIR=!__PATH!" + ) + if defined __JAVA_BIN_DIR set "_JAVACMD=!__JAVA_BIN_DIR!\java.exe" + ) + if not defined _JAVACMD ( + set "__PATH=%ProgramFiles%\Java" + for /f %%f in ('dir /ad /b "!__PATH!\jre*" 2^>NUL') do set "_JAVA_HOME=!__PATH!\%%f" + if not defined _JAVA_HOME ( + set __PATH=C:\opt + for /f %%f in ('dir /ad /b "!__PATH!\jdk*" 2^>NUL') do set "_JAVA_HOME=!__PATH!\%%f\jre" + ) + if defined _JAVA_HOME set "_JAVACMD=!_JAVA_HOME!\bin\java.exe" + ) +) +if not exist "%_JAVACMD%" ( + echo Error: Java executable not found ^(!_JAVACMD!^) 1>&2 + set _EXITCODE=1 + goto :eof +) + +if not defined _PROG_HOME set "_PROG_HOME=%~dp0" +for /f %%f in ("%_PROG_HOME%\.") do set "_LIB_DIR=%%~dpflib" + +set _PSEP=; + +for /f %%f in ('dir /a-d /b "%_LIB_DIR%\*scala3-compiler*"') do set "_SCALA3_COMP=%_LIB_DIR%\%%f" +for /f %%f in ('dir /a-d /b "%_LIB_DIR%\*scala3-interfaces*"') do set "_SCALA3_INTF=%_LIB_DIR%\%%f" +for /f %%f in ('dir /a-d /b "%_LIB_DIR%\*scala3-library*"') do set "_SCALA3_LIB=%_LIB_DIR%\%%f" +for /f %%f in ('dir /a-d /b "%_LIB_DIR%\*scala3-staging*"') do set "_SCALA3_STAGING=%_LIB_DIR%\%%f" +for /f %%f in ('dir /a-d /b "%_LIB_DIR%\*scala3-tasty-inspector*"') do set "_SCALA3_TASTY_INSPECTOR=%_LIB_DIR%\%%f" +for /f %%f in ('dir /a-d /b "%_LIB_DIR%\*tasty-core*"') do set "_TASTY_CORE=%_LIB_DIR%\%%f" +for /f %%f in ('dir /a-d /b "%_LIB_DIR%\*scala-asm*"') do set "_SCALA_ASM=%_LIB_DIR%\%%f" +for /f %%f in ('dir /a-d /b "%_LIB_DIR%\*scala-library*"') do set "_SCALA_LIB=%_LIB_DIR%\%%f" +for /f %%f in ('dir /a-d /b "%_LIB_DIR%\*compiler-interface*"') do set "_SBT_INTF=%_LIB_DIR%\%%f" +for /f %%f in ('dir /a-d /b "%_LIB_DIR%\*jline-reader-3*"') do set "_JLINE_READER=%_LIB_DIR%\%%f" +for /f %%f in ('dir /a-d /b "%_LIB_DIR%\*jline-terminal-3*"') do set "_JLINE_TERMINAL=%_LIB_DIR%\%%f" +for /f %%f in ('dir /a-d /b "%_LIB_DIR%\*jline-terminal-jna-3*"') do set "_JLINE_TERMINAL_JNA=%_LIB_DIR%\%%f" +for /f %%f in ('dir /a-d /b "%_LIB_DIR%\*jna-5*"') do set "_JNA=%_LIB_DIR%\%%f" diff --git a/dist/bin/scala.bat b/dist/bin/scala.bat new file mode 100644 index 000000000000..edf7bfc5a1c2 --- /dev/null +++ b/dist/bin/scala.bat @@ -0,0 +1,121 @@ +@echo off +setlocal enabledelayedexpansion + +@rem ######################################################################### +@rem ## Environment setup + +set _EXITCODE=0 + +set "_PROG_HOME=%~dp0" + +call "%_PROG_HOME%\common.bat" +if not %_EXITCODE%==0 goto end + +call :args %* + +@rem ######################################################################### +@rem ## Main + +set _CASE_REPL=0 +if %_EXECUTE_REPL%==1 set _CASE_REPL=1 +if %_EXECUTE_RUN%==0 if %_OPTIONS_INDICATOR%==0 set _CASE_REPL=1 + +set _CASE_EXEC=0 +if %_EXECUTE_REPL%==1 set _CASE_EXEC=1 +if defined _RESIDUAL_ARGS set _CASE_EXEC=1 + +if %_EXECUTE_SCRIPT%==1 ( + set _SCALAC_ARGS= + if defined _CLASS_PATH set _SCALAC_ARGS=-classpath "%_CLASS_PATH%" + set _RESIDUAL_ARGS=!_RESIDUAL_ARGS! "-Dscript.path=%_TARGET_SCRIPT%" + set _SCALAC_ARGS=!_SCALAC_ARGS! %_JAVA_OPTS% !_RESIDUAL_ARGS! -script "%_TARGET_SCRIPT%" %_SCRIPT_ARGS% + call "%_PROG_HOME%\scalac.bat" !_SCALAC_ARGS! + if not !ERRORLEVEL!==0 ( set _EXITCODE=1& goto end ) +@rem if [ $execute_repl == true ] || ([ $execute_run == false ] && [ $options_indicator == 0 ]); then +) else if %_CASE_REPL%==1 ( + set _SCALAC_ARGS= + if defined _CLASS_PATH set _SCALAC_ARGS=-classpath "%_CLASS_PATH%" + set _SCALAC_ARGS=!_SCALAC_ARGS! %_JAVA_OPTS% -repl %_RESIDUAL_ARGS% + call "%_PROG_HOME%\scalac.bat" !_SCALAC_ARGS! + if not !ERRORLEVEL!==0 ( set _EXITCODE=1& goto end ) +@rem elif [ $execute_repl == true ] || [ ${#residual_args[@]} -ne 0 ]; then +) else if %_CASE_EXEC%==1 ( + set "_CP_ARG=%_SCALA3_LIB%%_PSEP%%_SCALA_LIB%" + if defined _CLASS_PATH ( set "_CP_ARG=!_CP_ARG!%_PSEP%%_CLASS_PATH%" + ) else ( set "_CP_ARG=!_CP_ARG!%_PSEP%." + ) + if %_CLASS_PATH_COUNT% gtr 1 ( + echo Warning: Multiple classpaths are found, scala only use the last one. 1>&2 + ) + if %_WITH_COMPILER%==1 ( + set "_CP_ARG=!_CP_ARG!%_PSEP%%_SCALA3_COMP%%_PSEP%%_TASTY_CORE%%_PSEP%%_SCALA3_INTF%%_PSEP%%_SCALA_ASM%%_PSEP%%_SCALA3_STAGING%%_PSEP%%_SCALA3_TASTY_INSPECTOR%" + ) + set _JAVA_ARGS=-classpath "!_CP_ARG!" %_JVM_OPTS% %_RESIDUAL_ARGS% + call "%_JAVACMD%" !_JAVA_ARGS! + if not !ERRORLEVEL!==0 ( set _EXITCODE=1& goto end ) +) else ( + echo Warning: Command option is not correct. 1>&2 +) + +goto end + +@rem ######################################################################### +@rem ## Subroutines + +:args +set _RESIDUAL_ARGS= +set _SCRIPT_ARGS= +set _EXECUTE_REPL=0 +set _EXECUTE_RUN=0 +set _EXECUTE_SCRIPT=0 +set _TARGET_SCRIPT= +set _WITH_COMPILER=0 +set _CLASS_PATH_COUNT=0 +set _CLASS_PATH= +set _JVM_OPTS= +set _JAVA_OPTS= +set _OPTIONS_INDICATOR=0 + +:args_loop +if "%~1"=="" goto args_done +set "__ARG=%~1" +if "%__ARG%"=="-repl" ( + set _EXECUTE_REPL=1 +) else if "%__ARG%"=="-run" ( + set _EXECUTE_RUN=1 +) else if "%__ARG%"=="-classpath" ( + set "_CLASS_PATH=%~2" + set /a _CLASS_PATH_COUNT+=1 + shift +) else if "%__ARG%"=="-cp" ( + set "_CLASS_PATH=%~2" + set /a _CLASS_PATH_COUNT+=1 + shift +) else if "%__ARG%"=="-with-compiler" ( + set _WITH_COMPILER=1 +) else if "%__ARG:~0,2%"=="-J" ( + set _JVM_OPTS=!_JVM_OPTS! %__ARG:~2% + set _JAVA_OPTS=!_JAVA_OPTS! %__ARG% +) else ( + @rem _OPTIONS_INDICATOR != 0 if at least one parameter is not an option + if not "%__ARG:~0,1%"=="-" set /a _OPTIONS_INDICATOR+=1 + if %_EXECUTE_SCRIPT%==1 ( + set _SCRIPT_ARGS=%_SCRIPT_ARGS% %__ARG% + ) else if "%__ARG:~-6%"==".scala" ( + set _EXECUTE_SCRIPT=1 + set "_TARGET_SCRIPT=%__ARG%" + ) else ( + set _RESIDUAL_ARGS=%_RESIDUAL_ARGS% %__ARG% + ) +) +shift +goto args_loop +:args_done +goto :eof + +@rem ######################################################################### +@rem ## Cleanups + +:end +exit /b %_EXITCODE% +endlocal diff --git a/dist/bin/scalac.bat b/dist/bin/scalac.bat new file mode 100644 index 000000000000..88c615ea0732 --- /dev/null +++ b/dist/bin/scalac.bat @@ -0,0 +1,173 @@ +@echo off +setlocal enabledelayedexpansion + +@rem ######################################################################### +@rem ## Environment setup + +set _EXITCODE=0 + +set "_PROG_HOME=%~dp0" + +call "%_PROG_HOME%\common.bat" +if not %_EXITCODE%==0 goto end + +set _DEFAULT_JAVA_OPTS=-Xmx768m -Xms768m +@rem set _WITH_COMPILER=true + +set _COMPILER_MAIN=dotty.tools.dotc.Main +set _DECOMPILER_MAIN=dotty.tools.dotc.decompiler.Main +set _REPL_MAIN=dotty.tools.repl.Main +set _SCRIPTING_MAIN=dotty.tools.scripting.Main + +call :args %* + +@rem ######################################################################### +@rem ## Main + +call :classpathArgs + +set _SCRIPTING_STRING= +if "%_PROG_NAME%"=="%_SCRIPTING_MAIN%" ( + if not defined _TARGET_SCRIPT ( + echo Error: Missing Scala script file 1>&2 + set _EXITCODE=1 + goto end + ) + set _SCRIPTING_STRING=-script %_TARGET_SCRIPT% %_SCRIPTING_ARGS% +) + +if defined JAVA_OPTS ( set _JAVA_OPTS=%JAVA_OPTS% +) else ( set _JAVA_OPTS=%_DEFAULT_JAVA_OPTS% +) +call "%_JAVACMD%" %_JAVA_OPTS% %_JAVA_DEBUG% %_JAVA_ARGS% %_JVM_CP_ARGS% ^ +-Dscala.usejavacp=true ^ +%_PROG_NAME% %_SCALA_ARGS% %_RESIDUAL_ARGS% %_SCRIPTING_STRING% +if not %ERRORLEVEL%==0 ( + set _EXITCODE=1 + goto end +) +goto end + +@rem ######################################################################### +@rem ## Subroutines + +:args +set _JAVA_DEBUG= +set _HELP= +set _VERBOSE= +set _QUIET= +set _COLORS= +set _PROG_NAME=%_COMPILER_MAIN% +set _SCALA_ARGS= +set _JAVA_ARGS= +set _RESIDUAL_ARGS= +set _SCRIPTING_ARGS= +set _TARGET_SCRIPT= + +:args_loop +if "%~1"=="" goto args_done +set "__ARG=%~1" +if defined _TARGET_SCRIPT ( + call :addScripting "%__ARG%" +) else if "%__ARG%"=="--" ( + @rem for arg; do addResidual "$arg"; done; set -- ;; +) else if "%__ARG%"=="-h" ( + set _HELP=true + call :addScala "-help" +) else if "%__ARG%"=="-help" ( + set _HELP=true + call :addScala "-help" +) else if "%__ARG%"=="-v" ( + set _VERBOSE=true + call :addScala "-verbose" +) else if "%__ARG%"=="-verbose" ( + set _VERBOSE=true + call :addScala "-verbose" +) else if "%__ARG%"=="-debug" ( set "_JAVA_DEBUG=%_DEBUG_STR%" +) else if "%__ARG%"=="-q" ( set _QUIET=true +) else if "%__ARG%"=="-quiet" ( set _QUIET=true +@rem Optimize for short-running applications, see https://github.com/lampepfl/dotty/issues/222 +) else if "%__ARG%"=="-Oshort" ( + call :addJava "-XX:+TieredCompilation -XX:TieredStopAtLevel=1" +) else if "%__ARG%"=="-repl" ( set _PROG_NAME=%_REPL_MAIN% +) else if "%__ARG%"=="-script" ( + set _PROG_NAME=%_SCRIPTING_MAIN% + if "%~2"=="" goto args_done + set "_TARGET_SCRIPT=%~2" + shift +) else if "%__ARG%"=="-compile" ( set _PROG_NAME=%_COMPILER_MAIN% +) else if "%__ARG%"=="-decompile" ( set _PROG_NAME=%_DECOMPILER_MAIN% +) else if "%__ARG%"=="-print-tasty" ( + set _PROG_NAME=%_DECOMPILER_MAIN% + call :addScala "-print-tasty" +) else if "%__ARG%"=="-run" ( set _PROG_NAME=%_REPL_MAIN% +) else if "%__ARG%"=="-colors" ( set _COLORS=true +) else if "%__ARG%"=="-no-colors" ( set _COLORS= +) else if "%__ARG%"=="-with-compiler" ( set _JVM_CP_ARGS=%_PSEP%%_SCALA3_COMP%%_PSEP%%_TASTY_CORE% +@rem break out -D and -J options and add them to JAVA_OPTS as well +@rem so they reach the JVM in time to do some good. The -D options +@rem will be available as system properties. +) else if "%__ARG:~0,2%"=="-D" ( call :addJava "%__ARG%" +) else if "%__ARG:~0,2%"=="-J" ( call :addJava "%__ARG:~2%" +) else ( call :addResidual "%__ARG%" +) +shift +goto args_loop +:args_done +goto :eof + +@rem output parameter: _SCALA_ARGS +:addScala +set _SCALA_ARGS=%_SCALA_ARGS% %~1 +goto :eof + +@rem output parameter: _JAVA_ARGS +:addJava +set _JAVA_ARGS=%_JAVA_ARGS% %~1 +goto :eof + +@rem output parameter: _RESIDUAL_ARGS +:addResidual +set _RESIDUAL_ARGS=%_RESIDUAL_ARGS% %~1 +goto :eof + +@rem output parameter: _SCRIPTING_ARGS +:addScripting +set _SCRIPTING_ARGS=%_SCRIPTING_ARGS% %~1 +goto :eof + +@rem output parameter: _JVM_CP_ARGS +:classpathArgs +@rem echo scala3-compiler: %_SCALA3_COMP% +@rem echo scala3-interface: %_SCALA3_INTF% +@rem echo scala3-library: %_SCALA3_LIB% +@rem echo tasty-core: %_TASTY_CORE% +@rem echo scala-asm: %_SCALA_ASM% +@rem echo scala-lib: %_SCALA_LIB% +@rem echo sbt-intface: %_SBT_INTF% + +set __TOOLCHAIN=%_SCALA_LIB%%_PSEP% +set __TOOLCHAIN=%__TOOLCHAIN%%_SCALA3_LIB%%_PSEP% +set __TOOLCHAIN=%__TOOLCHAIN%%_SCALA_ASM%%_PSEP% +set __TOOLCHAIN=%__TOOLCHAIN%%_SBT_INTF%%_PSEP% +set __TOOLCHAIN=%__TOOLCHAIN%%_SCALA3_INTF%%_PSEP% +set __TOOLCHAIN=%__TOOLCHAIN%%_SCALA3_COMP%%_PSEP% +set __TOOLCHAIN=%__TOOLCHAIN%%_TASTY_CORE%%_PSEP% +set __TOOLCHAIN=%__TOOLCHAIN%%_SCALA3_STAGING%%_PSEP% +set __TOOLCHAIN=%__TOOLCHAIN%%_SCALA3_TASTY_INSPECTOR%%_PSEP% + +@rem # jline +set __TOOLCHAIN=%__TOOLCHAIN%%_JLINE_READER%%_PSEP% +set __TOOLCHAIN=%__TOOLCHAIN%%_JLINE_TERMINAL%%_PSEP% +set __TOOLCHAIN=%__TOOLCHAIN%%_JLINE_TERMINAL_JNA%%_PSEP% +set __TOOLCHAIN=%__TOOLCHAIN%%_JNA% + +set _JVM_CP_ARGS=-classpath "%__TOOLCHAIN%" +goto :eof + +@rem ######################################################################### +@rem ## Cleanups + +:end +exit /b %_EXITCODE% +endlocal diff --git a/dist/bin/scaladoc.bat b/dist/bin/scaladoc.bat new file mode 100644 index 000000000000..c7eb4cb6d472 --- /dev/null +++ b/dist/bin/scaladoc.bat @@ -0,0 +1,162 @@ +@echo off +setlocal enabledelayedexpansion + +@rem ######################################################################### +@rem ## Environment setup + +set _EXITCODE=0 + +set "_PROG_HOME=%~dp0" + +call "%_PROG_HOME%\common.bat" +if not %_EXITCODE%==0 goto end + +set _DEFAULT_JAVA_OPTS=-Xmx768m -Xms768m + +call :args %* + +@rem ######################################################################### +@rem ## Main + +call :classpathArgs + +if defined JAVA_OPTS ( set _JAVA_OPTS=%JAVA_OPTS% +) else ( set _JAVA_OPTS=%_DEFAULT_JAVA_OPTS% +) +call "%_JAVACMD%" %_JAVA_OPTS% %_JAVA_DEBUG% %_JAVA_ARGS% ^ +-classpath "%_CLASS_PATH%" ^ +-Dscala.usejavacp=true ^ +dotty.tools.scaladoc.Main %_SCALA_ARGS% %_RESIDUAL_ARGS% +if not %ERRORLEVEL%==0 ( + @rem echo Error: Scaladoc execution failed 1>&2 + set _EXITCODE=1 + goto end +) +goto end + +@rem ######################################################################### +@rem ## Subroutines + +:args +set _JAVA_DEBUG= +set _HELP= +set _VERBOSE= +set _QUIET= +set _COLORS= +set _SCALA_ARGS= +set _JAVA_ARGS= +set _RESIDUAL_ARGS= + +:args_loop +if "%~1"=="" goto args_done +set "__ARG=%~1" +if "%__ARG%"=="--" ( + @rem for arg; do addResidual "$arg"; done; set -- ;; +) else if "%__ARG%"=="-h" ( + set _HELP=true + call :addScala "-help" +) else if "%__ARG%"=="-help" ( + set _HELP=true + call :addScala "-help" +) else if "%__ARG%"=="-v" ( + set _VERBOSE=true + call :addScala "-verbose" +) else if "%__ARG%"=="-verbose" ( + set _VERBOSE=true + call :addScala "-verbose" +) else if "%__ARG%"=="-debug" ( set "_JAVA_DEBUG=%_DEBUG_STR%" +) else if "%__ARG%"=="-q" ( set _QUIET=true +) else if "%__ARG%"=="-quiet" ( set _QUIET=true +) else if "%__ARG%"=="-colors" ( set _COLORS=true +) else if "%__ARG%"=="-no-colors" ( set _COLORS= +) else if "%__ARG:~0,2%"=="-D" ( call :addJava "%__ARG%" +) else if "%__ARG:~0,2%"=="-J" ( call :addJava "%__ARG:~2%" +) else ( + if defined _IN_SCRIPTING_ARGS ( call :addScripting "%__ARG%" + ) else ( call :addResidual "%__ARG%" + ) +) +shift +goto args_loop +:args_done +goto :eof + +@rem output parameter: _SCALA_ARGS +:addScala +set _SCALA_ARGS=%_SCALA_ARGS% %~1 +goto :eof + +@rem output parameter: _JAVA_ARGS +:addJava +set _JAVA_ARGS=%_JAVA_ARGS% %~1 +goto :eof + +@rem output parameter: _RESIDUAL_ARGS +:addResidual +set _RESIDUAL_ARGS=%_RESIDUAL_ARGS% %~1 +goto :eof + +@rem output parameter: _CLASS_PATH +:classpathArgs +for /f %%f in ("%_PROG_HOME%\.") do set "_LIB_DIR=%%~dpflib" +set _CLASS_PATH= +@rem keep list in sync with bash script `bin\scaladoc` ! +call :updateClasspath "scaladoc" +call :updateClasspath "scala3-compiler" +call :updateClasspath "scala3-interfaces" +call :updateClasspath "scala3-library" +call :updateClasspath "tasty-core" +call :updateClasspath "scala3-tasty-inspector" +call :updateClasspath "flexmark-0" +call :updateClasspath "flexmark-html-parser" +call :updateClasspath "flexmark-ext-anchorlink" +call :updateClasspath "flexmark-ext-autolink" +call :updateClasspath "flexmark-ext-emoji" +call :updateClasspath "flexmark-ext-gfm-strikethrough" +call :updateClasspath "flexmark-ext-gfm-tables" +call :updateClasspath "flexmark-ext-gfm-tasklist" +call :updateClasspath "flexmark-ext-wikilink" +call :updateClasspath "flexmark-ext-yaml-front-matter" +call :updateClasspath "liqp" +call :updateClasspath "jsoup" +call :updateClasspath "jackson-dataformat-yaml" +call :updateClasspath "scala-asm" +call :updateClasspath "compiler-interface" +call :updateClasspath "jline-reader" +call :updateClasspath "jline-terminal-3" +call :updateClasspath "jline-terminal-jna" +call :updateClasspath "flexmark-util" +call :updateClasspath "flexmark-formatter" +call :updateClasspath "autolink-0.6" +call :updateClasspath "flexmark-jira-converter" +call :updateClasspath "antlr-3" +call :updateClasspath "jackson-annotations" +call :updateClasspath "jackson-core" +call :updateClasspath "jackson-databind" +call :updateClasspath "snakeyaml" +call :updateClasspath "scala-library" +call :updateClasspath "protobuf-java" +call :updateClasspath "util-interface" +call :updateClasspath "jna-5" +call :updateClasspath "flexmark-ext-tables" +call :updateClasspath "flexmark-ext-ins" +call :updateClasspath "flexmark-ext-superscript" +call :updateClasspath "antlr-runtime-3" +call :updateClasspath "ST4" +goto :eof + +@rem input parameter: %1=pattern for library file +@rem output parameter: _CLASS_PATH +:updateClasspath +set "__PATTERN=%~1" +for /f %%f in ('dir /a-d /b "%_LIB_DIR%\*%__PATTERN%*"') do ( + set "_CLASS_PATH=!_CLASS_PATH!%_LIB_DIR%\%%f%_PSEP%" +) +goto :eof + +@rem ######################################################################### +@rem ## Cleanups + +:end +exit /b %_EXITCODE% +endlocal diff --git a/project/scripts/winCmdTests.bat b/project/scripts/winCmdTests.bat new file mode 100644 index 000000000000..ee9b8237c694 --- /dev/null +++ b/project/scripts/winCmdTests.bat @@ -0,0 +1,25 @@ +@echo off +setlocal + +@rem paths are relative to the root project directory +set "_PREFIX=dist\target\pack" +set "_SOURCE=tests\pos\HelloWorld.scala" +set "_OUT_DIR=out" +set "_SITE_DIR=_site" + +@rem if-tests mimic the non-existing bash instruction 'set -e'. +call "%_PREFIX%\bin\scalac.bat" "@project\scripts\options" "%_SOURCE%" +if not %ERRORLEVEL%==0 endlocal& exit /b 1 + +call "%_PREFIX%\bin\scalac.bat" -d "%_OUT_DIR%" "%_SOURCE%" +if not %ERRORLEVEL%==0 endlocal& exit /b 1 + +call "%_PREFIX%\bin\scala.bat" -classpath "%_OUT_DIR%" HelloWorld +if not %ERRORLEVEL%==0 endlocal& exit /b 1 + +call "%_PREFIX%\bin\scala.bat" -classpath "%_OUT_DIR%" -J-Xmx512m HelloWorld +if not %ERRORLEVEL%==0 endlocal& exit /b 1 + +if not exist "%_SITE_DIR%" mkdir "%_SITE_DIR%" +call "%_PREFIX%\bin\scaladoc.bat" -d "%_SITE_DIR%" -project Hello "%_SOURCE%" +endlocal