@ -1,16 +1,16 @@
#!/bin/bash
#!/bin/bash
##############################################################################
##############################################################################
## ##
##
## Gradle wrapper script for UN*X ##
## Gradle start up script for UN*X
## ##
##
##############################################################################
##############################################################################
# Uncomment those lines to set JVM options. GRADLE_OPTS and JAVA_OPTS can be used together.
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
# GRADLE_OPTS="$GRADLE_OPTS -Xmx512m"
DEFAULT_JVM_OPTS=""
# JAVA_OPTS="$JAVA_OPTS -Xmx512m"
GRADLE_APP_NAME=Gradle
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
MAX_FD="maximum"
@ -42,54 +42,51 @@ case "`uname`" in
;;
;;
esac
esac
# Attempt to set JAVA_HOME if it's not already set.
if [ -z "$JAVA_HOME" ] ; then
if $darwin ; then
[ -z "$JAVA_HOME" -a -d "/Library/Java/Home" ] && export JAVA_HOME="/Library/Java/Home"
[ -z "$JAVA_HOME" -a -d "/System/Library/Frameworks/JavaVM.framework/Home" ] && export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Home"
else
javaExecutable="`which javac`"
[ -z "$javaExecutable" -o "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ] && die "JAVA_HOME not set and cannot find javac to deduce location, please set JAVA_HOME."
# readlink(1) is not available as standard on Solaris 10.
readLink=`which readlink`
[ `expr "$readLink" : '\([^ ]*\)'` = "no" ] && die "JAVA_HOME not set and readlink not available, please set JAVA_HOME."
javaExecutable="`readlink -f \"$javaExecutable\"`"
javaHome="`dirname \"$javaExecutable\"`"
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
export JAVA_HOME="$javaHome"
fi
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched.
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
if $cygwin ; then
[ -n "$JAVACMD" ] && JAVACMD=`cygpath --unix "$JAVACMD"`
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
fi
STARTER_MAIN_CLASS=org.gradle.wrapper.GradleWrapperMain
# Attempt to set APP_HOME
CLASSPATH=`dirname "$0"`/gradle/wrapper/gradle-wrapper.jar
# Resolve links: $0 may be a link
WRAPPER_PROPERTIES=`dirname "$0"`/gradle/wrapper/gradle-wrapper.properties
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/"
APP_HOME="`pwd -P`"
cd "$SAVED"
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
# Determine the Java command to use to start the JVM.
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
JAVACMD="$JAVA_HOME/jre/sh/java"
else
else
JAVACMD="$JAVA_HOME/bin/java"
JAVACMD="$JAVA_HOME/bin/java"
fi
fi
else
if [ ! -x "$JAVACMD" ] ; then
JAVACMD="java"
fi
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
location of your Java installation."
fi
fi
if [ -z "$JAVA_HOME" ] ; then
else
warn "JAVA_HOME environment variable is not set"
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
# Increase the maximum file descriptors if we can.
@ -108,15 +105,14 @@ if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
fi
fi
fi
fi
# For Darwin, add GRADLE_APP_NAME to the JAVA_OPTS as -Xdock:name
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
if $darwin; then
JAVA_OPTS="$JAVA_OPTS -Xdock:name=$GRADLE_APP_NAME"
JAVA_OPTS="$JAVA_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
# we may also want to set -Xdock:image
fi
fi
# For Cygwin, switch paths to Windows format before running java
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
if $cygwin ; then
JAVA_HOME=`cygpath --path --mixed "$JAVA _HOME"`
APP_HOME=`cygpath --path --mixed "$APP _HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
# We build the pattern for arguments to be converted via cygpath
# We build the pattern for arguments to be converted via cygpath
@ -158,11 +154,11 @@ if $cygwin ; then
esac
esac
fi
fi
GRADLE_APP_BASE_NAME=`basename "$0"`
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" $JAVA_OPTS $GRADLE_OPTS \
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
-classpath "$CLASSPATH" \
-Dorg.gradle.appname="$GRADLE_APP_BASE_NAME" \
-Dorg.gradle.wrapper.properties="$WRAPPER_PROPERTIES" \
$STARTER_MAIN_CLASS \
"$@"