@@ -31,7 +31,7 @@ if defined JAVA_OPTS ( set _JAVA_OPTS=%JAVA_OPTS%
31
31
set " _JAVACMD = !_JAVACMD:%% =%%%% ! "
32
32
33
33
call " %_JAVACMD% " %_JAVA_OPTS% %_JAVA_DEBUG% %_JAVA_ARGS% ^
34
- -classpath " %_CLASS_PATH %" ^
34
+ -classpath " @ %_CLASS_PATH_FILE %" ^
35
35
-Dscala.usejavacp=true ^
36
36
dotty.tools.scaladoc.Main %_SCALA_ARGS% %_RESIDUAL_ARGS%
37
37
if not %ERRORLEVEL% == 0 (
@@ -79,9 +79,8 @@ if "%__ARG%"=="--" (
79
79
) else if " %__ARG:~0 ,2 % " == " -D" ( call :addJava " %__ARG% "
80
80
) else if " %__ARG:~0 ,2 % " == " -J" ( call :addJava " %__ARG:~2 % "
81
81
) else (
82
- if defined _IN_SCRIPTING_ARGS ( call :addScripting " %__ARG% "
83
- ) else ( call :addResidual " %__ARG% "
84
- )
82
+ if defined _IN_SCRIPTING_ARGS ( call :addScripting " %__ARG% " )
83
+ else ( call :addResidual " %__ARG% " )
85
84
)
86
85
shift
87
86
goto args_loop
@@ -103,25 +102,33 @@ goto :eof
103
102
set _RESIDUAL_ARGS = %_RESIDUAL_ARGS% %~1
104
103
goto :eof
105
104
106
- @ rem output parameter: _CLASS_PATH
105
+ @ rem output parameter: _CLASS_PATH_FILE.
106
+ @ rem It contains the path th the absolute classpaths
107
107
:classpathArgs
108
- set " _ETC_DIR = %_PROG_HOME% \etc"
109
- @ rem keep list in sync with bash script `bin\scaladoc` !
110
- call :loadClasspathFromFile
108
+
109
+ set _ETC_DIR = " %_PROG_HOME% \etc"
110
+ set _TMP_DIR = " %_PROG_HOME% \tmp"
111
+ set _INPUT_CLASSPATH_FILE = " %_ETC_DIR% \scaladoc.classpath"
112
+ set _OUTPUT_CLASSPATH_FILE = " %_TMP_DIR% \scaladoc.classpath"
113
+
114
+ @ rem Check if the _TMP_DIR exists. If not, create it (first time we run the command)
115
+ if not exist " %TMP_DIR% " ( mkdir " %TMP_DIR% " )
116
+
117
+ @ rem If the file doesn't exist, create it (first time we run the command)
118
+ if not exist " %_OUTPUT_CLASSPATH_FILE% " ( call :loadClasspathFromFile )
119
+ set _CLASS_PATH_FILE = " %_OUTPUT_CLASSPATH_FILE% "
111
120
goto :eof
112
121
113
- @ REM concatentate every line in "%_ETC_DIR%\scaladoc.classpath" with _PSEP
122
+ @ REM concatentate every line in _INPUT_CLASSPATH_FILE and dump it in the with _PSEP
114
123
:loadClasspathFromFile
115
124
set _CLASS_PATH =
116
- if exist " %_ETC_DIR% \scaladoc.classpath" (
117
- for /f " usebackq delims=" %%i in (" %_ETC_DIR% \scaladoc.classpath" ) do (
118
- set " _LIB = %_PROG_HOME% \maven2\%%i "
125
+ if exist " %_INPUT_CLASSPATH_FILE% " (
126
+ for /f " usebackq delims=" %%i in " %_INPUT_CLASSPATH_FILE% " do (
127
+ set _LIB = " %_PROG_HOME% \maven2\%%i "
128
+ @ rem Adapt the paths from Unix style to MS-DOS style
119
129
set " _LIB = !_LIB:/ =\ ! "
120
- if not defined _CLASS_PATH (
121
- set " _CLASS_PATH = !_LIB! "
122
- ) else (
123
- set " _CLASS_PATH = !_CLASS_PATH!%_PSEP%!_LIB! "
124
- )
130
+ @ rem Append the processed line to the output file, ensuring a new line
131
+ echo !_LIB! >> " %_OUTPUT_CLASSPATH_FILE% "
125
132
)
126
133
)
127
134
goto :eof
0 commit comments