android-project/gradlew
changeset 11647 5816b27073a4
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/android-project/gradlew	Mon Oct 23 15:23:43 2017 -0700
     1.3 @@ -0,0 +1,160 @@
     1.4 +#!/usr/bin/env bash
     1.5 +
     1.6 +##############################################################################
     1.7 +##
     1.8 +##  Gradle start up script for UN*X
     1.9 +##
    1.10 +##############################################################################
    1.11 +
    1.12 +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
    1.13 +DEFAULT_JVM_OPTS=""
    1.14 +
    1.15 +APP_NAME="Gradle"
    1.16 +APP_BASE_NAME=`basename "$0"`
    1.17 +
    1.18 +# Use the maximum available, or set MAX_FD != -1 to use that value.
    1.19 +MAX_FD="maximum"
    1.20 +
    1.21 +warn ( ) {
    1.22 +    echo "$*"
    1.23 +}
    1.24 +
    1.25 +die ( ) {
    1.26 +    echo
    1.27 +    echo "$*"
    1.28 +    echo
    1.29 +    exit 1
    1.30 +}
    1.31 +
    1.32 +# OS specific support (must be 'true' or 'false').
    1.33 +cygwin=false
    1.34 +msys=false
    1.35 +darwin=false
    1.36 +case "`uname`" in
    1.37 +  CYGWIN* )
    1.38 +    cygwin=true
    1.39 +    ;;
    1.40 +  Darwin* )
    1.41 +    darwin=true
    1.42 +    ;;
    1.43 +  MINGW* )
    1.44 +    msys=true
    1.45 +    ;;
    1.46 +esac
    1.47 +
    1.48 +# Attempt to set APP_HOME
    1.49 +# Resolve links: $0 may be a link
    1.50 +PRG="$0"
    1.51 +# Need this for relative symlinks.
    1.52 +while [ -h "$PRG" ] ; do
    1.53 +    ls=`ls -ld "$PRG"`
    1.54 +    link=`expr "$ls" : '.*-> \(.*\)$'`
    1.55 +    if expr "$link" : '/.*' > /dev/null; then
    1.56 +        PRG="$link"
    1.57 +    else
    1.58 +        PRG=`dirname "$PRG"`"/$link"
    1.59 +    fi
    1.60 +done
    1.61 +SAVED="`pwd`"
    1.62 +cd "`dirname \"$PRG\"`/" >/dev/null
    1.63 +APP_HOME="`pwd -P`"
    1.64 +cd "$SAVED" >/dev/null
    1.65 +
    1.66 +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
    1.67 +
    1.68 +# Determine the Java command to use to start the JVM.
    1.69 +if [ -n "$JAVA_HOME" ] ; then
    1.70 +    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
    1.71 +        # IBM's JDK on AIX uses strange locations for the executables
    1.72 +        JAVACMD="$JAVA_HOME/jre/sh/java"
    1.73 +    else
    1.74 +        JAVACMD="$JAVA_HOME/bin/java"
    1.75 +    fi
    1.76 +    if [ ! -x "$JAVACMD" ] ; then
    1.77 +        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
    1.78 +
    1.79 +Please set the JAVA_HOME variable in your environment to match the
    1.80 +location of your Java installation."
    1.81 +    fi
    1.82 +else
    1.83 +    JAVACMD="java"
    1.84 +    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
    1.85 +
    1.86 +Please set the JAVA_HOME variable in your environment to match the
    1.87 +location of your Java installation."
    1.88 +fi
    1.89 +
    1.90 +# Increase the maximum file descriptors if we can.
    1.91 +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
    1.92 +    MAX_FD_LIMIT=`ulimit -H -n`
    1.93 +    if [ $? -eq 0 ] ; then
    1.94 +        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
    1.95 +            MAX_FD="$MAX_FD_LIMIT"
    1.96 +        fi
    1.97 +        ulimit -n $MAX_FD
    1.98 +        if [ $? -ne 0 ] ; then
    1.99 +            warn "Could not set maximum file descriptor limit: $MAX_FD"
   1.100 +        fi
   1.101 +    else
   1.102 +        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
   1.103 +    fi
   1.104 +fi
   1.105 +
   1.106 +# For Darwin, add options to specify how the application appears in the dock
   1.107 +if $darwin; then
   1.108 +    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
   1.109 +fi
   1.110 +
   1.111 +# For Cygwin, switch paths to Windows format before running java
   1.112 +if $cygwin ; then
   1.113 +    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
   1.114 +    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
   1.115 +    JAVACMD=`cygpath --unix "$JAVACMD"`
   1.116 +
   1.117 +    # We build the pattern for arguments to be converted via cygpath
   1.118 +    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
   1.119 +    SEP=""
   1.120 +    for dir in $ROOTDIRSRAW ; do
   1.121 +        ROOTDIRS="$ROOTDIRS$SEP$dir"
   1.122 +        SEP="|"
   1.123 +    done
   1.124 +    OURCYGPATTERN="(^($ROOTDIRS))"
   1.125 +    # Add a user-defined pattern to the cygpath arguments
   1.126 +    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
   1.127 +        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
   1.128 +    fi
   1.129 +    # Now convert the arguments - kludge to limit ourselves to /bin/sh
   1.130 +    i=0
   1.131 +    for arg in "$@" ; do
   1.132 +        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
   1.133 +        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
   1.134 +
   1.135 +        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
   1.136 +            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
   1.137 +        else
   1.138 +            eval `echo args$i`="\"$arg\""
   1.139 +        fi
   1.140 +        i=$((i+1))
   1.141 +    done
   1.142 +    case $i in
   1.143 +        (0) set -- ;;
   1.144 +        (1) set -- "$args0" ;;
   1.145 +        (2) set -- "$args0" "$args1" ;;
   1.146 +        (3) set -- "$args0" "$args1" "$args2" ;;
   1.147 +        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
   1.148 +        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
   1.149 +        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
   1.150 +        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
   1.151 +        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
   1.152 +        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
   1.153 +    esac
   1.154 +fi
   1.155 +
   1.156 +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
   1.157 +function splitJvmOpts() {
   1.158 +    JVM_OPTS=("$@")
   1.159 +}
   1.160 +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
   1.161 +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
   1.162 +
   1.163 +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"