Skip to content

Commit ebbe394

Browse files
committed
Windows - forward to scala-cli jar launcher
1 parent 673ae70 commit ebbe394

File tree

1 file changed

+6
-65
lines changed

1 file changed

+6
-65
lines changed

dist/bin/scala.bat

Lines changed: 6 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -14,86 +14,27 @@ for %%f in ("%~dp0.") do (
1414
call "%_PROG_HOME%\bin\common.bat"
1515
if not %_EXITCODE%==0 goto end
1616

17-
call :args %*
18-
1917
@rem #########################################################################
2018
@rem ## Main
2119

22-
call :compilerJavaClasspathArgs
23-
24-
call :setScalaVersion
20+
call :setScalaOpts
2521

2622
@rem we need to escape % in the java command path, for some reason this doesnt work in common.bat
2723
set "_JAVACMD=!_JAVACMD:%%=%%%%!"
2824

29-
call "%_JAVACMD%" %_JAVA_ARGS% "-Dscala.releaseversion=%_SCALA_VERSION%" "-Dscala.home=%_PROG_HOME%" -classpath "%_JVM_CP_ARGS%" dotty.tools.MainGenericRunner -classpath "%_JVM_CP_ARGS%" %_SCALA_ARGS%
25+
call "%_JAVACMD%" "-jar" "%SCALA_CLI_JAR%" "--cli-default-scala-version" "%_SCALA_VERSION%" "-r" "%MVN_REPOSITORY%" %*
3026
if not %ERRORLEVEL%==0 ( set _EXITCODE=1& goto end )
3127

3228
goto end
3329

3430
@rem #########################################################################
3531
@rem ## Subroutines
3632

37-
:args
38-
set _JAVA_ARGS=
39-
set _SCALA_ARGS=
40-
set _SCALA_CPATH=
41-
set "_SCALA_VERSION="
42-
43-
:args_loop
44-
if "%~1"=="" goto args_done
45-
set "__ARG=%~1"
46-
if "%__ARG:~0,2%"=="-D" (
47-
@rem pass to scala as well: otherwise we lose it sometimes when we
48-
@rem need it, e.g. communicating with a server compiler.
49-
set _JAVA_ARGS=!_JAVA_ARGS! "%__ARG%"
50-
set _SCALA_ARGS=!_SCALA_ARGS! "%__ARG%"
51-
) else if "%__ARG:~0,2%"=="-J" (
52-
@rem as with -D, pass to scala even though it will almost
53-
@rem never be used.
54-
set _JAVA_ARGS=!_JAVA_ARGS! %__ARG:~2%
55-
set _SCALA_ARGS=!_SCALA_ARGS! "%__ARG%"
56-
) else if "%__ARG%"=="-classpath" (
57-
set "_SCALA_CPATH=%~2"
58-
shift
59-
) else if "%__ARG%"=="-cp" (
60-
set "_SCALA_CPATH=%~2"
61-
shift
62-
) else (
63-
set _SCALA_ARGS=!_SCALA_ARGS! "%__ARG%"
64-
)
65-
shift
66-
goto args_loop
67-
:args_done
68-
goto :eof
69-
70-
@rem output parameter: _JVM_CP_ARGS
71-
:compilerJavaClasspathArgs
72-
set __TOOLCHAIN=
73-
set "__TOOLCHAIN=%__TOOLCHAIN%%_SCALA_LIB%%_PSEP%"
74-
set "__TOOLCHAIN=%__TOOLCHAIN%%_SCALA3_LIB%%_PSEP%"
75-
set "__TOOLCHAIN=%__TOOLCHAIN%%_SCALA_ASM%%_PSEP%"
76-
set "__TOOLCHAIN=%__TOOLCHAIN%%_SBT_INTF%%_PSEP%"
77-
set "__TOOLCHAIN=%__TOOLCHAIN%%_SCALA3_INTF%%_PSEP%"
78-
set "__TOOLCHAIN=%__TOOLCHAIN%%_SCALA3_COMP%%_PSEP%"
79-
set "__TOOLCHAIN=%__TOOLCHAIN%%_TASTY_CORE%%_PSEP%"
80-
set "__TOOLCHAIN=%__TOOLCHAIN%%_SCALA3_STAGING%%_PSEP%"
81-
set "__TOOLCHAIN=%__TOOLCHAIN%%_SCALA3_TASTY_INSPECTOR%%_PSEP%"
82-
83-
@rem # jline
84-
set "__TOOLCHAIN=%__TOOLCHAIN%%_JLINE_READER%%_PSEP%"
85-
set "__TOOLCHAIN=%__TOOLCHAIN%%_JLINE_TERMINAL%%_PSEP%"
86-
set "__TOOLCHAIN=%__TOOLCHAIN%%_JLINE_TERMINAL_JNA%%_PSEP%"
87-
set "__TOOLCHAIN=%__TOOLCHAIN%%_JNA%%_PSEP%"
88-
89-
if defined _SCALA_CPATH (
90-
set "_JVM_CP_ARGS=%__TOOLCHAIN%%_SCALA_CPATH%"
91-
) else (
92-
set "_JVM_CP_ARGS=%__TOOLCHAIN%"
93-
)
94-
goto :eof
33+
:setScalaOpts
9534

96-
:setScalaVersion
35+
set "_SCALA_VERSION="
36+
set "MVN_REPOSITORY=file://%_PROG_HOME:\=/%/maven2"
37+
set "SCALA_CLI_JAR=%_PROG_HOME%\etc\scala-cli.jar"
9738

9839
@rem read for version:=_SCALA_VERSION in VERSION_FILE
9940
FOR /F "usebackq delims=" %%G IN ("%_PROG_HOME%\VERSION") DO (

0 commit comments

Comments
 (0)