Skip to content

Commit

Permalink
fix loading classpath in batch script
Browse files Browse the repository at this point in the history
  • Loading branch information
bishabosha committed Jun 20, 2024
1 parent 5b0044c commit 33eed71
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 15 deletions.
13 changes: 0 additions & 13 deletions dist/bin/common.bat
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,3 @@ if not defined _PROG_HOME (
set "_ETC_DIR=%_PROG_HOME%\etc"

set _PSEP=;

@rem input parameter: %1=command for classpath file
@rem output parameter: _CLASS_PATH
:loadClasspathFromFile
set "__COMMAND=%~1"
set _CLASS_PATH=
for /f "delims=" %%f in ("%_ETC_DIR%\%__COMMAND%.classpath") do (
set "relpath=%%f"
set "relpath=!relpath:/=\!"

set "_CLASS_PATH=!_CLASS_PATH!%_PROG_HOME%\maven2\%relpath%%_PSEP%"
)
goto :eof
18 changes: 17 additions & 1 deletion dist/bin/scalac.bat
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ goto :eof
@rem output parameter: _JVM_CP_ARGS
:compilerJavaClasspathArgs

call :loadClasspathFromFile "scala"
call :loadClasspathFromFile

set "__TOOLCHAIN=%_CLASS_PATH%"

Expand All @@ -100,6 +100,22 @@ if defined _SCALA_CPATH (
)
goto :eof

@REM concatentate every line in "%_ETC_DIR%\scala.classpath" with _PSEP
:loadClasspathFromFile
set _CLASS_PATH=
if exist "%_ETC_DIR%\scala.classpath" (
for /f "usebackq delims=" %%i in ("%_ETC_DIR%\scala.classpath") do (
set "_LIB=%_PROG_HOME%\maven2\%%i"
set "_LIB=!_LIB:/=\!"
if not defined _CLASS_PATH (
set "_CLASS_PATH=!_LIB!"
) else (
set "_CLASS_PATH=!_CLASS_PATH!%_PSEP%!_LIB!"
)
)
)
goto :eof

@rem #########################################################################
@rem ## Cleanups

Expand Down
18 changes: 17 additions & 1 deletion dist/bin/scaladoc.bat
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,23 @@ goto :eof
:classpathArgs
set "_ETC_DIR=%_PROG_HOME%\etc"
@rem keep list in sync with bash script `bin\scaladoc` !
call :loadClasspathFromFile "scaladoc"
call :loadClasspathFromFile
goto :eof

@REM concatentate every line in "%_ETC_DIR%\scaladoc.classpath" with _PSEP
:loadClasspathFromFile
set _CLASS_PATH=
if exist "%_ETC_DIR%\scaladoc.classpath" (
for /f "usebackq delims=" %%i in ("%_ETC_DIR%\scaladoc.classpath") do (
set "_LIB=%_PROG_HOME%\maven2\%%i"
set "_LIB=!_LIB:/=\!"
if not defined _CLASS_PATH (
set "_CLASS_PATH=!_LIB!"
) else (
set "_CLASS_PATH=!_CLASS_PATH!%_PSEP%!_LIB!"
)
)
)
goto :eof

@rem #########################################################################
Expand Down

0 comments on commit 33eed71

Please sign in to comment.