15
15
# See the License for the specific language governing permissions and
16
16
# limitations under the License.
17
17
#
18
+ # SPDX-License-Identifier: Apache-2.0
19
+ #
18
20
19
21
# #############################################################################
20
22
#
@@ -69,26 +71,25 @@ app_path=$0
69
71
70
72
# Need this for daisy-chained symlinks.
71
73
while
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 " ]
74
76
do
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
81
83
done
82
84
83
85
# This is normally unused
84
86
# shellcheck disable=SC2034
85
87
APP_BASE_NAME=${0##*/ }
86
88
# 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
89
90
90
91
# Use the maximum available, or set MAX_FD != -1 to use that value.
91
- MAX_FD=maximum
92
+ MAX_FD=maximum
92
93
93
94
warn () {
94
95
echo " $* "
@@ -107,58 +108,58 @@ msys=false
107
108
darwin=false
108
109
nonstop=false
109
110
case " $( 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 ;;
114
115
esac
115
116
116
- CLASSPATH=$APP_HOME /gradle/wrapper/gradle-wrapper.jar
117
+ CLASSPATH=$APP_HOME /gradle/wrapper/gradle-wrapper.jar
117
118
118
119
119
120
# Determine the Java command to use to start the JVM.
120
121
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
122
+ if [ -x " $JAVA_HOME /jre/sh/java" ] ; then
123
+ # IBM's JDK on AIX uses strange locations for the executables
123
124
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
128
129
die " ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
129
130
130
131
Please 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
133
134
else
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
137
138
die " ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
138
139
139
140
Please 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
141
143
fi
142
- fi
143
144
144
145
# Increase the maximum file descriptors if we can.
145
146
if ! " $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
162
163
163
164
# Collect all arguments for the java command, stacking in reverse order:
164
165
# * args from the command line
@@ -170,17 +171,17 @@ esac
170
171
171
172
# For Cygwin or MSYS, switch paths to Windows format before running java
172
173
if " $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 " )
175
176
176
- JAVACMD=$( cygpath --unix " $JAVACMD " )
177
+ JAVACMD=$( cygpath --unix " $JAVACMD " )
177
178
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
184
185
[ -e " $t " ] ;; # (
185
186
* ) false ;;
186
187
esac
204
205
DEFAULT_JVM_OPTS=' "-Xmx64m" "-Xms64m"'
205
206
206
207
# 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,
208
209
# and any embedded shellness will be escaped.
209
210
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
210
211
# treated as '${Hostname}' itself on the command line.
0 commit comments