forked from ringcentral/pubnub-jtools
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathjava-build
More file actions
executable file
·60 lines (44 loc) · 1.13 KB
/
java-build
File metadata and controls
executable file
·60 lines (44 loc) · 1.13 KB
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
#!/bin/bash
FAILURE=1
SUCCESS=0
# Set APP_HOME to PUBNUB_GIT_ROOT/java
APP_HOME=/home/geremy/pubnub-api/java
LIB=${APP_HOME}/lib/
CP=${LIB}async-http-client-1.6.5-shaded.jar:${LIB}slf4j-nop-1.6.2.jar:src/:.
# cleaning up
if [ -f "$APP_HOME/src/tests/PubnubUnitTest.java" ]; then
echo -e "Cleaning up..."
rm src/tests/*.class
fi
# Check to see if we look good...
if [ -z "$JAVA_HOME" ]; then
echo "Need to set JAVA_HOME environmental variable."
exit 1
fi
if [ ! -f "$JAVA_HOME/bin/javac" ]; then
echo "Can't find javac in JAVA_HOME/bin."
exit 1
fi
if [ ! -f "$APP_HOME/src/tests/PubnubUnitTest.java" ]; then
echo "Please edit this build script and verify APP_HOME is valid."
exit 1
fi
cd ${APP_HOME}
echo -e "Building..."
${JAVA_HOME}/bin/javac -cp "${CP}" src/tests/PubnubUnitTest.java
if [ $? -ne 0 ]
then
echo "Test failed during compilation"
exit ${FAILURE}
fi
echo -e "Build succeeded."
echo
echo -e "Running..."
${JAVA_HOME}/bin/java -cp "${CP}" src/tests/PubnubUnitTest
if [ $? -ne 0 ]
then
echo "Tests failed."
exit ${FAILURE}
fi
echo "Tests ran successfully!"
exit ${SUCCESS}