forked from LearnPAd/learnpad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build
executable file
·65 lines (57 loc) · 1.74 KB
/
build
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
#!/usr/bin/env bash
# Trace what's being executed (useful for debug)
# set -o xtrace
# Exit on error
set -o errexit
# Exit on unset variables
set -o nounset
# Catch the error code of the program who crashed in piping commands
set -o pipefail
declare -r __ROOT_PATH__="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
declare -r __BASE__="$(basename "${BASH_SOURCE[0]}")"
declare -r __FILE__="${__ROOT_PATH__}/${__BASE__}"
declare -r __BUILD_SYSTEM_PATH__="${__ROOT_PATH__}/build-system"
declare -r __OPTIONS__=$*
declare __LOG_LEVEL__="ERROR"
declare -r COMPONENTS_LIST_FILE="${__ROOT_PATH__}/.components"
### Libraries
source ${__BUILD_SYSTEM_PATH__}/utils.sh
source ${__BUILD_SYSTEM_PATH__}/prebuild.sh
source ${__BUILD_SYSTEM_PATH__}/build.sh
source ${__BUILD_SYSTEM_PATH__}/postbuild.sh
for ARG in $*
do
case ${ARG} in
"-v"|"--verbose")
declare __LOG_LEVEL__="INFO"
;;
"-d"|"--debug")
declare __LOG_LEVEL__="DEBUG"
;;
*)
customlog "INFO" "\`${ARG}' is not parsed by \`${__BASE__}' script."
;;
esac
done
cat ${COMPONENTS_LIST_FILE} | while read COMPONENT_NAME
do
echo ${COMPONENT_NAME} | grep -q '^#' && continue;
if iscomponent ${COMPONENT_NAME}
then
prebuild "${COMPONENT_NAME}" ${__OPTIONS__}
build "${COMPONENT_NAME}" ${__OPTIONS__}
postbuild "${COMPONENT_NAME}" ${__OPTIONS__}
else
customlog "ERROR" "The list in \`.components' contains at least one non-existing component." ${ERROR_COMPONENTS}
fi
done
# Report builds to labs.xwiki.com
set +o nounset
if [[ -z "$TRAVIS" ]]
then
curl -X POST "https://labs.xwiki.com/xwiki/bin/view/BuildCounters/?xpage=plain&project=learnpad"
else
curl -X POST "https://labs.xwiki.com/xwiki/bin/view/BuildCounters/?xpage=plain&project=learnpad&travis_ci=1"
fi
set -o nounset
exit ${SUCCESS}