-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·58 lines (45 loc) · 1.37 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
#!/bin/bash
source .build/setenv.sh
_PROJECT=Ziusudra.proj
_TARGET=Build
_VERBOSITY=detailed
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 ${2}"
}
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 -rf .tmp/; rm -rf tmp ;;
-l|--log) _VERBOSITY=diagnostic ;;
--help) usage; exit 0 ;;
*) error "Unknown option" "$1"; usage; failed ;;
esac
shift
done
dotnet tool restore
if [ $? -ne 0 ]; then
failed
fi
dotnet msbuild $_PROJECT /nologo /t:$_TARGET /m /r /fl /flp:logfile=build.log;verbosity=$_VERBOSITY;encoding=UTF-8
if [ $? -ne 0 ]; then
failed
fi