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
#
55
57
# Darwin, MinGW, and NonStop.
56
58
#
57
59
# (3) This script is generated from the Groovy template
58
- # https://github.com/gradle/gradle/blob/HEAD/subprojects/ plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
60
+ # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/ plugins-application /src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
59
61
# within the Gradle project.
60
62
#
61
63
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -69,35 +71,35 @@ 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 " ${APP_HOME:- ./ } " > /dev/null && pwd -P ) || exit
89
+ APP_HOME=$( cd -P " ${APP_HOME:- ./ } " > /dev/null && printf ' %s\n ' " $PWD " ) || exit
88
90
89
91
# Use the maximum available, or set MAX_FD != -1 to use that value.
90
92
MAX_FD=maximum
91
93
92
94
warn () {
93
- echo " $* "
95
+ echo " $* "
94
96
} >&2
95
97
96
98
die () {
97
- echo
98
- echo " $* "
99
- echo
100
- exit 1
99
+ echo
100
+ echo " $* "
101
+ echo
102
+ exit 1
101
103
} >&2
102
104
103
105
# OS specific support (must be 'true' or 'false').
@@ -106,57 +108,57 @@ msys=false
106
108
darwin=false
107
109
nonstop=false
108
110
case " $( uname ) " in # (
109
- CYGWIN* ) cygwin=true ;; # (
110
- Darwin* ) darwin=true ;; # (
111
- MSYS* | MINGW* ) msys=true ;; # (
112
- NONSTOP* ) nonstop=true ;;
111
+ CYGWIN* ) cygwin=true ;; # (
112
+ Darwin* ) darwin=true ;; # (
113
+ MSYS* | MINGW* ) msys=true ;; # (
114
+ NONSTOP* ) nonstop=true ;;
113
115
esac
114
116
115
- CLASSPATH=$APP_HOME /gradle/wrapper/gradle-wrapper.jar
117
+ CLASSPATH=" \\\"\\\" "
116
118
117
119
118
120
# Determine the Java command to use to start the JVM.
119
121
if [ -n " $JAVA_HOME " ] ; then
120
- if [ -x " $JAVA_HOME /jre/sh/java" ] ; then
121
- # IBM's JDK on AIX uses strange locations for the executables
122
- JAVACMD=$JAVA_HOME /jre/sh/java
123
- else
124
- JAVACMD=$JAVA_HOME /bin/java
125
- fi
126
- if [ ! -x " $JAVACMD " ] ; then
127
- die " ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
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
128
130
129
131
Please set the JAVA_HOME variable in your environment to match the
130
132
location of your Java installation."
131
- fi
133
+ fi
132
134
else
133
- JAVACMD=java
134
- if ! command -v java > /dev/null 2>&1
135
- 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.
137
139
138
140
Please set the JAVA_HOME variable in your environment to match the
139
141
location of your Java installation."
140
- fi
142
+ fi
141
143
fi
142
144
143
145
# Increase the maximum file descriptors if we can.
144
146
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
- esac
152
- case $MAX_FD in # (
153
- ' ' | soft) : ;; # (
154
- * )
155
- # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
156
- # shellcheck disable=SC2039,SC3045
157
- ulimit -n " $MAX_FD " ||
158
- warn " Could not set maximum file descriptor limit to $MAX_FD "
159
- esac
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
160
162
fi
161
163
162
164
# Collect all arguments for the java command, stacking in reverse order:
169
171
170
172
# For Cygwin or MSYS, switch paths to Windows format before running java
171
173
if " $cygwin " || " $msys " ; then
172
- APP_HOME=$( cygpath --path --mixed " $APP_HOME " )
173
- CLASSPATH=$( cygpath --path --mixed " $CLASSPATH " )
174
-
175
- JAVACMD=$( cygpath --unix " $JAVACMD " )
176
-
177
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
178
- for arg do
179
- if
180
- case $arg in # (
181
- -* ) false ;; # don't mess with options #(
182
- /?* ) t=${arg#/ } t=/${t%%/* } # looks like a POSIX filepath
183
- [ -e " $t " ] ;; # (
184
- * ) false ;;
185
- esac
186
- then
187
- arg=$( cygpath --path --ignore --mixed " $arg " )
188
- fi
189
- # Roll the args list around exactly as many times as the number of
190
- # args, so each arg winds up back in the position where it started, but
191
- # possibly modified.
192
- #
193
- # NB: a `for` loop captures its iteration list before it begins, so
194
- # changing the positional parameters here affects neither the number of
195
- # iterations, nor the values presented in `arg`.
196
- shift # remove old arg
197
- set -- " $@ " " $arg " # push replacement arg
198
- done
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
199
201
fi
200
202
201
203
202
204
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
203
205
DEFAULT_JVM_OPTS=' "-Xmx64m" "-Xms64m"'
204
206
205
207
# Collect all arguments for the java command:
206
- # * 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,
207
209
# and any embedded shellness will be escaped.
208
210
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
209
211
# treated as '${Hostname}' itself on the command line.
210
212
211
213
set -- \
212
- " -Dorg.gradle.appname=$APP_BASE_NAME " \
213
- -classpath " $CLASSPATH " \
214
- org. gradle. wrapper.GradleWrapperMain \
215
- " $@ "
214
+ " -Dorg.gradle.appname=$APP_BASE_NAME " \
215
+ -classpath " $CLASSPATH " \
216
+ -jar " $APP_HOME / gradle/ wrapper/gradle-wrapper.jar " \
217
+ " $@ "
216
218
217
219
# Stop when "xargs" is not available.
218
220
if ! command -v xargs > /dev/null 2>&1
219
221
then
220
- die " xargs is not available"
222
+ die " xargs is not available"
221
223
fi
222
224
223
225
# Use "xargs" to parse quoted args.
240
242
#
241
243
242
244
eval " set -- $(
243
- printf ' %s\n' " $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS " |
244
- xargs -n1 |
245
- sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
246
- tr ' \n' ' '
247
- ) " ' "$@"'
245
+ printf ' %s\n' " $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS " |
246
+ xargs -n1 |
247
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
248
+ tr ' \n' ' '
249
+ ) " ' "$@"'
248
250
249
251
exec " $JAVACMD " " $@ "
0 commit comments