xref: /aosp_15_r20/external/ktfmt/online_formatter/gradlew.bat (revision 5be3f65c8cf0e6db0a7e312df5006e8e93cdf9ec)
1*5be3f65cSAndroid Build Coastguard Worker@rem
2*5be3f65cSAndroid Build Coastguard Worker@rem Copyright 2015 the original author or authors.
3*5be3f65cSAndroid Build Coastguard Worker@rem
4*5be3f65cSAndroid Build Coastguard Worker@rem Licensed under the Apache License, Version 2.0 (the "License");
5*5be3f65cSAndroid Build Coastguard Worker@rem you may not use this file except in compliance with the License.
6*5be3f65cSAndroid Build Coastguard Worker@rem You may obtain a copy of the License at
7*5be3f65cSAndroid Build Coastguard Worker@rem
8*5be3f65cSAndroid Build Coastguard Worker@rem      https://www.apache.org/licenses/LICENSE-2.0
9*5be3f65cSAndroid Build Coastguard Worker@rem
10*5be3f65cSAndroid Build Coastguard Worker@rem Unless required by applicable law or agreed to in writing, software
11*5be3f65cSAndroid Build Coastguard Worker@rem distributed under the License is distributed on an "AS IS" BASIS,
12*5be3f65cSAndroid Build Coastguard Worker@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*5be3f65cSAndroid Build Coastguard Worker@rem See the License for the specific language governing permissions and
14*5be3f65cSAndroid Build Coastguard Worker@rem limitations under the License.
15*5be3f65cSAndroid Build Coastguard Worker@rem
16*5be3f65cSAndroid Build Coastguard Worker
17*5be3f65cSAndroid Build Coastguard Worker@if "%DEBUG%" == "" @echo off
18*5be3f65cSAndroid Build Coastguard Worker@rem ##########################################################################
19*5be3f65cSAndroid Build Coastguard Worker@rem
20*5be3f65cSAndroid Build Coastguard Worker@rem  Gradle startup script for Windows
21*5be3f65cSAndroid Build Coastguard Worker@rem
22*5be3f65cSAndroid Build Coastguard Worker@rem ##########################################################################
23*5be3f65cSAndroid Build Coastguard Worker
24*5be3f65cSAndroid Build Coastguard Worker@rem Set local scope for the variables with windows NT shell
25*5be3f65cSAndroid Build Coastguard Workerif "%OS%"=="Windows_NT" setlocal
26*5be3f65cSAndroid Build Coastguard Worker
27*5be3f65cSAndroid Build Coastguard Workerset DIRNAME=%~dp0
28*5be3f65cSAndroid Build Coastguard Workerif "%DIRNAME%" == "" set DIRNAME=.
29*5be3f65cSAndroid Build Coastguard Workerset APP_BASE_NAME=%~n0
30*5be3f65cSAndroid Build Coastguard Workerset APP_HOME=%DIRNAME%
31*5be3f65cSAndroid Build Coastguard Worker
32*5be3f65cSAndroid Build Coastguard Worker@rem Resolve any "." and ".." in APP_HOME to make it shorter.
33*5be3f65cSAndroid Build Coastguard Workerfor %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34*5be3f65cSAndroid Build Coastguard Worker
35*5be3f65cSAndroid Build Coastguard Worker@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36*5be3f65cSAndroid Build Coastguard Workerset DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37*5be3f65cSAndroid Build Coastguard Worker
38*5be3f65cSAndroid Build Coastguard Worker@rem Find java.exe
39*5be3f65cSAndroid Build Coastguard Workerif defined JAVA_HOME goto findJavaFromJavaHome
40*5be3f65cSAndroid Build Coastguard Worker
41*5be3f65cSAndroid Build Coastguard Workerset JAVA_EXE=java.exe
42*5be3f65cSAndroid Build Coastguard Worker%JAVA_EXE% -version >NUL 2>&1
43*5be3f65cSAndroid Build Coastguard Workerif "%ERRORLEVEL%" == "0" goto execute
44*5be3f65cSAndroid Build Coastguard Worker
45*5be3f65cSAndroid Build Coastguard Workerecho.
46*5be3f65cSAndroid Build Coastguard Workerecho ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47*5be3f65cSAndroid Build Coastguard Workerecho.
48*5be3f65cSAndroid Build Coastguard Workerecho Please set the JAVA_HOME variable in your environment to match the
49*5be3f65cSAndroid Build Coastguard Workerecho location of your Java installation.
50*5be3f65cSAndroid Build Coastguard Worker
51*5be3f65cSAndroid Build Coastguard Workergoto fail
52*5be3f65cSAndroid Build Coastguard Worker
53*5be3f65cSAndroid Build Coastguard Worker:findJavaFromJavaHome
54*5be3f65cSAndroid Build Coastguard Workerset JAVA_HOME=%JAVA_HOME:"=%
55*5be3f65cSAndroid Build Coastguard Workerset JAVA_EXE=%JAVA_HOME%/bin/java.exe
56*5be3f65cSAndroid Build Coastguard Worker
57*5be3f65cSAndroid Build Coastguard Workerif exist "%JAVA_EXE%" goto execute
58*5be3f65cSAndroid Build Coastguard Worker
59*5be3f65cSAndroid Build Coastguard Workerecho.
60*5be3f65cSAndroid Build Coastguard Workerecho ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61*5be3f65cSAndroid Build Coastguard Workerecho.
62*5be3f65cSAndroid Build Coastguard Workerecho Please set the JAVA_HOME variable in your environment to match the
63*5be3f65cSAndroid Build Coastguard Workerecho location of your Java installation.
64*5be3f65cSAndroid Build Coastguard Worker
65*5be3f65cSAndroid Build Coastguard Workergoto fail
66*5be3f65cSAndroid Build Coastguard Worker
67*5be3f65cSAndroid Build Coastguard Worker:execute
68*5be3f65cSAndroid Build Coastguard Worker@rem Setup the command line
69*5be3f65cSAndroid Build Coastguard Worker
70*5be3f65cSAndroid Build Coastguard Workerset CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71*5be3f65cSAndroid Build Coastguard Worker
72*5be3f65cSAndroid Build Coastguard Worker
73*5be3f65cSAndroid Build Coastguard Worker@rem Execute Gradle
74*5be3f65cSAndroid Build Coastguard Worker"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75*5be3f65cSAndroid Build Coastguard Worker
76*5be3f65cSAndroid Build Coastguard Worker:end
77*5be3f65cSAndroid Build Coastguard Worker@rem End local scope for the variables with windows NT shell
78*5be3f65cSAndroid Build Coastguard Workerif "%ERRORLEVEL%"=="0" goto mainEnd
79*5be3f65cSAndroid Build Coastguard Worker
80*5be3f65cSAndroid Build Coastguard Worker:fail
81*5be3f65cSAndroid Build Coastguard Workerrem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82*5be3f65cSAndroid Build Coastguard Workerrem the _cmd.exe /c_ return code!
83*5be3f65cSAndroid Build Coastguard Workerif  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84*5be3f65cSAndroid Build Coastguard Workerexit /b 1
85*5be3f65cSAndroid Build Coastguard Worker
86*5be3f65cSAndroid Build Coastguard Worker:mainEnd
87*5be3f65cSAndroid Build Coastguard Workerif "%OS%"=="Windows_NT" endlocal
88*5be3f65cSAndroid Build Coastguard Worker
89*5be3f65cSAndroid Build Coastguard Worker:omega
90