|
1 | 1 | #!/bin/sh
|
2 | 2 |
|
3 | 3 | #
|
4 |
| -# Copyright © 2015-2021 the original authors. |
5 |
| -# |
6 |
| -# Licensed under the Apache License, Version 2.0 (the "License"); |
7 |
| -# you may not use this file except in compliance with the License. |
8 |
| -# You may obtain a copy of the License at |
9 |
| -# |
10 |
| -# https://www.apache.org/licenses/LICENSE-2.0 |
11 |
| -# |
12 |
| -# Unless required by applicable law or agreed to in writing, software |
13 |
| -# distributed under the License is distributed on an "AS IS" BASIS, |
14 |
| -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
15 |
| -# See the License for the specific language governing permissions and |
16 |
| -# limitations under the License. |
| 4 | +# Copyright (c) 2023 Oleg Yukhnevich. Use of this source code is governed by the Apache 2.0 license. |
17 | 5 | #
|
18 | 6 |
|
19 | 7 | ##############################################################################
|
|
83 | 71 | # This is normally unused
|
84 | 72 | # shellcheck disable=SC2034
|
85 | 73 | APP_BASE_NAME=${0##*/}
|
86 |
| -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit |
87 |
| - |
88 |
| -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. |
89 |
| -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 "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit |
90 | 76 |
|
91 | 77 | # Use the maximum available, or set MAX_FD != -1 to use that value.
|
92 | 78 | MAX_FD=maximum
|
@@ -133,26 +119,29 @@ location of your Java installation."
|
133 | 119 | fi
|
134 | 120 | else
|
135 | 121 | JAVACMD=java
|
136 |
| - 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. |
137 | 125 |
|
138 | 126 | Please set the JAVA_HOME variable in your environment to match the
|
139 | 127 | location of your Java installation."
|
| 128 | + fi |
140 | 129 | fi
|
141 | 130 |
|
142 | 131 | # Increase the maximum file descriptors if we can.
|
143 | 132 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
144 | 133 | case $MAX_FD in #(
|
145 | 134 | max*)
|
146 | 135 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
147 |
| - # shellcheck disable=SC3045 |
| 136 | + # shellcheck disable=SC3045 |
148 | 137 | MAX_FD=$( ulimit -H -n ) ||
|
149 | 138 | warn "Could not query maximum file descriptor limit"
|
150 | 139 | esac
|
151 | 140 | case $MAX_FD in #(
|
152 | 141 | '' | soft) :;; #(
|
153 | 142 | *)
|
154 | 143 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
155 |
| - # shellcheck disable=SC3045 |
| 144 | + # shellcheck disable=SC3045 |
156 | 145 | ulimit -n "$MAX_FD" ||
|
157 | 146 | warn "Could not set maximum file descriptor limit to $MAX_FD"
|
158 | 147 | esac
|
@@ -197,6 +186,10 @@ if "$cygwin" || "$msys" ; then
|
197 | 186 | done
|
198 | 187 | fi
|
199 | 188 |
|
| 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 | + |
200 | 193 | # Collect all arguments for the java command;
|
201 | 194 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
202 | 195 | # shell script including quotes and variable substitutions, so put them in
|
|
0 commit comments