examples-spring-redis-amq
/
gradlew
172 строки · 5.2 Кб
1#!/usr/bin/env sh
2
3##############################################################################
4##
5## Gradle start up script for UN*X
6##
7##############################################################################
8
9# Attempt to set APP_HOME
10# Resolve links: $0 may be a link
11PRG="$0"
12# Need this for relative symlinks.
13while [ -h "$PRG" ] ; do
14ls=`ls -ld "$PRG"`
15link=`expr "$ls" : '.*-> \(.*\)$'`
16if expr "$link" : '/.*' > /dev/null; then
17PRG="$link"
18else
19PRG=`dirname "$PRG"`"/$link"
20fi
21done
22SAVED="`pwd`"
23cd "`dirname \"$PRG\"`/" >/dev/null
24APP_HOME="`pwd -P`"
25cd "$SAVED" >/dev/null
26
27APP_NAME="Gradle"
28APP_BASE_NAME=`basename "$0"`
29
30# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31DEFAULT_JVM_OPTS='"-Xmx64m"'
32
33# Use the maximum available, or set MAX_FD != -1 to use that value.
34MAX_FD="maximum"
35
36warn () {
37echo "$*"
38}
39
40die () {
41echo
42echo "$*"
43echo
44exit 1
45}
46
47# OS specific support (must be 'true' or 'false').
48cygwin=false
49msys=false
50darwin=false
51nonstop=false
52case "`uname`" in
53CYGWIN* )
54cygwin=true
55;;
56Darwin* )
57darwin=true
58;;
59MINGW* )
60msys=true
61;;
62NONSTOP* )
63nonstop=true
64;;
65esac
66
67CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68
69# Determine the Java command to use to start the JVM.
70if [ -n "$JAVA_HOME" ] ; then
71if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72# IBM's JDK on AIX uses strange locations for the executables
73JAVACMD="$JAVA_HOME/jre/sh/java"
74else
75JAVACMD="$JAVA_HOME/bin/java"
76fi
77if [ ! -x "$JAVACMD" ] ; then
78die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79
80Please set the JAVA_HOME variable in your environment to match the
81location of your Java installation."
82fi
83else
84JAVACMD="java"
85which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86
87Please set the JAVA_HOME variable in your environment to match the
88location of your Java installation."
89fi
90
91# Increase the maximum file descriptors if we can.
92if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93MAX_FD_LIMIT=`ulimit -H -n`
94if [ $? -eq 0 ] ; then
95if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96MAX_FD="$MAX_FD_LIMIT"
97fi
98ulimit -n $MAX_FD
99if [ $? -ne 0 ] ; then
100warn "Could not set maximum file descriptor limit: $MAX_FD"
101fi
102else
103warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104fi
105fi
106
107# For Darwin, add options to specify how the application appears in the dock
108if $darwin; then
109GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110fi
111
112# For Cygwin, switch paths to Windows format before running java
113if $cygwin ; then
114APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116JAVACMD=`cygpath --unix "$JAVACMD"`
117
118# We build the pattern for arguments to be converted via cygpath
119ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120SEP=""
121for dir in $ROOTDIRSRAW ; do
122ROOTDIRS="$ROOTDIRS$SEP$dir"
123SEP="|"
124done
125OURCYGPATTERN="(^($ROOTDIRS))"
126# Add a user-defined pattern to the cygpath arguments
127if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129fi
130# Now convert the arguments - kludge to limit ourselves to /bin/sh
131i=0
132for arg in "$@" ; do
133CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135
136if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138else
139eval `echo args$i`="\"$arg\""
140fi
141i=$((i+1))
142done
143case $i in
144(0) set -- ;;
145(1) set -- "$args0" ;;
146(2) set -- "$args0" "$args1" ;;
147(3) set -- "$args0" "$args1" "$args2" ;;
148(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154esac
155fi
156
157# Escape application args
158save () {
159for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160echo " "
161}
162APP_ARGS=$(save "$@")
163
164# Collect all arguments for the java command, following the shell quoting and substitution rules
165eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166
167# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169cd "$(dirname "$0")"
170fi
171
172exec "$JAVACMD" "$@"
173