From 33eed71bd9f160eeb811ad41132e189993faf4c8 Mon Sep 17 00:00:00 2001 From: Jamie Thompson Date: Thu, 20 Jun 2024 16:40:39 +0200 Subject: [PATCH] fix loading classpath in batch script --- dist/bin/common.bat | 13 ------------- dist/bin/scalac.bat | 18 +++++++++++++++++- dist/bin/scaladoc.bat | 18 +++++++++++++++++- 3 files changed, 34 insertions(+), 15 deletions(-) diff --git a/dist/bin/common.bat b/dist/bin/common.bat index a00683e2cd91..f9c35e432b36 100644 --- a/dist/bin/common.bat +++ b/dist/bin/common.bat @@ -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 diff --git a/dist/bin/scalac.bat b/dist/bin/scalac.bat index ebd1f8e2f6f0..fe6d7e3fad4d 100644 --- a/dist/bin/scalac.bat +++ b/dist/bin/scalac.bat @@ -89,7 +89,7 @@ goto :eof @rem output parameter: _JVM_CP_ARGS :compilerJavaClasspathArgs -call :loadClasspathFromFile "scala" +call :loadClasspathFromFile set "__TOOLCHAIN=%_CLASS_PATH%" @@ -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 diff --git a/dist/bin/scaladoc.bat b/dist/bin/scaladoc.bat index 4d2a34212971..16433a83f501 100644 --- a/dist/bin/scaladoc.bat +++ b/dist/bin/scaladoc.bat @@ -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 #########################################################################