Nessuna descrizione

gradlew 4.9KB

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