forked from playgameservices/cpp-android-basic-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·44 lines (36 loc) · 1.12 KB
/
build.sh
File metadata and controls
executable file
·44 lines (36 loc) · 1.12 KB
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
#!/usr/bin/env bash
set -eua
# List of targets to build. Interpreted as directories relative to
# this script's path.
declare targets=( \
CollectAllTheStarsNative \
Minimalist \
TbmpSkeletonNative \
Teapot \
TrivialQuestNative \
ButtonClicker \
)
declare -r script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# This little piece of code prepends the project name and a timestamp to every line in the
# output, which is kind of handy.
function add_timestamp {
while IFS= read -r line; do
echo "[${1}:$(date)] $line"
done
}
# Build each target in turn.
declare -i status=0
declare -i pipestatus=0
declare failed="Failures: "
for target in "${targets[@]}"; do
echo "Building ${target}..." >&2
${script_dir}/${target}/src/main/build.sh $@ 2>&1 \
| add_timestamp ${target} | tee build.log
pipestatus=${PIPESTATUS[0]}
status=status+pipestatus
[ ${pipestatus} -ne 0 ] && failed=${failed}.${target}
done
echo ${status}
echo ${failed}
[ ${status} -ne 0 ] && echo "Build failed" >&2 || echo "Build Succeeded" >&2
exit ${status}