5555# Darwin, MinGW, and NonStop.
5656#
5757# (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
58+ # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/ plugins-application /src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
5959# within the Gradle project.
6060#
6161# You can find Gradle at https://github.com/gradle/gradle/.
8383# This is normally unused
8484# shellcheck disable=SC2034
8585APP_BASE_NAME=${0##*/ }
86- APP_HOME=$( cd " ${APP_HOME:- ./ } " && pwd -P) || exit
86+ # 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
8788
8889# Use the maximum available, or set MAX_FD != -1 to use that value.
8990MAX_FD=maximum
@@ -114,6 +115,97 @@ esac
114115CLASSPATH=$APP_HOME /gradle/wrapper/gradle-wrapper.jar
115116
116117
118+ # GRADLE JVM WRAPPER START MARKER
119+ BUILD_DIR=" jvm"
120+ JVM_ARCH=$( uname -m)
121+ JVM_TEMP_FILE=$BUILD_DIR /gradle-jvm-temp.tar.gz
122+ if [" $darwin " = " true" ]; then
123+ case $JVM_ARCH in
124+ x86_64)
125+ JVM_URL=https://cache-redirector.jetbrains.com/intellij-jbr/jbr_jcef-21.0.5-osx-x64-b631.28.tar.gz
126+ JVM_TARGET_DIR=$BUILD_DIR /jbr_jcef-21.0.5-osx-x64-b631.28-be8dc8
127+ ;;
128+ arm64)
129+ JVM_URL=https://cache-redirector.jetbrains.com/intellij-jbr/jbr_jcef-21.0.5-osx-aarch64-b631.28.tar.gz
130+ JVM_TARGET_DIR=$BUILD_DIR /jbr_jcef-21.0.5-osx-aarch64-b631.28-f458b6
131+ ;;
132+ * )
133+ die" Unknown architecture$JVM_ARCH "
134+ ;;
135+ esac
136+ elif [" $cygwin " = " true" ]|| [" $msys " = " true" ]; then
137+ JVM_URL=https://cache-redirector.jetbrains.com/intellij-jbr/jbr_jcef-21.0.5-windows-x64-b631.28.tar.gz
138+ JVM_TARGET_DIR=$BUILD_DIR /jbr_jcef-21.0.5-windows-x64-b631.28-eedcdf
139+ else
140+ JVM_ARCH=$( linux$( getconf LONG_BIT) uname -m)
141+ case $JVM_ARCH in
142+ x86_64)
143+ JVM_URL=https://cache-redirector.jetbrains.com/intellij-jbr/jbr_jcef-21.0.5-linux-x64-b631.28.tar.gz
144+ JVM_TARGET_DIR=$BUILD_DIR /jbr_jcef-21.0.5-linux-x64-b631.28-322c17
145+ ;;
146+ aarch64)
147+ JVM_URL=https://cache-redirector.jetbrains.com/intellij-jbr/jbr_jcef-21.0.5-linux-aarch64-b631.28.tar.gz
148+ JVM_TARGET_DIR=$BUILD_DIR /jbr_jcef-21.0.5-linux-aarch64-b631.28-3ac5ea
149+ ;;
150+ * )
151+ die" Unknown architecture$JVM_ARCH "
152+ ;;
153+ esac
154+ fi
155+
156+ set -e
157+
158+ if [-e " $JVM_TARGET_DIR /.flag" ]&& [-n " $( ls" $JVM_TARGET_DIR " ) " ]&& [" x$( cat" $JVM_TARGET_DIR /.flag" ) " = " x${JVM_URL} " ]; then
159+ # Everything is up-to-date in $JVM_TARGET_DIR, do nothing
160+ true
161+ else
162+ echo " Downloading$JVM_URL to$JVM_TEMP_FILE "
163+
164+ rm -f" $JVM_TEMP_FILE "
165+ mkdir -p" $BUILD_DIR "
166+ if command -v curl> /dev/null2>&1 ; then
167+ if [-t 1 ]; then CURL_PROGRESS=" --progress-bar" ; else CURL_PROGRESS=" --silent --show-error" ; fi
168+ # shellcheck disable=SC2086
169+ curl$CURL_PROGRESS -L --output" ${JVM_TEMP_FILE} " " $JVM_URL " 2>&1
170+ elif command -v wget> /dev/null2>&1 ; then
171+ if [-t 1 ]; then WGET_PROGRESS=" " ; else WGET_PROGRESS=" -nv" ; fi
172+ wget$WGET_PROGRESS -O" ${JVM_TEMP_FILE} " " $JVM_URL " 2>&1
173+ else
174+ die" ERROR: Please install wget or curl"
175+ fi
176+
177+ echo " Extracting$JVM_TEMP_FILE to$JVM_TARGET_DIR "
178+ rm -rf" $JVM_TARGET_DIR "
179+ mkdir -p" $JVM_TARGET_DIR "
180+
181+ case " $JVM_URL " in
182+ * " .zip" ) unzip" $JVM_TEMP_FILE " -d" $JVM_TARGET_DIR " ;;
183+ * ) tar -x -f" $JVM_TEMP_FILE " -C" $JVM_TARGET_DIR " ;;
184+ esac
185+
186+ rm -f" $JVM_TEMP_FILE "
187+
188+ echo " $JVM_URL " > " $JVM_TARGET_DIR /.flag"
189+ fi
190+
191+ JAVA_HOME=
192+ for d in " $JVM_TARGET_DIR " " $JVM_TARGET_DIR " /* " $JVM_TARGET_DIR " /Contents/Home" $JVM_TARGET_DIR " /* /Contents/Home; do
193+ if [-e " $d /bin/java" ]; then
194+ JAVA_HOME=" $d "
195+ fi
196+ done
197+
198+ if [' !' -e " $JAVA_HOME /bin/java" ]; then
199+ die" Unable to find bin/java under$JVM_TARGET_DIR "
200+ fi
201+
202+ # Make it available for child processes
203+ export JAVA_HOME
204+
205+ set +e
206+
207+ # GRADLE JVM WRAPPER END MARKER
208+
117209# Determine the Java command to use to start the JVM.
118210if [-n " $JAVA_HOME " ]; then
119211if [-x " $JAVA_HOME /jre/sh/java" ]; then
@@ -130,26 +222,29 @@ location of your Java installation."
130222fi
131223else
132224 JAVACMD=java
133- which java> /dev/null2>&1 || die" ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
225+ if ! command -v java> /dev/null2>&1
226+ then
227+ die" ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
134228
135229Please set the JAVA_HOME variable in your environment to match the
136230location of your Java installation."
231+ fi
137232fi
138233
139234# Increase the maximum file descriptors if we can.
140235if ! " $cygwin " && ! " $darwin " && ! " $nonstop " ; then
141236case $MAX_FD in # (
142237 max* )
143238# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
144- # shellcheck disable=SC3045
239+ # shellcheck disable=SC2039, SC3045
145240 MAX_FD=$( ulimit -H -n) ||
146241 warn" Could not query maximum file descriptor limit"
147242esac
148243case $MAX_FD in # (
149244' ' | soft): ;;# (
150245* )
151246# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
152- # shellcheck disable=SC3045
247+ # shellcheck disable=SC2039, SC3045
153248ulimit -n" $MAX_FD " ||
154249 warn" Could not set maximum file descriptor limit to$MAX_FD "
155250esac
198293# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
199294DEFAULT_JVM_OPTS=' "-Xmx64m" "-Xms64m"'
200295
201- # Collect all arguments for the java command;
202- # *$ DEFAULT_JVM_OPTS,$ JAVA_OPTS, and$GRADLE_OPTS can containfragments of
203- # shell script including quotes andvariable substitutions, so put them in
204- # double quotes to make sure that they get re- expanded; and
205- # * put everything else in single quotes, so that it's not re-expanded .
296+ # Collect all arguments for the java command:
297+ # * DEFAULT_JVM_OPTS, JAVA_OPTS,JAVA_OPTS, andoptsEnvironmentVar are not allowed to containshell fragments,
298+ # andany embedded shellness will be escaped.
299+ # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
300+ # treated as '${Hostname}' itself on the command line .
206301
207302set -- \
208303" -Dorg.gradle.appname=$APP_BASE_NAME " \