This repository has been archived by the owner on Jun 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
executable file
·65 lines (52 loc) · 1.69 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
source build/setenv.sh
_PROJECT=build.xml
_TARGET=build
_VERBOSITY=verbose
usage() {
cat <<EOF
Usage: $0 [TARGET] [OPTION]
TARGET analyze|build|clean|compile|package|rebuild|test
OPTION
--log Creates an extensive build.log file
--help Shows this help
EOF
}
error() {
echo
echo -e "\033[0;31m${1}\033[0m"
failed
}
failed() {
echo
echo -e "\033[41m \033[0m"
echo -e "\033[1;41mThe build failed \033[0m"
echo -e "\033[41m \033[0m"
exit 1
}
# Parse command line argument values
# Note: Currently, last one on the command line wins (ex: rebuild clean == clean)
for i in "$@"; do
case $1 in
analyze|build|compile|package|rebuild|test) _TARGET=$1 ;;
clean) _TARGET=clean; rm -Rfd .tmp/; rm -Rfd ivy; rm -Rfd tmp; rm -f build.log ;;
--help) usage ;;
*) usage; error "Unknown option" ;;
esac
shift
done
# Ivy
if [ ! -d ivy ]; then mkdir ivy; fi
if [ ! -f ivy/ivy.jar ]; then wget -nv --show-progress -O ivy/ivy.jar https://repo1.maven.org/maven2/org/apache/ivy/ivy/$_IVY_VERSION/ivy-$_IVY_VERSION.jar; fi
if [ $? -ne 0 ]; then
failed
fi
$JAVA_HOME/bin/java -jar ivy/ivy.jar -retrieve "ivy/lib/[conf]/[artifact].[ext]"
if [ $? -ne 0 ]; then
failed
fi
echo
$ANT_HOME/bin/ant -noclasspath -nouserlib -noinput -lib "ivy/lib/test" -logger org.apache.tools.ant.listener.AnsiColorLogger -Dverbosity=$_VERBOSITY -f $_PROJECT $_TARGET
if [ $? -ne 0 ]; then
failed
fi