gradlew 5.3 KB

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