|
1 | 1 | #!/bin/sh
|
2 | 2 |
|
3 | 3 | #
|
4 |
| -# Copyright © 2015-2021 the original authors. |
| 4 | +# Copyright © 2015-2021 the original authors. |
5 | 5 | #
|
6 | 6 | # Licensed under the Apache License, Version 2.0 (the "License");
|
7 | 7 | # you may not use this file except in compliance with the License.
|
|
32 | 32 | # Busybox and similar reduced shells will NOT work, because this script
|
33 | 33 | # requires all of these POSIX shell features:
|
34 | 34 | # * functions;
|
35 |
| -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», |
36 |
| -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; |
37 |
| -# * compound commands having a testable exit status, especially «case»; |
38 |
| -# * various built-in commands including «command», «set», and «ulimit». |
| 35 | +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», |
| 36 | +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; |
| 37 | +# * compound commands having a testable exit status, especially «case»; |
| 38 | +# * various built-in commands including «command», «set», and «ulimit». |
39 | 39 | #
|
40 | 40 | # Important for patching:
|
41 | 41 | #
|
|
55 | 55 | # Darwin, MinGW, and NonStop.
|
56 | 56 | #
|
57 | 57 | # (3) This script is generated from the Groovy template
|
58 |
| -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt |
| 58 | +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt |
59 | 59 | # within the Gradle project.
|
60 | 60 | #
|
61 | 61 | # You can find Gradle at https://github.com/gradle/gradle/.
|
|
80 | 80 | esac
|
81 | 81 | done
|
82 | 82 |
|
83 |
| -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit |
84 |
| - |
85 |
| -APP_NAME="Gradle" |
| 83 | +# This is normally unused |
| 84 | +# shellcheck disable=SC2034 |
86 | 85 | APP_BASE_NAME=${0##*/}
|
| 86 | +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit |
87 | 87 |
|
88 | 88 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
89 | 89 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
|
143 | 143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
144 | 144 | case $MAX_FD in #(
|
145 | 145 | max*)
|
| 146 | + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. |
| 147 | + # shellcheck disable=SC3045 |
146 | 148 | MAX_FD=$( ulimit -H -n ) ||
|
147 | 149 | warn "Could not query maximum file descriptor limit"
|
148 | 150 | esac
|
149 | 151 | case $MAX_FD in #(
|
150 | 152 | '' | soft) :;; #(
|
151 | 153 | *)
|
| 154 | + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. |
| 155 | + # shellcheck disable=SC3045 |
152 | 156 | ulimit -n "$MAX_FD" ||
|
153 | 157 | warn "Could not set maximum file descriptor limit to $MAX_FD"
|
154 | 158 | esac
|
@@ -205,6 +209,12 @@ set -- \
|
205 | 209 | org.gradle.wrapper.GradleWrapperMain \
|
206 | 210 | "$@"
|
207 | 211 |
|
| 212 | +# Stop when "xargs" is not available. |
| 213 | +if ! command -v xargs >/dev/null 2>&1 |
| 214 | +then |
| 215 | + die "xargs is not available" |
| 216 | +fi |
| 217 | + |
208 | 218 | # Use "xargs" to parse quoted args.
|
209 | 219 | #
|
210 | 220 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
|
0 commit comments