|
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/. |
|
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 |
@@ -112,7 +114,7 @@ case "$( uname )" in #( |
112 | 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. |
@@ -140,47 +142,6 @@ location of your Java installation." |
140 | 142 | fi |
141 | 143 | fi |
142 | 144 |
|
143 | | -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. |
144 | | -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' |
145 | | - |
146 | | -# LUCENE-9471: workaround for gradle leaving junk temp. files behind. |
147 | | -GRADLE_TEMPDIR="$APP_HOME/.gradle/tmp" |
148 | | -mkdir -p "$GRADLE_TEMPDIR" |
149 | | -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then |
150 | | - GRADLE_TEMPDIR=`cygpath --path --mixed "$GRADLE_TEMPDIR"` |
151 | | -fi |
152 | | -DEFAULT_JVM_OPTS="$DEFAULT_JVM_OPTS \"-Djava.io.tmpdir=$GRADLE_TEMPDIR\"" |
153 | | - |
154 | | -# LUCENE-9266: verify and download the gradle wrapper jar if we don't have one. |
155 | | -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then |
156 | | - APP_HOME=`cygpath --path --mixed "$APP_HOME"` |
157 | | -fi |
158 | | - |
159 | | -GRADLE_WRAPPER_JAR="$APP_HOME/gradle/wrapper/gradle-wrapper.jar" |
160 | | -if [ ! -e "$GRADLE_WRAPPER_JAR" ]; then |
161 | | - "$JAVACMD" $JAVA_OPTS "$APP_HOME/build-tools/build-infra/src/main/java/org/apache/lucene/gradle/WrapperDownloader.java" "$GRADLE_WRAPPER_JAR" |
162 | | - WRAPPER_STATUS=$? |
163 | | - if [ "$WRAPPER_STATUS" -eq 1 ]; then |
164 | | - echo "ERROR: Something went wrong. Make sure you're using Java version of exactly 21." |
165 | | - exit $WRAPPER_STATUS |
166 | | - elif [ "$WRAPPER_STATUS" -ne 0 ]; then |
167 | | - exit $WRAPPER_STATUS |
168 | | - fi |
169 | | -fi |
170 | | - |
171 | | -CLASSPATH=$GRADLE_WRAPPER_JAR |
172 | | - |
173 | | -# START OF LUCENE CUSTOMIZATION |
174 | | -# Generate gradle.properties if they don't exist |
175 | | -if [ ! -e "$APP_HOME/gradle.properties" ]; then |
176 | | - "$JAVACMD" $JAVA_OPTS "$APP_HOME/build-tools/build-infra/src/main/java/org/apache/lucene/gradle/GradlePropertiesGenerator.java" "$APP_HOME/gradle/template.gradle.properties" "$APP_HOME/gradle.properties" |
177 | | - GENERATOR_STATUS=$? |
178 | | - if [ "$GENERATOR_STATUS" -ne 0 ]; then |
179 | | - exit $GENERATOR_STATUS |
180 | | - fi |
181 | | -fi |
182 | | -# END OF LUCENE CUSTOMIZATION |
183 | | - |
184 | 145 | # Increase the maximum file descriptors if we can. |
185 | 146 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then |
186 | 147 | case $MAX_FD in #( |
@@ -239,19 +200,59 @@ if "$cygwin" || "$msys" ; then |
239 | 200 | done |
240 | 201 | fi |
241 | 202 |
|
| 203 | +# START OF LUCENE CUSTOMIZATION |
| 204 | + |
| 205 | +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. |
| 206 | +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' |
| 207 | + |
242 | 208 | # Prevent jgit from forking/searching git.exe |
243 | 209 | export GIT_CONFIG_NOSYSTEM=1 |
244 | 210 |
|
| 211 | +# LUCENE-9471: workaround for gradle leaving junk temp. files behind. |
| 212 | +GRADLE_TEMPDIR="$APP_HOME/.gradle/tmp" |
| 213 | +mkdir -p "$GRADLE_TEMPDIR" |
| 214 | +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then |
| 215 | + GRADLE_TEMPDIR=`cygpath --path --mixed "$GRADLE_TEMPDIR"` |
| 216 | +fi |
| 217 | +DEFAULT_JVM_OPTS="$DEFAULT_JVM_OPTS \"-Djava.io.tmpdir=$GRADLE_TEMPDIR\"" |
| 218 | + |
| 219 | +# LUCENE-9266: verify and download the gradle wrapper jar if we don't have one. |
| 220 | +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then |
| 221 | + APP_HOME=`cygpath --path --mixed "$APP_HOME"` |
| 222 | +fi |
| 223 | + |
| 224 | +GRADLE_WRAPPER_JAR="$APP_HOME/gradle/wrapper/gradle-wrapper.jar" |
| 225 | +if ! ( cd $APP_HOME/gradle/wrapper && sha256sum --status -c ${GRADLE_WRAPPER_JAR}.sha256 ); then |
| 226 | + "$JAVACMD" $JAVA_OPTS "$APP_HOME/build-tools/build-infra/src/main/java/org/apache/lucene/gradle/WrapperDownloader.java" "$GRADLE_WRAPPER_JAR" |
| 227 | + WRAPPER_STATUS=$? |
| 228 | + if [ "$WRAPPER_STATUS" -eq 1 ]; then |
| 229 | + echo "ERROR: Something went wrong. Make sure you're using Java version of exactly 21." |
| 230 | + exit $WRAPPER_STATUS |
| 231 | + elif [ "$WRAPPER_STATUS" -ne 0 ]; then |
| 232 | + exit $WRAPPER_STATUS |
| 233 | + fi |
| 234 | +fi |
| 235 | + |
| 236 | +# Generate gradle.properties if they don't exist |
| 237 | +if [ ! -e "$APP_HOME/gradle.properties" ]; then |
| 238 | + "$JAVACMD" $JAVA_OPTS "$APP_HOME/build-tools/build-infra/src/main/java/org/apache/lucene/gradle/GradlePropertiesGenerator.java" "$APP_HOME/gradle/template.gradle.properties" "$APP_HOME/gradle.properties" |
| 239 | + GENERATOR_STATUS=$? |
| 240 | + if [ "$GENERATOR_STATUS" -ne 0 ]; then |
| 241 | + exit $GENERATOR_STATUS |
| 242 | + fi |
| 243 | +fi |
| 244 | +# END OF LUCENE CUSTOMIZATION |
| 245 | + |
245 | 246 | # Collect all arguments for the java command: |
246 | | -# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, |
| 247 | +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, |
247 | 248 | # and any embedded shellness will be escaped. |
248 | 249 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be |
249 | 250 | # treated as '${Hostname}' itself on the command line. |
250 | 251 |
|
251 | 252 | set -- \ |
252 | 253 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ |
253 | 254 | -classpath "$CLASSPATH" \ |
254 | | - org.gradle.wrapper.GradleWrapperMain \ |
| 255 | + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ |
255 | 256 | "$@" |
256 | 257 |
|
257 | 258 | # Stop when "xargs" is not available. |
|
0 commit comments