1515# See the License for the specific language governing permissions and
1616# limitations under the License.
1717#
18+ # SPDX-License-Identifier: Apache-2.0
19+ #
1820
1921# #############################################################################
2022#
@@ -69,26 +71,25 @@ app_path=$0
6971
7072# Need this for daisy-chained symlinks.
7173while
72- APP_HOME=${app_path% " ${app_path##*/ } " } # leaves a trailing /; empty if no leading path
73- [ -h " $app_path " ]
74+ APP_HOME=${app_path% " ${app_path##*/ } " } # leaves a trailing /; empty if no leading path
75+ [ -h " $app_path " ]
7476do
75- ls=$( ls -ld " $app_path " )
76- link=${ls#* ' -> ' }
77- case $link in # (
78- /* ) app_path=$link ;; # (
79- * ) app_path=$APP_HOME$link ;;
80- 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
8183done
8284
8385# This is normally unused
8486# shellcheck disable=SC2034
8587APP_BASE_NAME=${0##*/ }
8688# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
87- APP_HOME=$( cd -P " ${APP_HOME:- ./ } " > /dev/null && printf ' %s
88- ' " $PWD " ) || exit
89+ APP_HOME=$( cd -P " ${APP_HOME:- ./ } " > /dev/null && printf ' %s\n' " $PWD " ) || exit
8990
9091# Use the maximum available, or set MAX_FD != -1 to use that value.
91- MAX_FD=maximum
92+ MAX_FD=maximum
9293
9394warn () {
9495 echo " $* "
@@ -107,58 +108,58 @@ msys=false
107108darwin=false
108109nonstop=false
109110case " $( uname ) " in # (
110- CYGWIN* ) cygwin=true ;; # (
111- Darwin* ) darwin=true ;; # (
112- MSYS* | MINGW* ) msys=true ;; # (
113- NONSTOP* ) nonstop=true ;;
111+ CYGWIN* ) cygwin=true ;; # (
112+ Darwin* ) darwin=true ;; # (
113+ MSYS* | MINGW* ) msys=true ;; # (
114+ NONSTOP* ) nonstop=true ;;
114115esac
115116
116- CLASSPATH=$APP_HOME /gradle/wrapper/gradle-wrapper.jar
117+ CLASSPATH=$APP_HOME /gradle/wrapper/gradle-wrapper.jar
117118
118119
119120# Determine the Java command to use to start the JVM.
120121if [ -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
122+ if [ -x " $JAVA_HOME /jre/sh/java" ] ; then
123+ # IBM's JDK on AIX uses strange locations for the executables
123124 JAVACMD=$JAVA_HOME /jre/sh/java
124- else
125- JAVACMD=$JAVA_HOME /bin/java
126- fi
127- if [ ! -x " $JAVACMD " ] ; then
125+ else
126+ JAVACMD=$JAVA_HOME /bin/java
127+ fi
128+ if [ ! -x " $JAVACMD " ] ; then
128129 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
131- location of your Java installation."
132- fi
132+ location of your Java installation."
133+ fi
133134else
134- JAVACMD=java
135- if ! command -v java > /dev/null 2>&1
136- then
135+ JAVACMD=java
136+ if ! command -v java > /dev/null 2>&1
137+ then
137138 die " ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
138139
139140Please set the JAVA_HOME variable in your environment to match the
140- location of your Java installation."
141+ location of your Java installation."
142+ fi
141143fi
142- fi
143144
144145# Increase the maximum file descriptors if we can.
145146if ! " $cygwin " && ! " $darwin " && ! " $nonstop " ; then
146- case $MAX_FD in # (
147- max* )
148- # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
149- # shellcheck disable=SC2039,SC3045
150- MAX_FD=$( ulimit -H -n ) ||
151- warn " Could not query maximum file descriptor limit"
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- esac
161- fi
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
162+ fi
162163
163164# Collect all arguments for the java command, stacking in reverse order:
164165# * args from the command line
@@ -170,17 +171,17 @@ esac
170171
171172# For Cygwin or MSYS, switch paths to Windows format before running java
172173if " $cygwin " || " $msys " ; then
173- APP_HOME=$( cygpath --path --mixed " $APP_HOME " )
174- CLASSPATH=$( cygpath --path --mixed " $CLASSPATH " )
174+ APP_HOME=$( cygpath --path --mixed " $APP_HOME " )
175+ CLASSPATH=$( cygpath --path --mixed " $CLASSPATH " )
175176
176- JAVACMD=$( cygpath --unix " $JAVACMD " )
177+ JAVACMD=$( cygpath --unix " $JAVACMD " )
177178
178- # Now convert the arguments - kludge to limit ourselves to /bin/sh
179- for arg do
180- if
181- case $arg in # (
182- -* ) false ;; # don't mess with options #(
183- /?* ) t=${arg#/ } t=/${t%%/* } # looks like a POSIX filepath
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
184185 [ -e " $t " ] ;; # (
185186 * ) false ;;
186187 esac
204205DEFAULT_JVM_OPTS=' "-Xmx64m" "-Xms64m"'
205206
206207# Collect all arguments for the java command:
207- # * 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,
208209# and any embedded shellness will be escaped.
209210# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
210211# treated as '${Hostname}' itself on the command line.
0 commit comments