1*344a7f5eSAndroid Build Coastguard Worker@rem 2*344a7f5eSAndroid Build Coastguard Worker@rem Copyright 2015 the original author or authors. 3*344a7f5eSAndroid Build Coastguard Worker@rem 4*344a7f5eSAndroid Build Coastguard Worker@rem Licensed under the Apache License, Version 2.0 (the "License"); 5*344a7f5eSAndroid Build Coastguard Worker@rem you may not use this file except in compliance with the License. 6*344a7f5eSAndroid Build Coastguard Worker@rem You may obtain a copy of the License at 7*344a7f5eSAndroid Build Coastguard Worker@rem 8*344a7f5eSAndroid Build Coastguard Worker@rem https://www.apache.org/licenses/LICENSE-2.0 9*344a7f5eSAndroid Build Coastguard Worker@rem 10*344a7f5eSAndroid Build Coastguard Worker@rem Unless required by applicable law or agreed to in writing, software 11*344a7f5eSAndroid Build Coastguard Worker@rem distributed under the License is distributed on an "AS IS" BASIS, 12*344a7f5eSAndroid Build Coastguard Worker@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*344a7f5eSAndroid Build Coastguard Worker@rem See the License for the specific language governing permissions and 14*344a7f5eSAndroid Build Coastguard Worker@rem limitations under the License. 15*344a7f5eSAndroid Build Coastguard Worker@rem 16*344a7f5eSAndroid Build Coastguard Worker 17*344a7f5eSAndroid Build Coastguard Worker@if "%DEBUG%" == "" @echo off 18*344a7f5eSAndroid Build Coastguard Worker@rem ########################################################################## 19*344a7f5eSAndroid Build Coastguard Worker@rem 20*344a7f5eSAndroid Build Coastguard Worker@rem jetifier-standalone startup script for Windows 21*344a7f5eSAndroid Build Coastguard Worker@rem 22*344a7f5eSAndroid Build Coastguard Worker@rem ########################################################################## 23*344a7f5eSAndroid Build Coastguard Worker 24*344a7f5eSAndroid Build Coastguard Worker@rem Set local scope for the variables with windows NT shell 25*344a7f5eSAndroid Build Coastguard Workerif "%OS%"=="Windows_NT" setlocal 26*344a7f5eSAndroid Build Coastguard Worker 27*344a7f5eSAndroid Build Coastguard Workerset DIRNAME=%~dp0 28*344a7f5eSAndroid Build Coastguard Workerif "%DIRNAME%" == "" set DIRNAME=. 29*344a7f5eSAndroid Build Coastguard Workerset APP_BASE_NAME=%~n0 30*344a7f5eSAndroid Build Coastguard Workerset APP_HOME=%DIRNAME%.. 31*344a7f5eSAndroid Build Coastguard Worker 32*344a7f5eSAndroid Build Coastguard Worker@rem Resolve any "." and ".." in APP_HOME to make it shorter. 33*344a7f5eSAndroid Build Coastguard Workerfor %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34*344a7f5eSAndroid Build Coastguard Worker 35*344a7f5eSAndroid Build Coastguard Worker@rem Add default JVM options here. You can also use JAVA_OPTS and JETIFIER_STANDALONE_OPTS to pass JVM options to this script. 36*344a7f5eSAndroid Build Coastguard Workerset DEFAULT_JVM_OPTS= 37*344a7f5eSAndroid Build Coastguard Worker 38*344a7f5eSAndroid Build Coastguard Worker@rem Find java.exe 39*344a7f5eSAndroid Build Coastguard Workerif defined JAVA_HOME goto findJavaFromJavaHome 40*344a7f5eSAndroid Build Coastguard Worker 41*344a7f5eSAndroid Build Coastguard Workerset JAVA_EXE=java.exe 42*344a7f5eSAndroid Build Coastguard Worker%JAVA_EXE% -version >NUL 2>&1 43*344a7f5eSAndroid Build Coastguard Workerif "%ERRORLEVEL%" == "0" goto init 44*344a7f5eSAndroid Build Coastguard Worker 45*344a7f5eSAndroid Build Coastguard Workerecho. 46*344a7f5eSAndroid Build Coastguard Workerecho ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47*344a7f5eSAndroid Build Coastguard Workerecho. 48*344a7f5eSAndroid Build Coastguard Workerecho Please set the JAVA_HOME variable in your environment to match the 49*344a7f5eSAndroid Build Coastguard Workerecho location of your Java installation. 50*344a7f5eSAndroid Build Coastguard Worker 51*344a7f5eSAndroid Build Coastguard Workergoto fail 52*344a7f5eSAndroid Build Coastguard Worker 53*344a7f5eSAndroid Build Coastguard Worker:findJavaFromJavaHome 54*344a7f5eSAndroid Build Coastguard Workerset JAVA_HOME=%JAVA_HOME:"=% 55*344a7f5eSAndroid Build Coastguard Workerset JAVA_EXE=%JAVA_HOME%/bin/java.exe 56*344a7f5eSAndroid Build Coastguard Worker 57*344a7f5eSAndroid Build Coastguard Workerif exist "%JAVA_EXE%" goto init 58*344a7f5eSAndroid Build Coastguard Worker 59*344a7f5eSAndroid Build Coastguard Workerecho. 60*344a7f5eSAndroid Build Coastguard Workerecho ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61*344a7f5eSAndroid Build Coastguard Workerecho. 62*344a7f5eSAndroid Build Coastguard Workerecho Please set the JAVA_HOME variable in your environment to match the 63*344a7f5eSAndroid Build Coastguard Workerecho location of your Java installation. 64*344a7f5eSAndroid Build Coastguard Worker 65*344a7f5eSAndroid Build Coastguard Workergoto fail 66*344a7f5eSAndroid Build Coastguard Worker 67*344a7f5eSAndroid Build Coastguard Worker:init 68*344a7f5eSAndroid Build Coastguard Worker@rem Get command-line arguments, handling Windows variants 69*344a7f5eSAndroid Build Coastguard Worker 70*344a7f5eSAndroid Build Coastguard Workerif not "%OS%" == "Windows_NT" goto win9xME_args 71*344a7f5eSAndroid Build Coastguard Worker 72*344a7f5eSAndroid Build Coastguard Worker:win9xME_args 73*344a7f5eSAndroid Build Coastguard Worker@rem Slurp the command line arguments. 74*344a7f5eSAndroid Build Coastguard Workerset CMD_LINE_ARGS= 75*344a7f5eSAndroid Build Coastguard Workerset _SKIP=2 76*344a7f5eSAndroid Build Coastguard Worker 77*344a7f5eSAndroid Build Coastguard Worker:win9xME_args_slurp 78*344a7f5eSAndroid Build Coastguard Workerif "x%~1" == "x" goto execute 79*344a7f5eSAndroid Build Coastguard Worker 80*344a7f5eSAndroid Build Coastguard Workerset CMD_LINE_ARGS=%* 81*344a7f5eSAndroid Build Coastguard Worker 82*344a7f5eSAndroid Build Coastguard Worker:execute 83*344a7f5eSAndroid Build Coastguard Worker@rem Setup the command line 84*344a7f5eSAndroid Build Coastguard Worker 85*344a7f5eSAndroid Build Coastguard Workerset CLASSPATH=%APP_HOME%\lib\jetifier-standalone.jar;%APP_HOME%\lib\jetifier-processor-1.0.0-beta10.jar;%APP_HOME%\lib\commons-cli-1.3.1.jar;%APP_HOME%\lib\jetifier-core-1.0.0-beta10.jar;%APP_HOME%\lib\asm-util-8.0.1.jar;%APP_HOME%\lib\asm-commons-8.0.1.jar;%APP_HOME%\lib\asm-analysis-8.0.1.jar;%APP_HOME%\lib\asm-tree-8.0.1.jar;%APP_HOME%\lib\asm-8.0.1.jar;%APP_HOME%\lib\jdom2-2.0.6.jar;%APP_HOME%\lib\kotlin-stdlib-1.3.71.jar;%APP_HOME%\lib\gson-2.8.0.jar;%APP_HOME%\lib\kotlin-stdlib-common-1.3.71.jar;%APP_HOME%\lib\annotations-13.0.jar 86*344a7f5eSAndroid Build Coastguard Worker 87*344a7f5eSAndroid Build Coastguard Worker 88*344a7f5eSAndroid Build Coastguard Worker@rem Execute jetifier-standalone 89*344a7f5eSAndroid Build Coastguard Worker"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %JETIFIER_STANDALONE_OPTS% -classpath "%CLASSPATH%" com.android.tools.build.jetifier.standalone.Main %CMD_LINE_ARGS% 90*344a7f5eSAndroid Build Coastguard Worker 91*344a7f5eSAndroid Build Coastguard Worker:end 92*344a7f5eSAndroid Build Coastguard Worker@rem End local scope for the variables with windows NT shell 93*344a7f5eSAndroid Build Coastguard Workerif "%ERRORLEVEL%"=="0" goto mainEnd 94*344a7f5eSAndroid Build Coastguard Worker 95*344a7f5eSAndroid Build Coastguard Worker:fail 96*344a7f5eSAndroid Build Coastguard Workerrem Set variable JETIFIER_STANDALONE_EXIT_CONSOLE if you need the _script_ return code instead of 97*344a7f5eSAndroid Build Coastguard Workerrem the _cmd.exe /c_ return code! 98*344a7f5eSAndroid Build Coastguard Workerif not "" == "%JETIFIER_STANDALONE_EXIT_CONSOLE%" exit 1 99*344a7f5eSAndroid Build Coastguard Workerexit /b 1 100*344a7f5eSAndroid Build Coastguard Worker 101*344a7f5eSAndroid Build Coastguard Worker:mainEnd 102*344a7f5eSAndroid Build Coastguard Workerif "%OS%"=="Windows_NT" endlocal 103*344a7f5eSAndroid Build Coastguard Worker 104*344a7f5eSAndroid Build Coastguard Worker:omega 105