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 SET _ADDITIONAL_CLASSPATH="" 35 36 if not "%_KOTLIN_TOOL%"=="" ( 37 set _ADDITIONAL_CLASSPATH=;%_KOTLIN_HOME%\lib\%_KOTLIN_TOOL% 38 ) 39 40 "%_JAVACMD%" %JAVA_OPTS% -noverify -cp "%_KOTLIN_HOME%\lib\kotlin-preloader.jar" ^ 41 org.jetbrains.kotlin.preloading.Preloader -cp "%_KOTLIN_HOME%\lib\kotlin-compiler.jar%_ADDITIONAL_CLASSPATH%" ^ 42 %_KOTLIN_COMPILER% %* 43) 44 45exit /b %ERRORLEVEL% 46goto end 47 48rem ########################################################################## 49rem # subroutines 50 51:set_home 52 set _BIN_DIR= 53 for %%i in (%~sf0) do set _BIN_DIR=%_BIN_DIR%%%~dpsi 54 set _KOTLIN_HOME=%_BIN_DIR%.. 55goto :eof 56 57:end 58endlocal 59 60