gradlew.bat
changeset 104 d21949038794
parent 1 831cffa9c991
equal deleted inserted replaced
103:592df763693f 104:d21949038794
    11 @rem distributed under the License is distributed on an "AS IS" BASIS,
    11 @rem distributed under the License is distributed on an "AS IS" BASIS,
    12 @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12 @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13 @rem See the License for the specific language governing permissions and
    13 @rem See the License for the specific language governing permissions and
    14 @rem limitations under the License.
    14 @rem limitations under the License.
    15 @rem
    15 @rem
       
    16 @rem SPDX-License-Identifier: Apache-2.0
       
    17 @rem
    16 
    18 
    17 @if "%DEBUG%" == "" @echo off
    19 @if "%DEBUG%"=="" @echo off
    18 @rem ##########################################################################
    20 @rem ##########################################################################
    19 @rem
    21 @rem
    20 @rem  Gradle startup script for Windows
    22 @rem  Gradle startup script for Windows
    21 @rem
    23 @rem
    22 @rem ##########################################################################
    24 @rem ##########################################################################
    23 
    25 
    24 @rem Set local scope for the variables with windows NT shell
    26 @rem Set local scope for the variables, and ensure extensions are enabled
    25 if "%OS%"=="Windows_NT" setlocal
    27 setlocal EnableExtensions
    26 
    28 
    27 set DIRNAME=%~dp0
    29 set DIRNAME=%~dp0
    28 if "%DIRNAME%" == "" set DIRNAME=.
    30 if "%DIRNAME%"=="" set DIRNAME=.
       
    31 @rem This is normally unused
    29 set APP_BASE_NAME=%~n0
    32 set APP_BASE_NAME=%~n0
    30 set APP_HOME=%DIRNAME%
    33 set APP_HOME=%DIRNAME%
       
    34 
       
    35 @rem Resolve any "." and ".." in APP_HOME to make it shorter.
       
    36 for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
    31 
    37 
    32 @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
    38 @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
    33 set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
    39 set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
    34 
    40 
    35 @rem Find java.exe
    41 @rem Find java.exe
    36 if defined JAVA_HOME goto findJavaFromJavaHome
    42 if defined JAVA_HOME goto findJavaFromJavaHome
    37 
    43 
    38 set JAVA_EXE=java.exe
    44 set JAVA_EXE=java.exe
    39 %JAVA_EXE% -version >NUL 2>&1
    45 %JAVA_EXE% -version >NUL 2>&1
    40 if "%ERRORLEVEL%" == "0" goto init
    46 if %ERRORLEVEL% equ 0 goto execute
    41 
    47 
    42 echo.
    48 echo. 1>&2
    43 echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
    49 echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
    44 echo.
    50 echo. 1>&2
    45 echo Please set the JAVA_HOME variable in your environment to match the
    51 echo Please set the JAVA_HOME variable in your environment to match the 1>&2
    46 echo location of your Java installation.
    52 echo location of your Java installation. 1>&2
    47 
    53 
    48 goto fail
    54 "%COMSPEC%" /c exit 1
    49 
    55 
    50 :findJavaFromJavaHome
    56 :findJavaFromJavaHome
    51 set JAVA_HOME=%JAVA_HOME:"=%
    57 set JAVA_HOME=%JAVA_HOME:"=%
    52 set JAVA_EXE=%JAVA_HOME%/bin/java.exe
    58 set JAVA_EXE=%JAVA_HOME%/bin/java.exe
    53 
    59 
    54 if exist "%JAVA_EXE%" goto init
    60 if exist "%JAVA_EXE%" goto execute
    55 
    61 
    56 echo.
    62 echo. 1>&2
    57 echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
    63 echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
    58 echo.
    64 echo. 1>&2
    59 echo Please set the JAVA_HOME variable in your environment to match the
    65 echo Please set the JAVA_HOME variable in your environment to match the 1>&2
    60 echo location of your Java installation.
    66 echo location of your Java installation. 1>&2
    61 
    67 
    62 goto fail
    68 "%COMSPEC%" /c exit 1
    63 
       
    64 :init
       
    65 @rem Get command-line arguments, handling Windows variants
       
    66 
       
    67 if not "%OS%" == "Windows_NT" goto win9xME_args
       
    68 
       
    69 :win9xME_args
       
    70 @rem Slurp the command line arguments.
       
    71 set CMD_LINE_ARGS=
       
    72 set _SKIP=2
       
    73 
       
    74 :win9xME_args_slurp
       
    75 if "x%~1" == "x" goto execute
       
    76 
       
    77 set CMD_LINE_ARGS=%*
       
    78 
    69 
    79 :execute
    70 :execute
    80 @rem Setup the command line
    71 @rem Setup the command line
    81 
    72 
    82 set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
    73 
    83 
    74 
    84 @rem Execute Gradle
    75 @rem Execute Gradle
    85 "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
    76 @rem endlocal doesn't take effect until after the line is parsed and variables are expanded
       
    77 @rem which allows us to clear the local environment before executing the java command
       
    78 endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel
    86 
    79 
    87 :end
    80 :exitWithErrorLevel
    88 @rem End local scope for the variables with windows NT shell
    81 @rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts
    89 if "%ERRORLEVEL%"=="0" goto mainEnd
    82 "%COMSPEC%" /c exit %ERRORLEVEL%
    90 
       
    91 :fail
       
    92 rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
       
    93 rem the _cmd.exe /c_ return code!
       
    94 if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
       
    95 exit /b 1
       
    96 
       
    97 :mainEnd
       
    98 if "%OS%"=="Windows_NT" endlocal
       
    99 
       
   100 :omega