-
Notifications
You must be signed in to change notification settings - Fork 5
/
ask
executable file
·59 lines (46 loc) · 1.5 KB
/
ask
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
#/bin/bash
# Print path
# echo "pwd: `pwd`"
# echo "\$0: $0"
# echo "basename: `basename "$0"`"
# echo "dirname: `dirname "$0"`"
showprogress() {
PROC_ID=$!
delay=0.1
sp="/-\|"
count=0
while kill -0 "$PROC_ID" >/dev/null 2>&1; do
printf "\r[${sp:count++:1}] Building > %s" "$1"
((count==${#sp})) && count=0
sleep $delay
done
printf "\r%s \n" "Build Finished : $1"
}
APP_HOME=`dirname "$0"`
JAR_PATH=$APP_HOME/ask-app/libs/ask.jar
cd "$APP_HOME" >/dev/null
if [ ! -f $JAR_PATH ]; then
./gradlew :ask-app:createjar >/dev/null 2>&1 &
showprogress "Ask Application"
fi
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
CLASSPATH=$APP_HOME/ask-app/libs/ask.jar:$APP_HOME/ask-app/libs/gson-2.7.jar
exec "$JAVACMD" -cp "$CLASSPATH" com.androidstarterkit.Ask "$@"