1- @ if " %DEBUG% " == " " @ echo off
1+ @ rem
2+ @ rem Copyright 2015 the original author or authors.
3+ @ rem
4+ @ rem Licensed under the Apache License, Version 2.0 (the "License");
5+ @ rem you may not use this file except in compliance with the License.
6+ @ rem You may obtain a copy of the License at
7+ @ rem
8+ @ rem https://www.apache.org/licenses/LICENSE-2.0
9+ @ rem
10+ @ rem Unless required by applicable law or agreed to in writing, software
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.
13+ @ rem See the License for the specific language governing permissions and
14+ @ rem limitations under the License.
15+ @ rem
16+
17+ @ if " %DEBUG% " == " " @ echo off
218@ rem ##########################################################################
319@ rem
420@ rem Gradle startup script for Windows
824@ rem Set local scope for the variables with windows NT shell
925if " %OS% " == " Windows_NT" setlocal
1026
11- @ rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12- set DEFAULT_JVM_OPTS =
13-
1427set DIRNAME = %~dp0
15- if " %DIRNAME% " == " " set DIRNAME = .
28+ if " %DIRNAME% " == " " set DIRNAME = .
29+ @ rem This is normally unused
1630set APP_BASE_NAME = %~n0
1731set APP_HOME = %DIRNAME%
1832
33+ @ rem Resolve any "." and ".." in APP_HOME to make it shorter.
34+ for %%i in (" %APP_HOME% " ) do set APP_HOME = %%~fi
35+
36+ @ rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
37+ set DEFAULT_JVM_OPTS = " -Xmx64m" " -Xms64m"
38+
1939@ rem Find java.exe
2040if defined JAVA_HOME goto findJavaFromJavaHome
2141
2242set JAVA_EXE = java.exe
2343%JAVA_EXE% -version > NUL 2 >& 1
24- if " %ERRORLEVEL% " == " 0 " goto init
44+ if %ERRORLEVEL% equ 0 goto execute
2545
2646echo .
2747echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -35,7 +55,7 @@ goto fail
3555set JAVA_HOME = %JAVA_HOME:" =%
3656set JAVA_EXE = %JAVA_HOME% /bin/java.exe
3757
38- if exist " %JAVA_EXE% " goto init
58+ if exist " %JAVA_EXE% " goto execute
3959
4060echo .
4161echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@@ -45,44 +65,26 @@ echo location of your Java installation.
4565
4666goto fail
4767
48- :init
49- @ rem Get command-line arguments, handling Windowz variants
50-
51- if not " %OS% " == " Windows_NT" goto win9xME_args
52- if " %@eval[2+2]" == " 4" goto 4NT_args
53-
54- :win9xME_args
55- @ rem Slurp the command line arguments.
56- set CMD_LINE_ARGS =
57- set _SKIP = 2
58-
59- :win9xME_args_slurp
60- if " x%~1 " == " x" goto execute
61-
62- set CMD_LINE_ARGS = %*
63- goto execute
64-
65- :4NT_args
66- @ rem Get arguments from the 4NT Shell from JP Software
67- set CMD_LINE_ARGS = %$
68-
6968:execute
7069@ rem Setup the command line
7170
7271set CLASSPATH = %APP_HOME% \gradle\wrapper\gradle-wrapper.jar
7372
73+
7474@ rem Execute Gradle
75- " %JAVA_EXE% " %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% " -Dorg.gradle.appname=%APP_BASE_NAME% " -classpath " %CLASSPATH% " org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
75+ " %JAVA_EXE% " %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% " -Dorg.gradle.appname=%APP_BASE_NAME% " -classpath " %CLASSPATH% " org.gradle.wrapper.GradleWrapperMain %*
7676
7777:end
7878@ rem End local scope for the variables with windows NT shell
79- if " %ERRORLEVEL% " == " 0 " goto mainEnd
79+ if %ERRORLEVEL% equ 0 goto mainEnd
8080
8181:fail
8282rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
8383rem the _cmd.exe /c_ return code!
84- if not " " == " %GRADLE_EXIT_CONSOLE% " exit 1
85- exit /b 1
84+ set EXIT_CODE = %ERRORLEVEL%
85+ if %EXIT_CODE% equ 0 set EXIT_CODE = 1
86+ if not " " == " %GRADLE_EXIT_CONSOLE% " exit %EXIT_CODE%
87+ exit /b %EXIT_CODE%
8688
8789:mainEnd
8890if " %OS% " == " Windows_NT" endlocal
0 commit comments