@@ -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
117- CLASSPATH=${APP_HOME} /gradle/wrapper/gradle-wrapper.jar
117+ CLASSPATH=$APP_HOME /gradle/wrapper/gradle-wrapper.jar
118+
118119
119120# Determine the Java command to use to start the JVM.
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}
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
129130
130131Please set the JAVA_HOME variable in your environment to match the
131132location of your Java installation."
132- fi
133+ fi
133134else
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.
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.
137139
138140Please set the JAVA_HOME variable in your environment to match the
139141location of your Java installation."
140- fi
142+ fi
141143fi
142144
143145# Increase the maximum file descriptors if we can.
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
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
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- /?* )
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
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
203201fi
204202
203+
205204# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
206205DEFAULT_JVM_OPTS=' "-Xmx64m" "-Xms64m"'
207206
208207# Collect all arguments for the java command:
209- # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
208+ # * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
210209# and any embedded shellness will be escaped.
211210# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
212211# treated as '${Hostname}' itself on the command line.
213212
214213set -- \
215- " -Dorg.gradle.appname=${ APP_BASE_NAME} " \
216- -classpath " ${ CLASSPATH} " \
217- org.gradle.wrapper.GradleWrapperMain \
218- " $@ "
214+ " -Dorg.gradle.appname=$APP_BASE_NAME " \
215+ -classpath " $CLASSPATH " \
216+ org.gradle.wrapper.GradleWrapperMain \
217+ " $@ "
219218
220219# Stop when "xargs" is not available.
221- if ! command -v xargs > /dev/null 2>&1 ; then
222- die " xargs is not available"
220+ if ! command -v xargs > /dev/null 2>&1
221+ 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
251- exec " ${ JAVACMD} " " $@ "
251+ exec " $JAVACMD " " $@ "
0 commit comments