aboutsummaryrefslogtreecommitdiff
path: root/examples/helloworld/gradlew
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2018-01-29 21:00:48 +0100
committerRobert Jaros <rjaros@finn.pl>2018-01-29 21:00:48 +0100
commitb43764a2088912162ed5e8df2f6da7d2598fb1a3 (patch)
treeb252f4864971c4832f4a61904a33b6d70df315fc /examples/helloworld/gradlew
parent95fa69ec901243d2f496a692b2f5d8a61ce5e053 (diff)
downloadkvision-b43764a2088912162ed5e8df2f6da7d2598fb1a3.tar.gz
kvision-b43764a2088912162ed5e8df2f6da7d2598fb1a3.tar.bz2
kvision-b43764a2088912162ed5e8df2f6da7d2598fb1a3.zip
Hello world example
Diffstat (limited to 'examples/helloworld/gradlew')
-rwxr-xr-xexamples/helloworld/gradlew26
1 files changed, 17 insertions, 9 deletions
diff --git a/examples/helloworld/gradlew b/examples/helloworld/gradlew
index 27309d92..cccdd3d5 100755
--- a/examples/helloworld/gradlew
+++ b/examples/helloworld/gradlew
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
##############################################################################
##
@@ -33,11 +33,11 @@ DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
-warn ( ) {
+warn () {
echo "$*"
}
-die ( ) {
+die () {
echo
echo "$*"
echo
@@ -154,11 +154,19 @@ if $cygwin ; then
esac
fi
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+APP_ARGS=$(save "$@")
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+ cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"