-
Notifications
You must be signed in to change notification settings - Fork 188
/
buildbot_unified.sh
executable file
·166 lines (146 loc) · 4.02 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
154
155
156
157
158
159
160
161
162
163
164
165
166
#!/bin/bash
echo ""
echo "LineageOS 21 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
SIGNABLE=true
for var in "${@:2}"
do
if [ ${var} == "nosync" ]
then
NOSYNC=true
fi
if [ ${var} == "personal" ]
then
PERSONAL=true
SIGNABLE=false
fi
done
if [ ! -d "$HOME/.android-certs" ]; then
read -n1 -r -p $"\$HOME/.android-certs not found - CTRL-C to exit, or any other key to continue"
echo ""
SIGNABLE=false
fi
# 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 -u +%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
source vendor/lineage/vars/aosp_target_release
mkdir -p ~/build-output
echo ""
repopick 321337 -r -f # Deprioritize important developer notifications
repopick 321338 -r -f # Allow disabling important developer notifications
repopick 321339 -r -f # Allow disabling USB notifications
repopick 368923 -r -f # Launcher3: Show clear all button in recents overview
}
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-21.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}-${aosp_target_release}-userdebug
make installclean
make -j$(lscpu -b -p=Core,Socket | grep -v '^#' | sort -u | wc -l) systemimage
SIGNED=false
if [ ${SIGNABLE} = true ] && [[ ${TARGET} == *_g? ]]
then
make -j$(lscpu -b -p=Core,Socket | grep -v '^#' | sort -u | wc -l) target-files-package otatools
bash ./lineage_build_unified/sign_target_files.sh $OUT/signed-target_files.zip
unzip -joq $OUT/signed-target_files.zip IMAGES/system.img -d $OUT
SIGNED=true
echo ""
fi
mv $OUT/system.img ~/build-output/lineage-21.0-$BUILD_DATE-UNOFFICIAL-${TARGET}$(${PERSONAL} && echo "-personal" || echo "")$(${SIGNED} && echo "-signed" || echo "").img
}
if ${NOSYNC}
then
echo "ATTENTION: syncing/patching skipped!"
echo ""
echo "Setting up build environment"
source build/envsetup.sh &> /dev/null
source vendor/lineage/vars/aosp_target_release
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 ""