-
Notifications
You must be signed in to change notification settings - Fork 0
/
fms
executable file
·64 lines (56 loc) · 1.53 KB
/
fms
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
#!/bin/bash
SERVER_MODULE="server"
SHARED_MODULE="shared"
#"com.example" is the package name.
#"Server" would be the class with the main function.
PACKAGE_NAME_TO_MAIN="server"
PACKAGE_NAME_TO_TEST_DRIVER="testDriver"
LIBS_FOLDER="server/libs"
CODE_LOC="server/src/main/java/"
TEST_CODE_LOC="server/src/main/java/"
function remove {
echo "Removing ./bin folder"
rm -rf ./bin
}
function compile {
CODE_DIR_AUTO="$(find $CODE_LOC -name '*.java')"
mkdir -p bin
javac -d "./bin" -classpath "./$LIBS_FOLDER/*" $CODE_DIR_AUTO
if [ $? -eq 0 ]; then
echo "SERVER COMPILATION SUCCESSFUL!"
else
echo "SERVER COMPILATION FAILED!"
fi;
}
function compileTest {
mkdir -p bin
CODE_DIR_AUTO="$(find $TEST_CODE_LOC -name '*.java')"
javac -d "./bin" -classpath "./$LIBS_FOLDER/*" $CODE_DIR_AUTO
if [ $? -eq 0 ]; then
echo "JUnit TEST COMPILATION SUCCESSFUL!"
else
echo "JUnit TEST COMPILATION FAILED!"
fi;
}
if [ "$1" == "compile" ]; then
remove
compile
elif [ "$1" == "run" ]; then
remove
compile
java -cp "./bin:./"$LIBS_FOLDER"/*" $PACKAGE_NAME_TO_MAIN $2 $3
elif [ "$1" == "compile-tests" ]; then
remove
compileTest
elif [ "$1" == "run-tests" ]; then
remove
compileTest
java -cp "./bin:./"$LIBS_FOLDER"/*" $PACKAGE_NAME_TO_TEST_DRIVER
elif [ "$1" == "clean" ]; then
remove
elif [ "$1" == "-help" ]; then
echo "USAGE: compile; run <port> <auth-token-timeout>; compile-tests; run-tests"
else
echo "Invalid Command"
echo "USAGE: compile; run <port> <auth-token-timeout>; compile-tests; run-tests"
fi;