-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
48 lines (46 loc) · 1.14 KB
/
build.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
#!/usr/bin/env bash
# ${OPTARG}
show_usage() {
echo "Multi-usage script for the project"
echo "Usage: $(basename "$0") [-b/-j/-t/-p/-h]"
echo "-b Build and run the CLI*"
echo "-g Build and run the GUI*"
echo "-j Generate the JavaDoc"
echo "-t Run the JUnit tests"
echo "-p Package in a .jar file"
echo "-h Show this help menu"
echo -e "\n*: Warning, requires Java 14+\n"
}
if [ $# -ge 1 ]; then
while getopts bgjtph flag; do
case "$flag" in
b) # Build and run CLI
find . -name "*.java" >./files.txt
javac -d target/classes @files.txt -encoding UTF-8
rm -f ./files.txt
java -cp target/classes MusicHub
;;
g) # Build and run GUI
find . -name "*.java" >./files.txt
javac -d target/classes @files.txt -encoding UTF-8
rm -f ./files.txt
java -cp target/classes MusicHubGUI
;;
j) # JavaDoc generation
javadoc -d javadoc lethimonnier.antoine.jmusichub
;;
t) # Running JUnit Tests
java -jar junit-platform-console-standalone-1.8.0-M1.jar
;;
p) # Packaging in jar
mvn package
;;
h) # Usage
show_usage
;;
*) echo "Invalid option: -$flag" ;;
esac
done
else
show_usage
fi