source: gradlew @ 8e988c39

Last change on this file since 8e988c39 was 646dbff, checked in by str4d <str4d@…>, 3 years ago

Add license details for Gradle wrapper

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