| 39 | | # Attempt to set JAVA_HOME if it's not already set. |
| 40 | | if [ -z "$JAVA_HOME" ] ; then |
| 41 | | if $darwin ; then |
| 42 | | [ -z "$JAVA_HOME" -a -d "/Library/Java/Home" ] && export JAVA_HOME="/Library/Java/Home" |
| 43 | | [ -z "$JAVA_HOME" -a -d "/System/Library/Frameworks/JavaVM.framework/Home" ] && export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Home" |
| | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. |
| | 46 | if $cygwin ; then |
| | 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` |
| | 48 | fi |
| | 49 | |
| | 50 | # Attempt to set APP_HOME |
| | 51 | # Resolve links: $0 may be a link |
| | 52 | PRG="$0" |
| | 53 | # Need this for relative symlinks. |
| | 54 | while [ -h "$PRG" ] ; do |
| | 55 | ls=`ls -ld "$PRG"` |
| | 56 | link=`expr "$ls" : '.*-> \(.*\)$'` |
| | 57 | if expr "$link" : '/.*' > /dev/null; then |
| | 58 | PRG="$link" |
| 45 | | javaExecutable="`which javac`" |
| 46 | | [ -z "$javaExecutable" -o "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ] && die "JAVA_HOME not set and cannot find javac to deduce location, please set JAVA_HOME." |
| 47 | | # readlink(1) is not available as standard on Solaris 10. |
| 48 | | readLink=`which readlink` |
| 49 | | [ `expr "$readLink" : '\([^ ]*\)'` = "no" ] && die "JAVA_HOME not set and readlink not available, please set JAVA_HOME." |
| 50 | | javaExecutable="`readlink -f \"$javaExecutable\"`" |
| 51 | | javaHome="`dirname \"$javaExecutable\"`" |
| 52 | | javaHome=`expr "$javaHome" : '\(.*\)/bin'` |
| 53 | | export JAVA_HOME="$javaHome" |
| | 60 | PRG=`dirname "$PRG"`"/$link" |
| | 61 | fi |
| | 62 | done |
| | 63 | SAVED="`pwd`" |
| | 64 | cd "`dirname \"$PRG\"`/" |
| | 65 | APP_HOME="`pwd -P`" |
| | 66 | cd "$SAVED" |
| | 67 | |
| | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar |
| | 69 | |
| | 70 | # Determine the Java command to use to start the JVM. |
| | 71 | if [ -n "$JAVA_HOME" ] ; then |
| | 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then |
| | 73 | # IBM's JDK on AIX uses strange locations for the executables |
| | 74 | JAVACMD="$JAVA_HOME/jre/sh/java" |
| | 75 | else |
| | 76 | JAVACMD="$JAVA_HOME/bin/java" |
| | 77 | fi |
| | 78 | if [ ! -x "$JAVACMD" ] ; then |
| | 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME |
| | 80 | |
| | 81 | Please set the JAVA_HOME variable in your environment to match the |
| | 82 | location of your Java installation." |
| | 83 | fi |
| | 84 | else |
| | 85 | JAVACMD="java" |
| | 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. |
| | 87 | |
| | 88 | Please set the JAVA_HOME variable in your environment to match the |
| | 89 | location of your Java installation." |
| | 90 | fi |
| | 91 | |
| | 92 | # Increase the maximum file descriptors if we can. |
| | 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then |
| | 94 | MAX_FD_LIMIT=`ulimit -H -n` |
| | 95 | if [ $? -eq 0 ] ; then |
| | 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then |
| | 97 | MAX_FD="$MAX_FD_LIMIT" |
| | 98 | fi |
| | 99 | ulimit -n $MAX_FD |
| | 100 | if [ $? -ne 0 ] ; then |
| | 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" |
| | 102 | fi |
| | 103 | else |
| | 104 | warn "Could not query businessSystem maximum file descriptor limit: $MAX_FD_LIMIT" |
| 57 | | # For Cygwin, ensure paths are in UNIX format before anything is touched. |
| 58 | | if $cygwin ; then |
| 59 | | [ -n "$JAVACMD" ] && JAVACMD=`cygpath --unix "$JAVACMD"` |
| 60 | | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` |
| 61 | | fi |
| 62 | | |
| 63 | | STARTER_MAIN_CLASS=org.gradle.wrapper.GradleWrapperMain |
| 64 | | CLASSPATH=`dirname "$0"`/wrapper/gradle-wrapper.jar |
| 65 | | WRAPPER_PROPERTIES=`dirname "$0"`/wrapper/gradle-wrapper.properties |
| 66 | | # Determine the Java command to use to start the JVM. |
| 67 | | if [ -z "$JAVACMD" ] ; then |
| 68 | | if [ -n "$JAVA_HOME" ] ; then |
| 69 | | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then |
| 70 | | # IBM's JDK on AIX uses strange locations for the executables |
| 71 | | JAVACMD="$JAVA_HOME/jre/sh/java" |
| 72 | | else |
| 73 | | JAVACMD="$JAVA_HOME/bin/java" |
| 74 | | fi |
| 75 | | else |
| 76 | | JAVACMD="java" |
| 77 | | fi |
| 78 | | fi |
| 79 | | if [ ! -x "$JAVACMD" ] ; then |
| 80 | | die "JAVA_HOME is not defined correctly, can not execute: $JAVACMD" |
| 81 | | fi |
| 82 | | if [ -z "$JAVA_HOME" ] ; then |
| 83 | | warn "JAVA_HOME environment variable is not set" |
| 84 | | fi |
| 85 | | |
| 86 | | # For Darwin, add GRADLE_APP_NAME to the JAVA_OPTS as -Xdock:name |
| | 108 | # For Darwin, add APP_NAME to the JAVA_OPTS as -Xdock:name |
| 136 | | "$JAVACMD" $JAVA_OPTS $GRADLE_OPTS \ |
| 137 | | -classpath "$CLASSPATH" \ |
| 138 | | -Dorg.gradle.wrapper.properties="$WRAPPER_PROPERTIES" \ |
| 139 | | $STARTER_MAIN_CLASS \ |
| 140 | | "$@" |
| | 158 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules |
| | 159 | function splitJvmOpts() { |
| | 160 | JVM_OPTS=("$@") |
| | 161 | } |
| | 162 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS |
| | 163 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" |
| | 164 | |
| | 165 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" |