forked from dropbox/dropbox-sdk-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun
executable file
·71 lines (62 loc) · 1.65 KB
/
run
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#! /bin/bash
# ------------------------------------------------------------------
# A script to run the example programs.
#
# Usage: ./run <example-name>
#
# For example: ./run web-file-browser
# ------------------------------------------------------------------
set -e
die() {
for line in "$@"; do
echo "$line" > /dev/stderr
done
exit 1
}
# Locate the script file. Cross symlinks if necessary.
loc="$0"
while [ -h "$loc" ]; do
ls=`ls -ld "$loc"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
loc="$link" # Absolute link
else
loc="`dirname "$loc"`/$link" # Relative link
fi
done
base_dir="$(dirname "$loc")"
if [ $# -eq 0 ]; then
die "" \
"Usage: run <example-name> example-args..." \
"" \
"For example: run upload-file ..." \
""
fi
declare -a project_properties
while [[ $# -gt 0 ]]; do
case "${1}" in
--use-auth-prop)
project_properties+=("-PuseAuthInfoFileProp=true")
;;
--fail-on-error)
project_properties+=("-PfailOnError=true")
;;
--*)
die "unrecognized argument: ${1}"
;;
*)
break
;;
esac
shift
done
example_name="$1" ; shift
example_name="$(echo "$example_name" | sed 's|/*$||')"
# Remove trailing slashes, since shell tab completion will usually add one.
base_dir=`dirname "$loc"`
i=0
for arg in "${@}" ; do
project_properties+=("-Parg${i}=${arg}")
i=$((i+1))
done
exec "${base_dir}/gradlew" -b "${base_dir}/build.gradle" --console plain --quiet ":${example_name}:run" "${project_properties[@]}"