1
1
#! /bin/sh
2
2
3
3
#
4
- # Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
4
+ # Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
5
5
#
6
6
7
7
# #############################################################################
43
43
# Darwin, MinGW, and NonStop.
44
44
#
45
45
# (3) This script is generated from the Groovy template
46
- # https://github.com/gradle/gradle/blob/master/subprojects/ plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
46
+ # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/ plugins-application /src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
47
47
# within the Gradle project.
48
48
#
49
49
# You can find Gradle at https://github.com/gradle/gradle/.
68
68
esac
69
69
done
70
70
71
- APP_HOME=$( cd " ${APP_HOME:- ./ } " && pwd -P ) || exit
72
-
73
- APP_NAME=" Gradle"
71
+ # This is normally unused
72
+ # shellcheck disable=SC2034
74
73
APP_BASE_NAME=${0##*/ }
75
-
76
- # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
77
- DEFAULT_JVM_OPTS=' "-Xmx64m" "-Xms64m"'
74
+ # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
75
+ APP_HOME=$( cd -P " ${APP_HOME:- ./ } " > /dev/null && printf ' %s\n' " $PWD " ) || exit
78
76
79
77
# Use the maximum available, or set MAX_FD != -1 to use that value.
80
78
MAX_FD=maximum
@@ -102,7 +100,7 @@ case "$( uname )" in #(
102
100
NONSTOP* ) nonstop=true ;;
103
101
esac
104
102
105
- CLASSPATH=$APP_HOME /gradle/wrapper/gradle-wrapper.jar
103
+ CLASSPATH=" \\\"\\\" "
106
104
107
105
108
106
# Determine the Java command to use to start the JVM.
@@ -121,22 +119,29 @@ location of your Java installation."
121
119
fi
122
120
else
123
121
JAVACMD=java
124
- which java > /dev/null 2>&1 || die " ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
122
+ if ! command -v java > /dev/null 2>&1
123
+ then
124
+ die " ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
125
125
126
126
Please set the JAVA_HOME variable in your environment to match the
127
127
location of your Java installation."
128
+ fi
128
129
fi
129
130
130
131
# Increase the maximum file descriptors if we can.
131
132
if ! " $cygwin " && ! " $darwin " && ! " $nonstop " ; then
132
133
case $MAX_FD in # (
133
134
max* )
135
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
136
+ # shellcheck disable=SC2039,SC3045
134
137
MAX_FD=$( ulimit -H -n ) ||
135
138
warn " Could not query maximum file descriptor limit"
136
139
esac
137
140
case $MAX_FD in # (
138
141
' ' | soft) : ;; # (
139
142
* )
143
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
144
+ # shellcheck disable=SC2039,SC3045
140
145
ulimit -n " $MAX_FD " ||
141
146
warn " Could not set maximum file descriptor limit to $MAX_FD "
142
147
esac
@@ -181,18 +186,28 @@ if "$cygwin" || "$msys" ; then
181
186
done
182
187
fi
183
188
184
- # Collect all arguments for the java command;
185
- # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
186
- # shell script including quotes and variable substitutions, so put them in
187
- # double quotes to make sure that they get re-expanded; and
188
- # * put everything else in single quotes, so that it's not re-expanded.
189
+
190
+ # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
191
+ DEFAULT_JVM_OPTS=' "-Xmx64m" "-Xms64m"'
192
+
193
+ # Collect all arguments for the java command:
194
+ # * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
195
+ # and any embedded shellness will be escaped.
196
+ # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
197
+ # treated as '${Hostname}' itself on the command line.
189
198
190
199
set -- \
191
200
" -Dorg.gradle.appname=$APP_BASE_NAME " \
192
201
-classpath " $CLASSPATH " \
193
- org. gradle. wrapper.GradleWrapperMain \
202
+ -jar " $APP_HOME / gradle/ wrapper/gradle-wrapper.jar " \
194
203
" $@ "
195
204
205
+ # Stop when "xargs" is not available.
206
+ if ! command -v xargs > /dev/null 2>&1
207
+ then
208
+ die " xargs is not available"
209
+ fi
210
+
196
211
# Use "xargs" to parse quoted args.
197
212
#
198
213
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
0 commit comments