-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·57 lines (52 loc) · 1.3 KB
/
run.sh
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
wasCompile=false
wasRun=false
wasTestCompile=false
wasTestRun=false
compile() {
echo "Compiling..."
rm -rf bin
find src/main/java/com/gytmy -name "*.java" >sources.txt
javac -cp lib/*:src -d bin @sources.txt && wasCompile=true
rm sources.txt
echo "Done!"
}
run() {
echo "Launching..."
java -cp lib/*:bin com.gytmy.Main && wasRun=true
}
compileTests() {
echo "Compiling tests..."
rm -rf bin
find -name "*.java" >sources.txt
javac --class-path="src:lib/*" -d bin @sources.txt && wasTestCompile=true
rm sources.txt
echo "Done!"
}
runTests() {
echo "Running tests..."
java -cp classes:bin:lib/* org.junit.platform.console.ConsoleLauncher --scan-classpath && wasTestRun=true
}
case "$1" in
"compile" |"--compile")
compile
$wasCompile && exit 0 || exit 1
;;
"compileTest" | "compileTests"| "--compileTest" | "--compileTests")
compileTests
$wasTestCompile && exit 0 || exit 1
;;
"runTest" | "runTests" | "test" | "tests"| "--runTest" | "--runTests" | "--test" | "--tests")
compileTests
runTests
$wasTestRun && exit 0 || exit 1
;;
"run" | "--run")
compile
run
$wasRun && exit 0 || exit 1
;;
*)
run
$wasRun && exit 0 || exit 1
;;
esac