1@echo off 2rem based on scalac.bat from the Scala distribution 3rem ########################################################################## 4rem # Copyright 2002-2011, LAMP/EPFL 5rem # Copyright 2011-2015, JetBrains 6rem # 7rem # This is free software; see the distribution for copying conditions. 8rem # There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A 9rem # PARTICULAR PURPOSE. 10rem ########################################################################## 11 12rem We adopt the following conventions: 13rem - System/user environment variables start with a letter 14rem - Local batch variables start with an underscore ('_') 15 16setlocal 17call :set_home 18 19if "%_KOTLIN_COMPILER%"=="" set _KOTLIN_COMPILER=org.jetbrains.kotlin.cli.jvm.K2JVMCompiler 20 21if not "%JAVA_HOME%"=="" ( 22 if exist "%JAVA_HOME%\bin\java.exe" set "_JAVACMD=%JAVA_HOME%\bin\java.exe" 23) 24 25if "%_JAVACMD%"=="" set _JAVACMD=java 26 27rem We use the value of the JAVA_OPTS environment variable if defined 28if "%JAVA_OPTS%"=="" set JAVA_OPTS=-Xmx256M -Xms32M 29 30if not "%_KOTLIN_RUNNER%"=="" ( 31 "%_JAVACMD%" %JAVA_OPTS% "-Dkotlin.home=%_KOTLIN_HOME%" -cp "%_KOTLIN_HOME%\lib\kotlin-runner.jar" ^ 32 org.jetbrains.kotlin.runner.Main %* 33) else ( 34 "%_JAVACMD%" %JAVA_OPTS% -noverify -cp "%_KOTLIN_HOME%\lib\kotlin-preloader.jar" ^ 35 org.jetbrains.kotlin.preloading.Preloader -cp "%_KOTLIN_HOME%\lib\kotlin-compiler.jar" ^ 36 %_KOTLIN_COMPILER% %* 37) 38 39exit /b %ERRORLEVEL% 40goto end 41 42rem ########################################################################## 43rem # subroutines 44 45:set_home 46 set _BIN_DIR= 47 for %%i in (%~sf0) do set _BIN_DIR=%_BIN_DIR%%%~dpsi 48 set _KOTLIN_HOME=%_BIN_DIR%.. 49goto :eof 50 51:end 52endlocal 53 54