universe@147: #!/usr/bin/env sh universe@147: universe@147: # universe@147: # Copyright 2015 the original author or authors. universe@147: # universe@147: # Licensed under the Apache License, Version 2.0 (the "License"); universe@147: # you may not use this file except in compliance with the License. universe@147: # You may obtain a copy of the License at universe@147: # universe@147: # https://www.apache.org/licenses/LICENSE-2.0 universe@147: # universe@147: # Unless required by applicable law or agreed to in writing, software universe@147: # distributed under the License is distributed on an "AS IS" BASIS, universe@147: # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. universe@147: # See the License for the specific language governing permissions and universe@147: # limitations under the License. universe@147: # universe@147: universe@147: ############################################################################## universe@147: ## universe@147: ## Gradle start up script for UN*X universe@147: ## universe@147: ############################################################################## universe@147: universe@147: # Attempt to set APP_HOME universe@147: # Resolve links: $0 may be a link universe@147: PRG="$0" universe@147: # Need this for relative symlinks. universe@147: while [ -h "$PRG" ] ; do universe@147: ls=`ls -ld "$PRG"` universe@147: link=`expr "$ls" : '.*-> \(.*\)$'` universe@147: if expr "$link" : '/.*' > /dev/null; then universe@147: PRG="$link" universe@147: else universe@147: PRG=`dirname "$PRG"`"/$link" universe@147: fi universe@147: done universe@147: SAVED="`pwd`" universe@147: cd "`dirname \"$PRG\"`/" >/dev/null universe@147: APP_HOME="`pwd -P`" universe@147: cd "$SAVED" >/dev/null universe@147: universe@147: APP_NAME="Gradle" universe@147: APP_BASE_NAME=`basename "$0"` universe@147: universe@147: # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. universe@147: DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' universe@147: universe@147: # Use the maximum available, or set MAX_FD != -1 to use that value. universe@147: MAX_FD="maximum" universe@147: universe@147: warn () { universe@147: echo "$*" universe@147: } universe@147: universe@147: die () { universe@147: echo universe@147: echo "$*" universe@147: echo universe@147: exit 1 universe@147: } universe@147: universe@147: # OS specific support (must be 'true' or 'false'). universe@147: cygwin=false universe@147: msys=false universe@147: darwin=false universe@147: nonstop=false universe@147: case "`uname`" in universe@147: CYGWIN* ) universe@147: cygwin=true universe@147: ;; universe@147: Darwin* ) universe@147: darwin=true universe@147: ;; universe@147: MINGW* ) universe@147: msys=true universe@147: ;; universe@147: NONSTOP* ) universe@147: nonstop=true universe@147: ;; universe@147: esac universe@147: universe@147: CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar universe@147: universe@147: # Determine the Java command to use to start the JVM. universe@147: if [ -n "$JAVA_HOME" ] ; then universe@147: if [ -x "$JAVA_HOME/jre/sh/java" ] ; then universe@147: # IBM's JDK on AIX uses strange locations for the executables universe@147: JAVACMD="$JAVA_HOME/jre/sh/java" universe@147: else universe@147: JAVACMD="$JAVA_HOME/bin/java" universe@147: fi universe@147: if [ ! -x "$JAVACMD" ] ; then universe@147: die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME universe@147: universe@147: Please set the JAVA_HOME variable in your environment to match the universe@147: location of your Java installation." universe@147: fi universe@147: else universe@147: JAVACMD="java" universe@147: which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. universe@147: universe@147: Please set the JAVA_HOME variable in your environment to match the universe@147: location of your Java installation." universe@147: fi universe@147: universe@147: # Increase the maximum file descriptors if we can. universe@147: if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then universe@147: MAX_FD_LIMIT=`ulimit -H -n` universe@147: if [ $? -eq 0 ] ; then universe@147: if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then universe@147: MAX_FD="$MAX_FD_LIMIT" universe@147: fi universe@147: ulimit -n $MAX_FD universe@147: if [ $? -ne 0 ] ; then universe@147: warn "Could not set maximum file descriptor limit: $MAX_FD" universe@147: fi universe@147: else universe@147: warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" universe@147: fi universe@147: fi universe@147: universe@147: # For Darwin, add options to specify how the application appears in the dock universe@147: if $darwin; then universe@147: GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" universe@147: fi universe@147: universe@147: # For Cygwin or MSYS, switch paths to Windows format before running java universe@147: if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then universe@147: APP_HOME=`cygpath --path --mixed "$APP_HOME"` universe@147: CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` universe@147: JAVACMD=`cygpath --unix "$JAVACMD"` universe@147: universe@147: # We build the pattern for arguments to be converted via cygpath universe@147: ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` universe@147: SEP="" universe@147: for dir in $ROOTDIRSRAW ; do universe@147: ROOTDIRS="$ROOTDIRS$SEP$dir" universe@147: SEP="|" universe@147: done universe@147: OURCYGPATTERN="(^($ROOTDIRS))" universe@147: # Add a user-defined pattern to the cygpath arguments universe@147: if [ "$GRADLE_CYGPATTERN" != "" ] ; then universe@147: OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" universe@147: fi universe@147: # Now convert the arguments - kludge to limit ourselves to /bin/sh universe@147: i=0 universe@147: for arg in "$@" ; do universe@147: CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` universe@147: CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option universe@147: universe@147: if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition universe@147: eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` universe@147: else universe@147: eval `echo args$i`="\"$arg\"" universe@147: fi universe@147: i=`expr $i + 1` universe@147: done universe@147: case $i in universe@147: 0) set -- ;; universe@147: 1) set -- "$args0" ;; universe@147: 2) set -- "$args0" "$args1" ;; universe@147: 3) set -- "$args0" "$args1" "$args2" ;; universe@147: 4) set -- "$args0" "$args1" "$args2" "$args3" ;; universe@147: 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; universe@147: 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; universe@147: 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; universe@147: 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; universe@147: 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; universe@147: esac universe@147: fi universe@147: universe@147: # Escape application args universe@147: save () { universe@147: for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done universe@147: echo " " universe@147: } universe@147: APP_ARGS=`save "$@"` universe@147: universe@147: # Collect all arguments for the java command, following the shell quoting and substitution rules universe@147: eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" universe@147: universe@147: exec "$JAVACMD" "$@"