xref: /aosp_15_r20/external/kotlinx.atomicfu/atomicfu-maven-plugin/mvnw.cmd (revision 68017707106cb9da9fed635c150bc497c09c160f)
1*68017707SAndroid Build Coastguard Worker@REM ----------------------------------------------------------------------------
2*68017707SAndroid Build Coastguard Worker@REM Licensed to the Apache Software Foundation (ASF) under one
3*68017707SAndroid Build Coastguard Worker@REM or more contributor license agreements.  See the NOTICE file
4*68017707SAndroid Build Coastguard Worker@REM distributed with this work for additional information
5*68017707SAndroid Build Coastguard Worker@REM regarding copyright ownership.  The ASF licenses this file
6*68017707SAndroid Build Coastguard Worker@REM to you under the Apache License, Version 2.0 (the
7*68017707SAndroid Build Coastguard Worker@REM "License"); you may not use this file except in compliance
8*68017707SAndroid Build Coastguard Worker@REM with the License.  You may obtain a copy of the License at
9*68017707SAndroid Build Coastguard Worker@REM
10*68017707SAndroid Build Coastguard Worker@REM    http://www.apache.org/licenses/LICENSE-2.0
11*68017707SAndroid Build Coastguard Worker@REM
12*68017707SAndroid Build Coastguard Worker@REM Unless required by applicable law or agreed to in writing,
13*68017707SAndroid Build Coastguard Worker@REM software distributed under the License is distributed on an
14*68017707SAndroid Build Coastguard Worker@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15*68017707SAndroid Build Coastguard Worker@REM KIND, either express or implied.  See the License for the
16*68017707SAndroid Build Coastguard Worker@REM specific language governing permissions and limitations
17*68017707SAndroid Build Coastguard Worker@REM under the License.
18*68017707SAndroid Build Coastguard Worker@REM ----------------------------------------------------------------------------
19*68017707SAndroid Build Coastguard Worker
20*68017707SAndroid Build Coastguard Worker@REM ----------------------------------------------------------------------------
21*68017707SAndroid Build Coastguard Worker@REM Maven2 Start Up Batch script
22*68017707SAndroid Build Coastguard Worker@REM
23*68017707SAndroid Build Coastguard Worker@REM Required ENV vars:
24*68017707SAndroid Build Coastguard Worker@REM JAVA_HOME - location of a JDK home dir
25*68017707SAndroid Build Coastguard Worker@REM
26*68017707SAndroid Build Coastguard Worker@REM Optional ENV vars
27*68017707SAndroid Build Coastguard Worker@REM M2_HOME - location of maven2's installed home dir
28*68017707SAndroid Build Coastguard Worker@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
29*68017707SAndroid Build Coastguard Worker@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
30*68017707SAndroid Build Coastguard Worker@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
31*68017707SAndroid Build Coastguard Worker@REM     e.g. to debug Maven itself, use
32*68017707SAndroid Build Coastguard Worker@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
33*68017707SAndroid Build Coastguard Worker@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
34*68017707SAndroid Build Coastguard Worker@REM ----------------------------------------------------------------------------
35*68017707SAndroid Build Coastguard Worker
36*68017707SAndroid Build Coastguard Worker@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
37*68017707SAndroid Build Coastguard Worker@echo off
38*68017707SAndroid Build Coastguard Worker@REM set title of command window
39*68017707SAndroid Build Coastguard Workertitle %0
40*68017707SAndroid Build Coastguard Worker@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
41*68017707SAndroid Build Coastguard Worker@if "%MAVEN_BATCH_ECHO%" == "on"  echo %MAVEN_BATCH_ECHO%
42*68017707SAndroid Build Coastguard Worker
43*68017707SAndroid Build Coastguard Worker@REM set %HOME% to equivalent of $HOME
44*68017707SAndroid Build Coastguard Workerif "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
45*68017707SAndroid Build Coastguard Worker
46*68017707SAndroid Build Coastguard Worker@REM Execute a user defined script before this one
47*68017707SAndroid Build Coastguard Workerif not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
48*68017707SAndroid Build Coastguard Worker@REM check for pre script, once with legacy .bat ending and once with .cmd ending
49*68017707SAndroid Build Coastguard Workerif exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
50*68017707SAndroid Build Coastguard Workerif exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
51*68017707SAndroid Build Coastguard Worker:skipRcPre
52*68017707SAndroid Build Coastguard Worker
53*68017707SAndroid Build Coastguard Worker@setlocal
54*68017707SAndroid Build Coastguard Worker
55*68017707SAndroid Build Coastguard Workerset ERROR_CODE=0
56*68017707SAndroid Build Coastguard Worker
57*68017707SAndroid Build Coastguard Worker@REM To isolate internal variables from possible post scripts, we use another setlocal
58*68017707SAndroid Build Coastguard Worker@setlocal
59*68017707SAndroid Build Coastguard Worker
60*68017707SAndroid Build Coastguard Worker@REM ==== START VALIDATION ====
61*68017707SAndroid Build Coastguard Workerif not "%JAVA_HOME%" == "" goto OkJHome
62*68017707SAndroid Build Coastguard Worker
63*68017707SAndroid Build Coastguard Workerecho.
64*68017707SAndroid Build Coastguard Workerecho Error: JAVA_HOME not found in your environment. >&2
65*68017707SAndroid Build Coastguard Workerecho Please set the JAVA_HOME variable in your environment to match the >&2
66*68017707SAndroid Build Coastguard Workerecho location of your Java installation. >&2
67*68017707SAndroid Build Coastguard Workerecho.
68*68017707SAndroid Build Coastguard Workergoto error
69*68017707SAndroid Build Coastguard Worker
70*68017707SAndroid Build Coastguard Worker:OkJHome
71*68017707SAndroid Build Coastguard Workerif exist "%JAVA_HOME%\bin\java.exe" goto init
72*68017707SAndroid Build Coastguard Worker
73*68017707SAndroid Build Coastguard Workerecho.
74*68017707SAndroid Build Coastguard Workerecho Error: JAVA_HOME is set to an invalid directory. >&2
75*68017707SAndroid Build Coastguard Workerecho JAVA_HOME = "%JAVA_HOME%" >&2
76*68017707SAndroid Build Coastguard Workerecho Please set the JAVA_HOME variable in your environment to match the >&2
77*68017707SAndroid Build Coastguard Workerecho location of your Java installation. >&2
78*68017707SAndroid Build Coastguard Workerecho.
79*68017707SAndroid Build Coastguard Workergoto error
80*68017707SAndroid Build Coastguard Worker
81*68017707SAndroid Build Coastguard Worker@REM ==== END VALIDATION ====
82*68017707SAndroid Build Coastguard Worker
83*68017707SAndroid Build Coastguard Worker:init
84*68017707SAndroid Build Coastguard Worker
85*68017707SAndroid Build Coastguard Worker@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
86*68017707SAndroid Build Coastguard Worker@REM Fallback to current working directory if not found.
87*68017707SAndroid Build Coastguard Worker
88*68017707SAndroid Build Coastguard Workerset MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
89*68017707SAndroid Build Coastguard WorkerIF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
90*68017707SAndroid Build Coastguard Worker
91*68017707SAndroid Build Coastguard Workerset EXEC_DIR=%CD%
92*68017707SAndroid Build Coastguard Workerset WDIR=%EXEC_DIR%
93*68017707SAndroid Build Coastguard Worker:findBaseDir
94*68017707SAndroid Build Coastguard WorkerIF EXIST "%WDIR%"\.mvn goto baseDirFound
95*68017707SAndroid Build Coastguard Workercd ..
96*68017707SAndroid Build Coastguard WorkerIF "%WDIR%"=="%CD%" goto baseDirNotFound
97*68017707SAndroid Build Coastguard Workerset WDIR=%CD%
98*68017707SAndroid Build Coastguard Workergoto findBaseDir
99*68017707SAndroid Build Coastguard Worker
100*68017707SAndroid Build Coastguard Worker:baseDirFound
101*68017707SAndroid Build Coastguard Workerset MAVEN_PROJECTBASEDIR=%WDIR%
102*68017707SAndroid Build Coastguard Workercd "%EXEC_DIR%"
103*68017707SAndroid Build Coastguard Workergoto endDetectBaseDir
104*68017707SAndroid Build Coastguard Worker
105*68017707SAndroid Build Coastguard Worker:baseDirNotFound
106*68017707SAndroid Build Coastguard Workerset MAVEN_PROJECTBASEDIR=%EXEC_DIR%
107*68017707SAndroid Build Coastguard Workercd "%EXEC_DIR%"
108*68017707SAndroid Build Coastguard Worker
109*68017707SAndroid Build Coastguard Worker:endDetectBaseDir
110*68017707SAndroid Build Coastguard Worker
111*68017707SAndroid Build Coastguard WorkerIF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
112*68017707SAndroid Build Coastguard Worker
113*68017707SAndroid Build Coastguard Worker@setlocal EnableExtensions EnableDelayedExpansion
114*68017707SAndroid Build Coastguard Workerfor /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
115*68017707SAndroid Build Coastguard Worker@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
116*68017707SAndroid Build Coastguard Worker
117*68017707SAndroid Build Coastguard Worker:endReadAdditionalConfig
118*68017707SAndroid Build Coastguard Worker
119*68017707SAndroid Build Coastguard WorkerSET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
120*68017707SAndroid Build Coastguard Worker
121*68017707SAndroid Build Coastguard Workerset WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
122*68017707SAndroid Build Coastguard Workerset WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
123*68017707SAndroid Build Coastguard Worker
124*68017707SAndroid Build Coastguard Worker%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
125*68017707SAndroid Build Coastguard Workerif ERRORLEVEL 1 goto error
126*68017707SAndroid Build Coastguard Workergoto end
127*68017707SAndroid Build Coastguard Worker
128*68017707SAndroid Build Coastguard Worker:error
129*68017707SAndroid Build Coastguard Workerset ERROR_CODE=1
130*68017707SAndroid Build Coastguard Worker
131*68017707SAndroid Build Coastguard Worker:end
132*68017707SAndroid Build Coastguard Worker@endlocal & set ERROR_CODE=%ERROR_CODE%
133*68017707SAndroid Build Coastguard Worker
134*68017707SAndroid Build Coastguard Workerif not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
135*68017707SAndroid Build Coastguard Worker@REM check for post script, once with legacy .bat ending and once with .cmd ending
136*68017707SAndroid Build Coastguard Workerif exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
137*68017707SAndroid Build Coastguard Workerif exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
138*68017707SAndroid Build Coastguard Worker:skipRcPost
139*68017707SAndroid Build Coastguard Worker
140*68017707SAndroid Build Coastguard Worker@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
141*68017707SAndroid Build Coastguard Workerif "%MAVEN_BATCH_PAUSE%" == "on" pause
142*68017707SAndroid Build Coastguard Worker
143*68017707SAndroid Build Coastguard Workerif "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
144*68017707SAndroid Build Coastguard Worker
145*68017707SAndroid Build Coastguard Workerexit /B %ERROR_CODE%
146