Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

173 lines
5.2KB

  1. #!/usr/bin/env sh
  2. ##############################################################################
  3. ##
  4. ## Gradle start up script for UN*X
  5. ##
  6. ##############################################################################
  7. # Attempt to set APP_HOME
  8. # Resolve links: $0 may be a link
  9. PRG="$0"
  10. # Need this for relative symlinks.
  11. while [ -h "$PRG" ] ; do
  12. ls=`ls -ld "$PRG"`
  13. link=`expr "$ls" : '.*-> \(.*\)$'`
  14. if expr "$link" : '/.*' > /dev/null; then
  15. PRG="$link"
  16. else
  17. PRG=`dirname "$PRG"`"/$link"
  18. fi
  19. done
  20. SAVED="`pwd`"
  21. cd "`dirname \"$PRG\"`/" >/dev/null
  22. APP_HOME="`pwd -P`"
  23. cd "$SAVED" >/dev/null
  24. APP_NAME="Gradle"
  25. APP_BASE_NAME=`basename "$0"`
  26. # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
  27. DEFAULT_JVM_OPTS=""
  28. # Use the maximum available, or set MAX_FD != -1 to use that value.
  29. MAX_FD="maximum"
  30. warn () {
  31. echo "$*"
  32. }
  33. die () {
  34. echo
  35. echo "$*"
  36. echo
  37. exit 1
  38. }
  39. # OS specific support (must be 'true' or 'false').
  40. cygwin=false
  41. msys=false
  42. darwin=false
  43. nonstop=false
  44. case "`uname`" in
  45. CYGWIN* )
  46. cygwin=true
  47. ;;
  48. Darwin* )
  49. darwin=true
  50. ;;
  51. MINGW* )
  52. msys=true
  53. ;;
  54. NONSTOP* )
  55. nonstop=true
  56. ;;
  57. esac
  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" -a "$nonstop" = "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. JAVACMD=`cygpath --unix "$JAVACMD"`
  102. # We build the pattern for arguments to be converted via cygpath
  103. ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
  104. SEP=""
  105. for dir in $ROOTDIRSRAW ; do
  106. ROOTDIRS="$ROOTDIRS$SEP$dir"
  107. SEP="|"
  108. done
  109. OURCYGPATTERN="(^($ROOTDIRS))"
  110. # Add a user-defined pattern to the cygpath arguments
  111. if [ "$GRADLE_CYGPATTERN" != "" ] ; then
  112. OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
  113. fi
  114. # Now convert the arguments - kludge to limit ourselves to /bin/sh
  115. i=0
  116. for arg in "$@" ; do
  117. CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
  118. CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
  119. if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
  120. eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
  121. else
  122. eval `echo args$i`="\"$arg\""
  123. fi
  124. i=$((i+1))
  125. done
  126. case $i in
  127. (0) set -- ;;
  128. (1) set -- "$args0" ;;
  129. (2) set -- "$args0" "$args1" ;;
  130. (3) set -- "$args0" "$args1" "$args2" ;;
  131. (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
  132. (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
  133. (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
  134. (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
  135. (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
  136. (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
  137. esac
  138. fi
  139. # Escape application args
  140. save () {
  141. for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
  142. echo " "
  143. }
  144. APP_ARGS=$(save "$@")
  145. # Collect all arguments for the java command, following the shell quoting and substitution rules
  146. eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
  147. # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
  148. if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
  149. cd "$(dirname "$0")"
  150. fi
  151. exec "$JAVACMD" "$@"