forked from AndyCGYan/lineage_build_unified
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildbot_unified.sh
executable file
·153 lines (133 loc) · 3.55 KB
/
buildbot_unified.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!/bin/bash
echo ""
echo "LineageOS 20 Unified Buildbot"
echo "Executing in 5 seconds - CTRL-C to exit"
echo ""
sleep 5
if [ $# -lt 2 ]
then
echo "Not enough arguments - exiting"
echo ""
exit 1
fi
MODE=${1}
if [ ${MODE} != "device" ] && [ ${MODE} != "treble" ]
then
echo "Invalid mode - exiting"
echo ""
exit 1
fi
NOSYNC=false
PERSONAL=false
for var in "${@:2}"
do
if [ ${var} == "nosync" ]
then
NOSYNC=true
fi
if [ ${var} == "personal" ]
then
PERSONAL=true
fi
done
# Abort early on error
set -eE
trap '(\
echo;\
echo \!\!\! An error happened during script execution;\
echo \!\!\! Please check console output for bad sync,;\
echo \!\!\! failed patch application, etc.;\
echo\
)' ERR
START=`date +%s`
BUILD_DATE="$(date +%Y%m%d)"
prep_build() {
echo "Preparing local manifests"
mkdir -p .repo/local_manifests
cp ./lineage_build_unified/local_manifests_${MODE}/*.xml .repo/local_manifests
echo ""
echo "Syncing repos"
repo sync -c --force-sync --no-clone-bundle --no-tags -j$(nproc --all)
echo ""
echo "Setting up build environment"
source build/envsetup.sh &> /dev/null
mkdir -p ~/build-output
echo ""
repopick 321337 -f # Deprioritize important developer notifications
repopick 321338 -f # Allow disabling important developer notifications
repopick 321339 -f # Allow disabling USB notifications
#repopick 340916 # SystemUI: add burnIn protection
repopick 342860 # codec2: Use numClientBuffers to control the pipeline
repopick 342861 # CCodec: Control the inputs to avoid pipeline overflow
repopick 342862 # [WA] Codec2: queue a empty work to HAL to wake up allocation thread
repopick 342863 # CCodec: Use pipelineRoom only for HW decoder
repopick 342864 # codec2: Change a Info print into Verbose
}
apply_patches() {
echo "Applying patch group ${1}"
bash ./lineage_build_unified/apply_patches.sh ./lineage_patches_unified/${1}
}
prep_device() {
:
}
prep_treble() {
:
}
finalize_device() {
:
}
finalize_treble() {
:
}
build_device() {
brunch ${1}
mv $OUT/lineage-*.zip ~/build-output/lineage-20.0-$BUILD_DATE-UNOFFICIAL-${1}$($PERSONAL && echo "-personal" || echo "").zip
}
build_treble() {
case "${1}" in
("64VN") TARGET=gsi_arm64_vN;;
("64VS") TARGET=gsi_arm64_vS;;
("64GN") TARGET=gsi_arm64_gN;;
(*) echo "Invalid target - exiting"; exit 1;;
esac
lunch lineage_${TARGET}-userdebug
make installclean
make -j$(nproc --all) systemimage
mv $OUT/system.img ~/build-output/lineage-20.0-$BUILD_DATE-UNOFFICIAL-${TARGET}$(${PERSONAL} && echo "-personal" || echo "").img
}
if ${NOSYNC}
then
echo "ATTENTION: syncing/patching skipped!"
echo ""
echo "Setting up build environment"
source build/envsetup.sh &> /dev/null
echo ""
else
prep_build
echo "Applying patches"
prep_${MODE}
apply_patches patches_platform
apply_patches patches_${MODE}
if ${PERSONAL}
then
apply_patches patches_platform_personal
apply_patches patches_${MODE}_personal
fi
finalize_${MODE}
echo ""
fi
for var in "${@:2}"
do
if [ ${var} == "nosync" ] || [ ${var} == "personal" ]
then
continue
fi
echo "Starting $(${PERSONAL} && echo "personal " || echo "")build for ${MODE} ${var}"
build_${MODE} ${var}
done
ls ~/build-output | grep 'lineage' || true
END=`date +%s`
ELAPSEDM=$(($(($END-$START))/60))
ELAPSEDS=$(($(($END-$START))-$ELAPSEDM*60))
echo "Buildbot completed in $ELAPSEDM minutes and $ELAPSEDS seconds"
echo ""