gradlew 5.5 KB

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