-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_java.sh
executable file
·43 lines (41 loc) · 939 Bytes
/
build_java.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
#!/usr/bin/env bash
# Colors
GREEN="\033[1;32m"
NC="\033[0m"
YELLOW="\033[1;33m"
MAGENTA="\033[1;35m"
RED="\033[0;31m"
echo ""
echo -e "${GREEN}" "Available File(s) -${NC}"
if [[ ! -d "temp" ]]; then
mkdir temp
fi
LIST_FILES="$(find src/ -name '*.java')"
echo "${LIST_FILES}"
echo ""
FILES=0
ERROR_FILE=0
echo -e "${YELLOW}Compiling with Javac${NC}"
echo ""
for f in ${LIST_FILES}; do
((FILES = FILES + 1))
echo "Compiling '${f}'"
javac "${f}" -d ./temp
ERROR_CODE="$?"
if [[ ${ERROR_CODE} != "0" ]]; then
echo ""
echo -e "${RED}Error while compiling ${MAGENTA}'${f}'${NC}"
echo ""
((ERROR_FILE = ERROR_FILE + 1))
fi
done
echo ""
if [[ ${ERROR_FILE} != "0" ]]; then
echo -e "${YELLOW}Error(s) in some file(s).${NC}"
echo ""
echo -e "No. of file(s) checked: ${GREEN}${FILES}${NC}"
echo -e "No. of file(s) with error(s): ${RED}${ERROR_FILE}${NC}"
exit 1
else
echo -e "No. of file(s) checked: ${GREEN}${FILES}${NC}"
fi