您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

gradlew 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. #!/usr/bin/env bash
  2. ##############################################################################
  3. ##
  4. ## Gradle start up script for UN*X
  5. ##
  6. ##############################################################################
  7. # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
  8. DEFAULT_JVM_OPTS=""
  9. APP_NAME="Gradle"
  10. APP_BASE_NAME=`basename "$0"`
  11. # Use the maximum available, or set MAX_FD != -1 to use that value.
  12. MAX_FD="maximum"
  13. warn ( ) {
  14. echo "$*"
  15. }
  16. die ( ) {
  17. echo
  18. echo "$*"
  19. echo
  20. exit 1
  21. }
  22. # OS specific support (must be 'true' or 'false').
  23. cygwin=false
  24. msys=false
  25. darwin=false
  26. case "`uname`" in
  27. CYGWIN* )
  28. cygwin=true
  29. ;;
  30. Darwin* )
  31. darwin=true
  32. ;;
  33. MINGW* )
  34. msys=true
  35. ;;
  36. esac
  37. # For Cygwin, ensure paths are in UNIX format before anything is touched.
  38. if $cygwin ; then
  39. [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
  40. fi
  41. # Attempt to set APP_HOME
  42. # Resolve links: $0 may be a link
  43. PRG="$0"
  44. # Need this for relative symlinks.
  45. while [ -h "$PRG" ] ; do
  46. ls=`ls -ld "$PRG"`
  47. link=`expr "$ls" : '.*-> \(.*\)$'`
  48. if expr "$link" : '/.*' > /dev/null; then
  49. PRG="$link"
  50. else
  51. PRG=`dirname "$PRG"`"/$link"
  52. fi
  53. done
  54. SAVED="`pwd`"
  55. cd "`dirname \"$PRG\"`/" >&-
  56. APP_HOME="`pwd -P`"
  57. cd "$SAVED" >&-
  58. CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
  59. # Determine the Java command to use to start the JVM.
  60. if [ -n "$JAVA_HOME" ] ; then
  61. if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
  62. # IBM's JDK on AIX uses strange locations for the executables
  63. JAVACMD="$JAVA_HOME/jre/sh/java"
  64. else
  65. JAVACMD="$JAVA_HOME/bin/java"
  66. fi
  67. if [ ! -x "$JAVACMD" ] ; then
  68. die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
  69. Please set the JAVA_HOME variable in your environment to match the
  70. location of your Java installation."
  71. fi
  72. else
  73. JAVACMD="java"
  74. which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
  75. Please set the JAVA_HOME variable in your environment to match the
  76. location of your Java installation."
  77. fi
  78. # Increase the maximum file descriptors if we can.
  79. if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
  80. MAX_FD_LIMIT=`ulimit -H -n`
  81. if [ $? -eq 0 ] ; then
  82. if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
  83. MAX_FD="$MAX_FD_LIMIT"
  84. fi
  85. ulimit -n $MAX_FD
  86. if [ $? -ne 0 ] ; then
  87. warn "Could not set maximum file descriptor limit: $MAX_FD"
  88. fi
  89. else
  90. warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
  91. fi
  92. fi
  93. # For Darwin, add options to specify how the application appears in the dock
  94. if $darwin; then
  95. GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
  96. fi
  97. # For Cygwin, switch paths to Windows format before running java
  98. if $cygwin ; then
  99. APP_HOME=`cygpath --path --mixed "$APP_HOME"`
  100. CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
  101. # We build the pattern for arguments to be converted via cygpath
  102. ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
  103. SEP=""
  104. for dir in $ROOTDIRSRAW ; do
  105. ROOTDIRS="$ROOTDIRS$SEP$dir"
  106. SEP="|"
  107. done
  108. OURCYGPATTERN="(^($ROOTDIRS))"
  109. # Add a user-defined pattern to the cygpath arguments
  110. if [ "$GRADLE_CYGPATTERN" != "" ] ; then
  111. OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
  112. fi
  113. # Now convert the arguments - kludge to limit ourselves to /bin/sh
  114. i=0
  115. for arg in "$@" ; do
  116. CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
  117. CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
  118. if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
  119. eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
  120. else
  121. eval `echo args$i`="\"$arg\""
  122. fi
  123. i=$((i+1))
  124. done
  125. case $i in
  126. (0) set -- ;;
  127. (1) set -- "$args0" ;;
  128. (2) set -- "$args0" "$args1" ;;
  129. (3) set -- "$args0" "$args1" "$args2" ;;
  130. (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
  131. (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
  132. (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
  133. (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
  134. (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
  135. (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
  136. esac
  137. fi
  138. # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
  139. function splitJvmOpts() {
  140. JVM_OPTS=("$@")
  141. }
  142. eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
  143. JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
  144. exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"