Sin descripción

gradlew 5.8KB

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