Blame client/Android/Studio/gradlew

Packit Service fa4841
#!/usr/bin/env bash
Packit Service fa4841
Packit Service fa4841
##############################################################################
Packit Service fa4841
##
Packit Service fa4841
##  Gradle start up script for UN*X
Packit Service fa4841
##
Packit Service fa4841
##############################################################################
Packit Service fa4841
Packit Service fa4841
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
Packit Service fa4841
DEFAULT_JVM_OPTS=""
Packit Service fa4841
Packit Service fa4841
APP_NAME="Gradle"
Packit Service fa4841
APP_BASE_NAME=`basename "$0"`
Packit Service fa4841
Packit Service fa4841
# Use the maximum available, or set MAX_FD != -1 to use that value.
Packit Service fa4841
MAX_FD="maximum"
Packit Service fa4841
Packit Service fa4841
warn ( ) {
Packit Service fa4841
    echo "$*"
Packit Service fa4841
}
Packit Service fa4841
Packit Service fa4841
die ( ) {
Packit Service fa4841
    echo
Packit Service fa4841
    echo "$*"
Packit Service fa4841
    echo
Packit Service fa4841
    exit 1
Packit Service fa4841
}
Packit Service fa4841
Packit Service fa4841
# OS specific support (must be 'true' or 'false').
Packit Service fa4841
cygwin=false
Packit Service fa4841
msys=false
Packit Service fa4841
darwin=false
Packit Service fa4841
case "`uname`" in
Packit Service fa4841
  CYGWIN* )
Packit Service fa4841
    cygwin=true
Packit Service fa4841
    ;;
Packit Service fa4841
  Darwin* )
Packit Service fa4841
    darwin=true
Packit Service fa4841
    ;;
Packit Service fa4841
  MINGW* )
Packit Service fa4841
    msys=true
Packit Service fa4841
    ;;
Packit Service fa4841
esac
Packit Service fa4841
Packit Service fa4841
# Attempt to set APP_HOME
Packit Service fa4841
# Resolve links: $0 may be a link
Packit Service fa4841
PRG="$0"
Packit Service fa4841
# Need this for relative symlinks.
Packit Service fa4841
while [ -h "$PRG" ] ; do
Packit Service fa4841
    ls=`ls -ld "$PRG"`
Packit Service fa4841
    link=`expr "$ls" : '.*-> \(.*\)$'`
Packit Service fa4841
    if expr "$link" : '/.*' > /dev/null; then
Packit Service fa4841
        PRG="$link"
Packit Service fa4841
    else
Packit Service fa4841
        PRG=`dirname "$PRG"`"/$link"
Packit Service fa4841
    fi
Packit Service fa4841
done
Packit Service fa4841
SAVED="`pwd`"
Packit Service fa4841
cd "`dirname \"$PRG\"`/" >/dev/null
Packit Service fa4841
APP_HOME="`pwd -P`"
Packit Service fa4841
cd "$SAVED" >/dev/null
Packit Service fa4841
Packit Service fa4841
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
Packit Service fa4841
Packit Service fa4841
# Determine the Java command to use to start the JVM.
Packit Service fa4841
if [ -n "$JAVA_HOME" ] ; then
Packit Service fa4841
    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
Packit Service fa4841
        # IBM's JDK on AIX uses strange locations for the executables
Packit Service fa4841
        JAVACMD="$JAVA_HOME/jre/sh/java"
Packit Service fa4841
    else
Packit Service fa4841
        JAVACMD="$JAVA_HOME/bin/java"
Packit Service fa4841
    fi
Packit Service fa4841
    if [ ! -x "$JAVACMD" ] ; then
Packit Service fa4841
        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Packit Service fa4841
Packit Service fa4841
Please set the JAVA_HOME variable in your environment to match the
Packit Service fa4841
location of your Java installation."
Packit Service fa4841
    fi
Packit Service fa4841
else
Packit Service fa4841
    JAVACMD="java"
Packit Service fa4841
    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Packit Service fa4841
Packit Service fa4841
Please set the JAVA_HOME variable in your environment to match the
Packit Service fa4841
location of your Java installation."
Packit Service fa4841
fi
Packit Service fa4841
Packit Service fa4841
# Increase the maximum file descriptors if we can.
Packit Service fa4841
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
Packit Service fa4841
    MAX_FD_LIMIT=`ulimit -H -n`
Packit Service fa4841
    if [ $? -eq 0 ] ; then
Packit Service fa4841
        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
Packit Service fa4841
            MAX_FD="$MAX_FD_LIMIT"
Packit Service fa4841
        fi
Packit Service fa4841
        ulimit -n $MAX_FD
Packit Service fa4841
        if [ $? -ne 0 ] ; then
Packit Service fa4841
            warn "Could not set maximum file descriptor limit: $MAX_FD"
Packit Service fa4841
        fi
Packit Service fa4841
    else
Packit Service fa4841
        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
Packit Service fa4841
    fi
Packit Service fa4841
fi
Packit Service fa4841
Packit Service fa4841
# For Darwin, add options to specify how the application appears in the dock
Packit Service fa4841
if $darwin; then
Packit Service fa4841
    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
Packit Service fa4841
fi
Packit Service fa4841
Packit Service fa4841
# For Cygwin, switch paths to Windows format before running java
Packit Service fa4841
if $cygwin ; then
Packit Service fa4841
    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
Packit Service fa4841
    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
Packit Service fa4841
    JAVACMD=`cygpath --unix "$JAVACMD"`
Packit Service fa4841
Packit Service fa4841
    # We build the pattern for arguments to be converted via cygpath
Packit Service fa4841
    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
Packit Service fa4841
    SEP=""
Packit Service fa4841
    for dir in $ROOTDIRSRAW ; do
Packit Service fa4841
        ROOTDIRS="$ROOTDIRS$SEP$dir"
Packit Service fa4841
        SEP="|"
Packit Service fa4841
    done
Packit Service fa4841
    OURCYGPATTERN="(^($ROOTDIRS))"
Packit Service fa4841
    # Add a user-defined pattern to the cygpath arguments
Packit Service fa4841
    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
Packit Service fa4841
        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
Packit Service fa4841
    fi
Packit Service fa4841
    # Now convert the arguments - kludge to limit ourselves to /bin/sh
Packit Service fa4841
    i=0
Packit Service fa4841
    for arg in "$@" ; do
Packit Service fa4841
        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
Packit Service fa4841
        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
Packit Service fa4841
Packit Service fa4841
        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
Packit Service fa4841
            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
Packit Service fa4841
        else
Packit Service fa4841
            eval `echo args$i`="\"$arg\""
Packit Service fa4841
        fi
Packit Service fa4841
        i=$((i+1))
Packit Service fa4841
    done
Packit Service fa4841
    case $i in
Packit Service fa4841
        (0) set -- ;;
Packit Service fa4841
        (1) set -- "$args0" ;;
Packit Service fa4841
        (2) set -- "$args0" "$args1" ;;
Packit Service fa4841
        (3) set -- "$args0" "$args1" "$args2" ;;
Packit Service fa4841
        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
Packit Service fa4841
        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
Packit Service fa4841
        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
Packit Service fa4841
        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
Packit Service fa4841
        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
Packit Service fa4841
        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
Packit Service fa4841
    esac
Packit Service fa4841
fi
Packit Service fa4841
Packit Service fa4841
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
Packit Service fa4841
function splitJvmOpts() {
Packit Service fa4841
    JVM_OPTS=("$@")
Packit Service fa4841
}
Packit Service fa4841
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
Packit Service fa4841
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
Packit Service fa4841
Packit Service fa4841
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"