@@ -71,94 +71,94 @@ app_path=$0
7171
7272# Need this for daisy-chained symlinks.
7373while
74- APP_HOME=${app_path% " ${app_path##*/ } " } # leaves a trailing /; empty if no leading path
75- [ -h " $app_path " ]
74+ APP_HOME=${app_path% " ${app_path##*/ } " } # leaves a trailing /; empty if no leading path
75+ [ -h " $app_path " ]
7676do
77- ls=$( ls -ld " $app_path " )
78- link=${ls#* ' -> ' }
79- case $link in # (
80- /* ) app_path=$link ;; # (
81- * ) app_path=$APP_HOME$link ;;
82- esac
77+ ls=$( ls -ld " $app_path " )
78+ link=${ls#* ' -> ' }
79+ case $link in # (
80+ /* ) app_path=$link ;; # (
81+ * ) app_path=$APP_HOME$link ;;
82+ esac
8383done
8484
8585# This is normally unused
8686# shellcheck disable=SC2034
8787APP_BASE_NAME=${0##*/ }
8888# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
89- APP_HOME=$( cd -P " ${APP_HOME:- ./ } " > /dev/null && printf ' %s\n' " $PWD " ) || exit
89+ APP_HOME=$( cd -P " ${APP_HOME:- ./ } " > /dev/null && printf ' %s\n' " $PWD " ) || exit
9090
9191# Use the maximum available, or set MAX_FD != -1 to use that value.
9292MAX_FD=maximum
9393
94- warn () {
95- echo " $* "
94+ warn () {
95+ echo " $* "
9696} >&2
9797
98- die () {
99- echo
100- echo " $* "
101- echo
102- exit 1
98+ die () {
99+ echo
100+ echo " $* "
101+ echo
102+ exit 1
103103} >&2
104104
105105# OS specific support (must be 'true' or 'false').
106106cygwin=false
107107msys=false
108108darwin=false
109109nonstop=false
110- case " $( uname ) " in # (
111- CYGWIN* ) cygwin=true ;; # (
112- Darwin* ) darwin=true ;; # (
113- MSYS* | MINGW* ) msys=true ;; # (
114- NONSTOP* ) nonstop=true ;;
110+ case " $( uname) " in # (
111+ CYGWIN* ) cygwin=true ;; # (
112+ Darwin* ) darwin=true ;; # (
113+ MSYS* | MINGW* ) msys=true ;; # (
114+ NONSTOP* ) nonstop=true ;;
115115esac
116116
117117CLASSPATH=" \\\"\\\" "
118118
119-
120119# Determine the Java command to use to start the JVM.
121- if [ -n " $JAVA_HOME " ] ; then
122- if [ -x " $JAVA_HOME /jre/sh/java" ] ; then
123- # IBM's JDK on AIX uses strange locations for the executables
124- JAVACMD=$JAVA_HOME /jre/sh/java
125- else
126- JAVACMD=$JAVA_HOME /bin/java
127- fi
128- if [ ! -x " $JAVACMD " ] ; then
129- die " ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
120+ if [ -n " $JAVA_HOME " ]; then
121+ if [ -x " $JAVA_HOME /jre/sh/java" ]; then
122+ # IBM's JDK on AIX uses strange locations for the executables
123+ JAVACMD=$JAVA_HOME /jre/sh/java
124+ else
125+ JAVACMD=$JAVA_HOME /bin/java
126+ fi
127+ if [ ! -x " $JAVACMD " ]; then
128+ die " ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
130129
131130Please set the JAVA_HOME variable in your environment to match the
132131location of your Java installation."
133- fi
132+ fi
134133else
135- JAVACMD=java
136- if ! command -v java > /dev/null 2>&1
137- then
138- die " ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
134+ JAVACMD=java
135+ if ! command -v java > /dev/null 2>&1 ; then
136+ die " ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
139137
140138Please set the JAVA_HOME variable in your environment to match the
141139location of your Java installation."
142- fi
140+ fi
143141fi
144142
145143# Increase the maximum file descriptors if we can.
146- if ! " $cygwin " && ! " $darwin " && ! " $nonstop " ; then
147- case $MAX_FD in # (
148- max* )
149- # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
150- # shellcheck disable=SC2039,SC3045
151- MAX_FD=$( ulimit -H -n ) ||
152- warn " Could not query maximum file descriptor limit"
153- esac
154- case $MAX_FD in # (
155- ' ' | soft) : ;; # (
156- * )
157- # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
158- # shellcheck disable=SC2039,SC3045
159- ulimit -n " $MAX_FD " ||
160- warn " Could not set maximum file descriptor limit to $MAX_FD "
161- esac
144+ if ! " $cygwin " && ! " $darwin " && ! " $nonstop " ; then
145+ case $MAX_FD in # (
146+ max* )
147+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
148+ # shellcheck disable=SC2039,SC3045
149+ MAX_FD=$( ulimit -H -n) ||
150+ warn " Could not query maximum file descriptor limit"
151+ ;;
152+ esac
153+ case $MAX_FD in # (
154+ ' ' | soft) : ;; # (
155+ * )
156+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
157+ # shellcheck disable=SC2039,SC3045
158+ ulimit -n " $MAX_FD " ||
159+ warn " Could not set maximum file descriptor limit to $MAX_FD "
160+ ;;
161+ esac
162162fi
163163
164164# Collect all arguments for the java command, stacking in reverse order:
170170# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
171171
172172# For Cygwin or MSYS, switch paths to Windows format before running java
173- if " $cygwin " || " $msys " ; then
174- APP_HOME=$( cygpath --path --mixed " $APP_HOME " )
175- CLASSPATH=$( cygpath --path --mixed " $CLASSPATH " )
176-
177- JAVACMD=$( cygpath --unix " $JAVACMD " )
178-
179- # Now convert the arguments - kludge to limit ourselves to /bin/sh
180- for arg do
181- if
182- case $arg in # (
183- -* ) false ;; # don't mess with options #(
184- /?* ) t=${arg#/ } t=/${t%%/* } # looks like a POSIX filepath
185- [ -e " $t " ] ;; # (
186- * ) false ;;
187- esac
188- then
189- arg=$( cygpath --path --ignore --mixed " $arg " )
190- fi
191- # Roll the args list around exactly as many times as the number of
192- # args, so each arg winds up back in the position where it started, but
193- # possibly modified.
194- #
195- # NB: a `for` loop captures its iteration list before it begins, so
196- # changing the positional parameters here affects neither the number of
197- # iterations, nor the values presented in `arg`.
198- shift # remove old arg
199- set -- " $@ " " $arg " # push replacement arg
200- done
173+ if " $cygwin " || " $msys " ; then
174+ APP_HOME=$( cygpath --path --mixed " $APP_HOME " )
175+ CLASSPATH=$( cygpath --path --mixed " $CLASSPATH " )
176+
177+ JAVACMD=$( cygpath --unix " $JAVACMD " )
178+
179+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
180+ for arg; do
181+ if
182+ case $arg in # (
183+ -* ) false ;; # don't mess with options #(
184+ /?* )
185+ t=${arg#/ } t=/${t%%/* } # looks like a POSIX filepath
186+ [ -e " $t " ]
187+ ;; # (
188+ * ) false ;;
189+ esac
190+ then
191+ arg=$( cygpath --path --ignore --mixed " $arg " )
192+ fi
193+ # Roll the args list around exactly as many times as the number of
194+ # args, so each arg winds up back in the position where it started, but
195+ # possibly modified.
196+ #
197+ # NB: a `for` loop captures its iteration list before it begins, so
198+ # changing the positional parameters here affects neither the number of
199+ # iterations, nor the values presented in `arg`.
200+ shift # remove old arg
201+ set -- " $@ " " $arg " # push replacement arg
202+ done
201203fi
202204
203-
204205# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
205206DEFAULT_JVM_OPTS=' "-Xmx64m" "-Xms64m"'
206207
@@ -211,15 +212,14 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
211212# treated as '${Hostname}' itself on the command line.
212213
213214set -- \
214- " -Dorg.gradle.appname=$APP_BASE_NAME " \
215- -classpath " $CLASSPATH " \
216- -jar " $APP_HOME /gradle/wrapper/gradle-wrapper.jar" \
217- " $@ "
215+ " -Dorg.gradle.appname=$APP_BASE_NAME " \
216+ -classpath " $CLASSPATH " \
217+ -jar " $APP_HOME /gradle/wrapper/gradle-wrapper.jar" \
218+ " $@ "
218219
219220# Stop when "xargs" is not available.
220- if ! command -v xargs > /dev/null 2>&1
221- then
222- die " xargs is not available"
221+ if ! command -v xargs > /dev/null 2>&1 ; then
222+ die " xargs is not available"
223223fi
224224
225225# Use "xargs" to parse quoted args.
242242#
243243
244244eval " set -- $(
245- printf ' %s\n' " $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS " |
246- xargs -n1 |
247- sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
248- tr ' \n' ' '
249- ) " ' "$@"'
245+ printf ' %s\n' " $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS " |
246+ xargs -n1 |
247+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
248+ tr ' \n' ' '
249+ ) " ' "$@"'
250250
251251exec " $JAVACMD " " $@ "
0 commit comments