forked from wtchoi/SwiftHand
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh.skeleton
59 lines (48 loc) · 1.46 KB
/
build.sh.skeleton
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
#!/bin/sh
# WARNING: Please assign proper contents and uncomment following four export statements.
#export ADK_ROOT=
#export JAVA_HOME=
#export GUAVA_VERSION=
#export DX_VERSION=
DOLLAR="\$"
declare -a arr=("ADK_ROOT" "JAVA_HOME" "GUAVA_VERSION" "DX_VERSION")
for varname in "${arr[@]}"
do
eval VAR="$DOLLAR$varname"
if [[ -z "$VAR" ]]; then
echo "[build.sh] ERROR: \$$varname unset!"
exit 1;
fi
done
IS="inst.sh"
TS="test.sh"
cd src
mvn package
if (($? > 0)); then
print "[build.sh] Maven build script failed"
exit 2;
fi
cd ..
SWIFT_ROOT=$PWD
#create execution script
FRONT_END_PATH="src/front-end/target/front-end-0.1-jar-with-dependencies.jar"
KEY_PATH="src/front-end/resource/swifthand.keystore"
SHARED_PATH="src/shared/target/shared-0.1.jar"
BACK_END_PATH="src/back-end/target/back-end-0.1-jar-with-dependencies.jar"
echo "[build.sh] Generating inst.sh instrumentation script"
echo "#!/bin/sh" > $IS
echo "set -x" >> $IS
echo "export ADK_ROOT=$ADK_ROOT" >> $IS
echo "export JAVA_HOME=$JAVA_HOME" >> $IS
echo "java -jar $SWIFT_ROOT/$FRONT_END_PATH \$1 $SWIFT_ROOT/$KEY_PATH $SWIFT_ROOT/$SHARED_PATH" >> $IS
chmod 700 $IS
echo "[build.sh] Generating test.sh GUI testing script"
echo "#!/bin/sh" > $TS
echo "set -x" >> $TS
echo "export ADK_ROOT=$ADK_ROOT" >> $TS
echo "export JAVA_HOME=$JAVA_HOME" >> $TS
echo "java -jar $SWIFT_ROOT/$BACK_END_PATH \${*:1}" >> $TS
echo "if ((\$? > 0));then" >>$TS
echo " cat USAGE" >> $TS
echo "fi" >> $TS
chmod 700 $TS