-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathbuild_rootbox.sh
More file actions
75 lines (61 loc) · 2.01 KB
/
build_rootbox.sh
File metadata and controls
75 lines (61 loc) · 2.01 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
# Colorize and add text parameters
red=$(tput setaf 1) # red
grn=$(tput setaf 2) # green
cya=$(tput setaf 6) # cyan
txtbld=$(tput bold) # Bold
bldred=${txtbld}$(tput setaf 1) # red
bldgrn=${txtbld}$(tput setaf 2) # green
bldblu=${txtbld}$(tput setaf 4) # blue
bldcya=${txtbld}$(tput setaf 6) # cyan
txtrst=$(tput sgr0) # Reset
DEVICE="$1"
SYNC="$2"
THREADS="$3"
CLEAN="$4"
# Build Date/Version
VERSION=`date +%Y%m%d`
# Time of build startup
res1=$(date +%s.%N)
echo -e "${cya}Building ${bldcya}Vanilla RootBox Nightly-$VERSION ${txtrst}";
echo -e ""
echo -e ""
echo -e ${bldblue}" ____ __ ____"
echo -e " /\ _'\ /\ \__/\ _'\ "
echo -e " \ \ \L\ \ ___ ___\ \ ,_\ \ \L\ \ ___ __ _"
echo -e " \ \ , / / __'\ / __'\ \ \/\ \ _ < / __ \/\ \/'\ "
echo -e " \ \ \ \ \/\ \L\ \/\ \L\ \ \ \_\ \ \L\ \/\ \L\ \/> </"
echo -e " \ \_\ \_\ \____/\ \____/\ \_\ \ \____/\ \____//\_/\_\ "
echo -e " \/_/\/ /\/___/ \/___/ \/__/ \/___/ \/___/ \//\/_/ "
echo -e
# sync with latest sources
echo -e ""
if [ "$SYNC" == "sync" ]
then
echo -e "${bldblu}Syncing latest RootBox sources ${txtrst}"
repo sync -j"$THREADS"
echo -e ""
fi
# setup environment
if [ "$CLEAN" == "clean" ]
then
echo -e "${bldblu}Cleaning up out folder ${txtrst}"
make clobber;
else
echo -e "${bldblu}Skipping out folder cleanup ${txtrst}"
fi
# setup environment
echo -e "${bldblu}Setting up build environment ${txtrst}"
. build/envsetup.sh
# lunch device
echo -e ""
echo -e "${bldblu}Lunching your device ${txtrst}"
lunch "rootbox_$DEVICE-userdebug";
echo -e ""
echo -e "${bldblu}Starting RootBox build for $DEVICE ${txtrst}"
# start compilation
brunch "rootbox_$DEVICE-userdebug" -j"$THREADS";
echo -e ""
# finished? get elapsed time
res2=$(date +%s.%N)
echo "${bldgrn}Total time elapsed: ${txtrst}${grn}$(echo "($res2 - $res1) / 60"|bc ) minutes ($(echo "$res2 - $res1"|bc ) seconds) ${txtrst}"