-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompile-or-run
executable file
·70 lines (63 loc) · 1.44 KB
/
compile-or-run
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
65
66
67
68
69
70
#!/bin/bash
argc=$#
run="$1"
main="$2"
function build {
compiler="javac $1/src/*.java -d $1/bin/"
mkdir -p $1/bin/
if [ $argc -eq 0 ]; then
echo "-------------------------------------"
echo "$compiler"
eval $compiler
if [ -z "$2" ]; then
echo "MAIN: $1"
else
echo "MAIN: $2"
fi
if ! [ -z "$3" ]; then
echo "ANOTHER MAIN: $3"
echo "Usage: ./compile-or-run $1 $3"
fi
echo "-------------------------------------"
else
if [[ "$run" == "$1" ]]; then
echo "-------------------------------------"
echo "$compiler"
eval $compiler
if [ -z "$2" ]; then
compiler="java -cp $1/bin/ $1"
else
if [ -z "$main" ]; then
compiler="java -cp $1/bin/ $2"
else
compiler="java -cp $1/bin/ $main"
fi
fi
echo "$compiler"
echo "-------------------------------------"
if ! [ -z "$3" ]; then
echo "ANOTHER MAIN: $3"
echo "Usage: ./compile-or-run $1 $3"
echo "-------------------------------------"
fi
eval $compiler
echo -e "\n-------------------------------------"
exit
fi
fi
}
build Asteroids
build BubbleWorld
build FlowersOfLife Main
build Hopper Main
build LastfmPlaylist LFMPlaylistMakerUI
build MultiplayerGame GameServer GameClient
build OrbAvoider Main
build Organisms Main
build Particles Main
build SliderTanks MainClass
build TicTacToe
build Units Main
build VariousJavaPrograms Elevator GraphDFS
echo "USAGE: ./compile-or-run <project-directory-name> <main-class-name>"
echo "(NO SLASHES)"