1
- #! /usr/bin/env bash
1
+ #! /usr/bin/env sh
2
+
3
+ #
4
+ # Copyright 2015 the original author or 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.
17
+ #
2
18
3
19
# #############################################################################
4
20
# #
5
21
# # Gradle start up script for UN*X
6
22
# #
7
23
# #############################################################################
8
24
9
- # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10
- DEFAULT_JVM_OPTS=" "
25
+ # Attempt to set APP_HOME
26
+ # Resolve links: $0 may be a link
27
+ PRG=" $0 "
28
+ # Need this for relative symlinks.
29
+ while [ -h " $PRG " ] ; do
30
+ ls=` ls -ld " $PRG " `
31
+ link=` expr " $ls " : ' .*-> \(.*\)$' `
32
+ if expr " $link " : ' /.*' > /dev/null; then
33
+ PRG=" $link "
34
+ else
35
+ PRG=` dirname " $PRG " ` " /$link "
36
+ fi
37
+ done
38
+ SAVED=" ` pwd` "
39
+ cd " ` dirname \" $PRG \" ` /" > /dev/null
40
+ APP_HOME=" ` pwd -P` "
41
+ cd " $SAVED " > /dev/null
11
42
12
43
APP_NAME=" Gradle"
13
44
APP_BASE_NAME=` basename " $0 " `
14
45
46
+ # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47
+ DEFAULT_JVM_OPTS=' "-Xmx64m" "-Xms64m"'
48
+
15
49
# Use the maximum available, or set MAX_FD != -1 to use that value.
16
50
MAX_FD=" maximum"
17
51
18
- warn ( ) {
52
+ warn () {
19
53
echo " $* "
20
54
}
21
55
22
- die ( ) {
56
+ die () {
23
57
echo
24
58
echo " $* "
25
59
echo
@@ -30,6 +64,7 @@ die ( ) {
30
64
cygwin=false
31
65
msys=false
32
66
darwin=false
67
+ nonstop=false
33
68
case " ` uname` " in
34
69
CYGWIN* )
35
70
cygwin=true
@@ -40,26 +75,11 @@ case "`uname`" in
40
75
MINGW* )
41
76
msys=true
42
77
;;
78
+ NONSTOP* )
79
+ nonstop=true
80
+ ;;
43
81
esac
44
82
45
- # Attempt to set APP_HOME
46
- # Resolve links: $0 may be a link
47
- PRG=" $0 "
48
- # Need this for relative symlinks.
49
- while [ -h " $PRG " ] ; do
50
- ls=` ls -ld " $PRG " `
51
- link=` expr " $ls " : ' .*-> \(.*\)$' `
52
- if expr " $link " : ' /.*' > /dev/null; then
53
- PRG=" $link "
54
- else
55
- PRG=` dirname " $PRG " ` " /$link "
56
- fi
57
- done
58
- SAVED=" ` pwd` "
59
- cd " ` dirname \" $PRG \" ` /" > /dev/null
60
- APP_HOME=" ` pwd -P` "
61
- cd " $SAVED " > /dev/null
62
-
63
83
CLASSPATH=$APP_HOME /gradle/wrapper/gradle-wrapper.jar
64
84
65
85
# Determine the Java command to use to start the JVM.
@@ -85,7 +105,7 @@ location of your Java installation."
85
105
fi
86
106
87
107
# Increase the maximum file descriptors if we can.
88
- if [ " $cygwin " = " false" -a " $darwin " = " false" ] ; then
108
+ if [ " $cygwin " = " false" -a " $darwin " = " false" -a " $nonstop " = " false " ] ; then
89
109
MAX_FD_LIMIT=` ulimit -H -n`
90
110
if [ $? -eq 0 ] ; then
91
111
if [ " $MAX_FD " = " maximum" -o " $MAX_FD " = " max" ] ; then
@@ -105,8 +125,8 @@ if $darwin; then
105
125
GRADLE_OPTS=" $GRADLE_OPTS \" -Xdock:name=$APP_NAME \" \" -Xdock:icon=$APP_HOME /media/gradle.icns\" "
106
126
fi
107
127
108
- # For Cygwin, switch paths to Windows format before running java
109
- if $cygwin ; then
128
+ # For Cygwin or MSYS , switch paths to Windows format before running java
129
+ if [ " $cygwin " = " true " -o " $msys " = " true " ] ; then
110
130
APP_HOME=` cygpath --path --mixed " $APP_HOME " `
111
131
CLASSPATH=` cygpath --path --mixed " $CLASSPATH " `
112
132
JAVACMD=` cygpath --unix " $JAVACMD " `
@@ -134,27 +154,30 @@ if $cygwin ; then
134
154
else
135
155
eval ` echo args$i ` =" \" $arg \" "
136
156
fi
137
- i=$(( i + 1 ))
157
+ i=` expr $i + 1 `
138
158
done
139
159
case $i in
140
- ( 0) set -- ;;
141
- ( 1) set -- " $args0 " ;;
142
- ( 2) set -- " $args0 " " $args1 " ;;
143
- ( 3) set -- " $args0 " " $args1 " " $args2 " ;;
144
- ( 4) set -- " $args0 " " $args1 " " $args2 " " $args3 " ;;
145
- ( 5) set -- " $args0 " " $args1 " " $args2 " " $args3 " " $args4 " ;;
146
- ( 6) set -- " $args0 " " $args1 " " $args2 " " $args3 " " $args4 " " $args5 " ;;
147
- ( 7) set -- " $args0 " " $args1 " " $args2 " " $args3 " " $args4 " " $args5 " " $args6 " ;;
148
- ( 8) set -- " $args0 " " $args1 " " $args2 " " $args3 " " $args4 " " $args5 " " $args6 " " $args7 " ;;
149
- ( 9) set -- " $args0 " " $args1 " " $args2 " " $args3 " " $args4 " " $args5 " " $args6 " " $args7 " " $args8 " ;;
160
+ 0) set -- ;;
161
+ 1) set -- " $args0 " ;;
162
+ 2) set -- " $args0 " " $args1 " ;;
163
+ 3) set -- " $args0 " " $args1 " " $args2 " ;;
164
+ 4) set -- " $args0 " " $args1 " " $args2 " " $args3 " ;;
165
+ 5) set -- " $args0 " " $args1 " " $args2 " " $args3 " " $args4 " ;;
166
+ 6) set -- " $args0 " " $args1 " " $args2 " " $args3 " " $args4 " " $args5 " ;;
167
+ 7) set -- " $args0 " " $args1 " " $args2 " " $args3 " " $args4 " " $args5 " " $args6 " ;;
168
+ 8) set -- " $args0 " " $args1 " " $args2 " " $args3 " " $args4 " " $args5 " " $args6 " " $args7 " ;;
169
+ 9) set -- " $args0 " " $args1 " " $args2 " " $args3 " " $args4 " " $args5 " " $args6 " " $args7 " " $args8 " ;;
150
170
esac
151
171
fi
152
172
153
- # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154
- function splitJvmOpts() {
155
- JVM_OPTS=(" $@ " )
173
+ # Escape application args
174
+ save () {
175
+ for i do printf %s\\ n " $i " | sed " s/'/'\\\\ ''/g;1s/^/'/;\$ s/\$ /' \\\\ /" ; done
176
+ echo " "
156
177
}
157
- eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158
- JVM_OPTS[${# JVM_OPTS[*]} ]=" -Dorg.gradle.appname=$APP_BASE_NAME "
178
+ APP_ARGS=` save " $@ " `
179
+
180
+ # Collect all arguments for the java command, following the shell quoting and substitution rules
181
+ eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS " \" -Dorg.gradle.appname=$APP_BASE_NAME \" " -classpath " \" $CLASSPATH \" " org.gradle.wrapper.GradleWrapperMain " $APP_ARGS "
159
182
160
- exec " $JAVACMD " " ${JVM_OPTS[@]} " -classpath " $CLASSPATH " org.gradle.wrapper.GradleWrapperMain " $ @"
183
+ exec " $JAVACMD " " $@ "
0 commit comments