"Fossies" - the Fresh Open Source Software Archive

Member "scala-2.13.9/bin/scalac.bat" (19 Sep 2022, 4927 Bytes) of package /windows/misc/scala-2.13.9.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) MS DOS Batch source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 @echo off
    2 
    3 rem ##########################################################################
    4 rem # Scala (https://www.scala-lang.org)
    5 rem #
    6 rem # Copyright EPFL and Lightbend, Inc.
    7 rem #
    8 rem # Licensed under Apache License 2.0
    9 rem # (http://www.apache.org/licenses/LICENSE-2.0).
   10 rem #
   11 rem # See the NOTICE file distributed with this work for
   12 rem # additional information regarding copyright ownership.
   13 rem ##########################################################################
   14 
   15 setlocal enableextensions enabledelayedexpansion
   16 
   17 set _LINE_TOOLCP=
   18 
   19 rem Use "%~1" to handle spaces in paths. See https://ss64.com/nt/syntax-args.html
   20 rem scala/bug#7295 The goto here is needed to avoid problems with `scala Script.cmd "arg(with)paren"`,
   21 rem                we must not evaluate %~2 eagerly, but delayed expansion doesn't seem to allow
   22 rem                removal of quotation marks.
   23 if not [%~1]==[-toolcp] (
   24   goto :notoolcp
   25 )
   26 shift
   27 set _LINE_TOOLCP=%~1
   28 shift
   29 
   30 :notoolcp
   31 
   32 rem scala/bug#8358, scala/bug#8368 -- the default should really be false,
   33 rem but I don't want to flip the default during 2.11's RC cycle
   34 set _OVERRIDE_USEJAVACP="-Dscala.usejavacp=true"
   35 
   36 rem We keep in _JAVA_PARAMS all -J-prefixed and -D-prefixed arguments
   37 set _JAVA_PARAMS=
   38 
   39 if [%1]==[] goto param_afterloop
   40 set _TEST_PARAM=%~1
   41 if not "%_TEST_PARAM:~0,1%"=="-" goto param_afterloop
   42 
   43 rem ignore -e "scala code"
   44 if "%_TEST_PARAM:~0,2%"=="-e" (
   45   shift
   46   shift
   47   if [%1]==[] goto param_afterloop
   48 )
   49 
   50 set _TEST_PARAM=%~1
   51 if "%_TEST_PARAM:~0,2%"=="-J" (
   52   set _JAVA_PARAMS=%_TEST_PARAM:~2%
   53 )
   54 
   55 if "%_TEST_PARAM:~0,2%"=="-D" (
   56   rem Only match beginning of the -D option. The relevant bit is 17 chars long.
   57   if "%_TEST_PARAM:~0,17%"=="-Dscala.usejavacp" (
   58     set _OVERRIDE_USEJAVACP=
   59   )
   60   rem test if this was double-quoted property "-Dprop=42"
   61   for /F "delims== tokens=1-2" %%G in ("%_TEST_PARAM%") DO (
   62     if not "%%G" == "%_TEST_PARAM%" (
   63       rem double quoted: "-Dprop=42" -> -Dprop="42"
   64       set _JAVA_PARAMS=%%G="%%H"
   65     ) else if [%2] neq [] (
   66       rem it was a normal property: -Dprop=42 or -Drop="42"
   67       set _JAVA_PARAMS=%_TEST_PARAM%=%2
   68       shift
   69     )
   70   )
   71 )
   72 
   73 :param_loop
   74 shift
   75 
   76 if [%1]==[] goto param_afterloop
   77 set _TEST_PARAM=%~1
   78 if not "%_TEST_PARAM:~0,1%"=="-" goto param_afterloop 
   79 
   80 rem ignore -e "scala code"
   81 if "%_TEST_PARAM:~0,2%"=="-e" (
   82   shift
   83   shift
   84   if [%1]==[] goto param_afterloop
   85 )
   86 
   87 set _TEST_PARAM=%~1
   88 if "%_TEST_PARAM:~0,2%"=="-J" (
   89   set _JAVA_PARAMS=%_JAVA_PARAMS% %_TEST_PARAM:~2%
   90 )
   91 
   92 if "%_TEST_PARAM:~0,2%"=="-D" (
   93   rem test if this was double-quoted property "-Dprop=42"
   94   for /F "delims== tokens=1-2" %%G in ("%_TEST_PARAM%") DO (
   95     if not "%%G" == "%_TEST_PARAM%" (
   96       rem double quoted: "-Dprop=42" -> -Dprop="42"
   97       set _JAVA_PARAMS=%_JAVA_PARAMS% %%G="%%H"
   98     ) else if [%2] neq [] (
   99       rem it was a normal property: -Dprop=42 or -Drop="42"
  100       set _JAVA_PARAMS=%_JAVA_PARAMS% %_TEST_PARAM%=%2
  101       shift
  102     )
  103   )
  104 )
  105 goto param_loop
  106 :param_afterloop
  107 
  108 if "%OS%" NEQ "Windows_NT" (
  109   echo "Warning, your version of Windows is not supported.  Attempting to start scala anyway."
  110 )
  111 
  112 @setlocal
  113 call :set_home
  114 
  115 rem We use the value of the JAVACMD environment variable if defined
  116 set _JAVACMD=%JAVACMD%
  117 
  118 if not defined _JAVACMD (
  119   if not "%JAVA_HOME%"=="" (
  120     if exist "%JAVA_HOME%\bin\java.exe" set "_JAVACMD=%JAVA_HOME%\bin\java.exe"
  121   )
  122 )
  123 
  124 if "%_JAVACMD%"=="" set _JAVACMD=java
  125 
  126 rem We use the value of the JAVA_OPTS environment variable if defined
  127 set _JAVA_OPTS=%JAVA_OPTS%
  128 if not defined _JAVA_OPTS set _JAVA_OPTS=-Xmx256M -Xms32M
  129 
  130 rem We append _JAVA_PARAMS java arguments to JAVA_OPTS if necessary
  131 if defined _JAVA_PARAMS set _JAVA_OPTS=%_JAVA_OPTS% %_JAVA_PARAMS%
  132 
  133 set _TOOL_CLASSPATH=
  134 if "%_TOOL_CLASSPATH%"=="" (
  135   for %%f in ("!_SCALA_HOME!\lib\*.jar") do call :add_cpath "%%f"
  136   for /d %%f in ("!_SCALA_HOME!\lib\*") do call :add_cpath "%%f"
  137 )
  138 
  139 if not "%_LINE_TOOLCP%"=="" call :add_cpath "%_LINE_TOOLCP%"
  140 
  141 set _PROPS=-Dscala.home="!_SCALA_HOME!" %_OVERRIDE_USEJAVACP% 
  142 
  143 setlocal DisableDelayedExpansion
  144 rem echo "%_JAVACMD%" %_JAVA_OPTS% %_PROPS% -cp "%_TOOL_CLASSPATH%" scala.tools.nsc.Main  %*
  145 "%_JAVACMD%" %_JAVA_OPTS% %_PROPS% -cp "%_TOOL_CLASSPATH%" scala.tools.nsc.Main  %*
  146 goto end
  147 
  148 rem ##########################################################################
  149 rem # subroutines
  150 
  151 :add_cpath
  152   if "%_TOOL_CLASSPATH%"=="" (
  153     set _TOOL_CLASSPATH=%~1
  154   ) else (
  155     set _TOOL_CLASSPATH=%_TOOL_CLASSPATH%;%~1
  156   )
  157 goto :eof
  158 
  159 rem Variable "%~dps0" works on WinXP SP2 or newer
  160 rem (see https://support.microsoft.com/?kbid=833431)
  161 rem set _SCALA_HOME=%~dps0..
  162 :set_home
  163   set _BIN_DIR=
  164   for %%i in ("%~sf0") do set _BIN_DIR=%_BIN_DIR%%%~dpsi
  165   set _SCALA_HOME=%_BIN_DIR%..
  166 goto :eof
  167 
  168 :end
  169 @endlocal
  170 
  171 REM exit code fix, see https://stackoverflow.com/questions/4632891/exiting-batch-with-exit-b-x-where-x-1-acts-as-if-command-completed-successfu
  172 @"%COMSPEC%" /C exit %errorlevel% >nul