5555# Darwin, MinGW, and NonStop.
5656#
5757# (3) This script is generated from the Groovy template
58- # https://github.com/gradle/gradle/blob/master /subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
58+ # https://github.com/gradle/gradle/blob/HEAD /subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
5959# within the Gradle project.
6060#
6161# You can find Gradle at https://github.com/gradle/gradle/.
8080 esac
8181done
8282
83- APP_HOME=$( cd " ${APP_HOME:- ./ } " && pwd -P ) || exit
84-
85- APP_NAME=" Gradle"
83+ # This is normally unused
84+ # shellcheck disable=SC2034
8685APP_BASE_NAME=${0##*/ }
87-
88- # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
89- DEFAULT_JVM_OPTS=' "-Xmx64m" "-Xms64m"'
86+ APP_HOME=$( cd " ${APP_HOME:- ./ } " && pwd -P ) || exit
9087
9188# Use the maximum available, or set MAX_FD != -1 to use that value.
9289MAX_FD=maximum
@@ -133,22 +130,29 @@ location of your Java installation."
133130 fi
134131else
135132 JAVACMD=java
136- which java > /dev/null 2>&1 || die " ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
133+ if ! command -v java > /dev/null 2>&1
134+ then
135+ die " ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137136
138137Please set the JAVA_HOME variable in your environment to match the
139138location of your Java installation."
139+ fi
140140fi
141141
142142# Increase the maximum file descriptors if we can.
143143if ! " $cygwin " && ! " $darwin " && ! " $nonstop " ; then
144144 case $MAX_FD in # (
145145 max* )
146+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
147+ # shellcheck disable=SC3045
146148 MAX_FD=$( ulimit -H -n ) ||
147149 warn " Could not query maximum file descriptor limit"
148150 esac
149151 case $MAX_FD in # (
150152 ' ' | soft) : ;; # (
151153 * )
154+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
155+ # shellcheck disable=SC3045
152156 ulimit -n " $MAX_FD " ||
153157 warn " Could not set maximum file descriptor limit to $MAX_FD "
154158 esac
@@ -193,6 +197,10 @@ if "$cygwin" || "$msys" ; then
193197 done
194198fi
195199
200+
201+ # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
202+ DEFAULT_JVM_OPTS=' "-Xmx64m" "-Xms64m"'
203+
196204# Collect all arguments for the java command;
197205# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
198206# shell script including quotes and variable substitutions, so put them in
@@ -205,6 +213,12 @@ set -- \
205213 org.gradle.wrapper.GradleWrapperMain \
206214 " $@ "
207215
216+ # Stop when "xargs" is not available.
217+ if ! command -v xargs > /dev/null 2>&1
218+ then
219+ die " xargs is not available"
220+ fi
221+
208222# Use "xargs" to parse quoted args.
209223#
210224# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
0 commit comments