1#!/usr/bin/env sh 2 3# Metalava modification start ------------------------------------------------ 4SCRIPT_PATH="$(cd $(dirname $0) && pwd -P)" 5if [ -n "$OUT_DIR" ] ; then 6 mkdir -p "$OUT_DIR" 7 OUT_DIR="$(cd $OUT_DIR && pwd -P)" 8else 9 CHECKOUT_ROOT="$(cd $SCRIPT_PATH/../.. && pwd -P)" 10 export OUT_DIR="$CHECKOUT_ROOT/out" 11fi 12# Metalava modification end--------------------------------------------------- 13 14############################################################################## 15## 16## Gradle start up script for UN*X 17## 18############################################################################## 19 20# Attempt to set APP_HOME 21# Resolve links: $0 may be a link 22PRG="$0" 23# Need this for relative symlinks. 24while [ -h "$PRG" ] ; do 25 ls=`ls -ld "$PRG"` 26 link=`expr "$ls" : '.*-> \(.*\)$'` 27 if expr "$link" : '/.*' > /dev/null; then 28 PRG="$link" 29 else 30 PRG=`dirname "$PRG"`"/$link" 31 fi 32done 33SAVED="`pwd`" 34cd "`dirname \"$PRG\"`/" >/dev/null 35APP_HOME="`pwd -P`" 36cd "$SAVED" >/dev/null 37 38APP_NAME="Gradle" 39APP_BASE_NAME=`basename "$0"` 40 41# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 42DEFAULT_JVM_OPTS="" 43 44# Use the maximum available, or set MAX_FD != -1 to use that value. 45MAX_FD="maximum" 46 47warn () { 48 echo "$*" 49} 50 51die () { 52 echo 53 echo "$*" 54 echo 55 exit 1 56} 57 58# OS specific support (must be 'true' or 'false'). 59cygwin=false 60msys=false 61darwin=false 62nonstop=false 63case "`uname`" in 64 CYGWIN* ) 65 cygwin=true 66 ;; 67 Darwin* ) 68 darwin=true 69 ;; 70 MINGW* ) 71 msys=true 72 ;; 73 NONSTOP* ) 74 nonstop=true 75 ;; 76esac 77 78CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 79 80# --------------------- start of metalava changes ------------------------ 81if [ $darwin == "true" ]; then 82 plat="darwin" 83else 84 plat="linux" 85fi 86export JAVA_HOME="$APP_HOME/../../prebuilts/jdk/jdk17/$plat-x86" 87# --------------------- end of metalava changes ------------------------ 88 89# Determine the Java command to use to start the JVM. 90if [ -n "$JAVA_HOME" ] ; then 91 if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 92 # IBM's JDK on AIX uses strange locations for the executables 93 JAVACMD="$JAVA_HOME/jre/sh/java" 94 else 95 JAVACMD="$JAVA_HOME/bin/java" 96 fi 97 if [ ! -x "$JAVACMD" ] ; then 98 die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 99 100Please set the JAVA_HOME variable in your environment to match the 101location of your Java installation." 102 fi 103else 104 JAVACMD="java" 105 which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 106 107Please set the JAVA_HOME variable in your environment to match the 108location of your Java installation." 109fi 110 111# Increase the maximum file descriptors if we can. 112if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 113 MAX_FD_LIMIT=`ulimit -H -n` 114 if [ $? -eq 0 ] ; then 115 if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 116 MAX_FD="$MAX_FD_LIMIT" 117 fi 118 ulimit -n $MAX_FD 119 if [ $? -ne 0 ] ; then 120 warn "Could not set maximum file descriptor limit: $MAX_FD" 121 fi 122 else 123 warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 124 fi 125fi 126 127# For Darwin, add options to specify how the application appears in the dock 128if $darwin; then 129 GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 130fi 131 132# For Cygwin, switch paths to Windows format before running java 133if $cygwin ; then 134 APP_HOME=`cygpath --path --mixed "$APP_HOME"` 135 CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 136 JAVACMD=`cygpath --unix "$JAVACMD"` 137 138 # We build the pattern for arguments to be converted via cygpath 139 ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 140 SEP="" 141 for dir in $ROOTDIRSRAW ; do 142 ROOTDIRS="$ROOTDIRS$SEP$dir" 143 SEP="|" 144 done 145 OURCYGPATTERN="(^($ROOTDIRS))" 146 # Add a user-defined pattern to the cygpath arguments 147 if [ "$GRADLE_CYGPATTERN" != "" ] ; then 148 OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 149 fi 150 # Now convert the arguments - kludge to limit ourselves to /bin/sh 151 i=0 152 for arg in "$@" ; do 153 CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 154 CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 155 156 if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 157 eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 158 else 159 eval `echo args$i`="\"$arg\"" 160 fi 161 i=$((i+1)) 162 done 163 case $i in 164 (0) set -- ;; 165 (1) set -- "$args0" ;; 166 (2) set -- "$args0" "$args1" ;; 167 (3) set -- "$args0" "$args1" "$args2" ;; 168 (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 169 (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 170 (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 171 (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 172 (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 173 (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 174 esac 175fi 176 177# Escape application args 178save () { 179 for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 180 echo " " 181} 182APP_ARGS=$(save "$@") 183 184# Collect all arguments for the java command, following the shell quoting and substitution rules 185eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 186 187# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 188if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 189 cd "$(dirname "$0")" 190fi 191 192exec "$JAVACMD" "$@" 193