forked from phhusson/treble_experimentations
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
76 lines (61 loc) · 2.14 KB
/
build.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
#!/bin/bash
rom_fp="$(date +%y%m%d)"
originFolder="$(dirname "$0")"
mkdir -p release/$rom_fp/
set -e
if [ -z "$USER" ];then
export USER="$(id -un)"
fi
export LC_ALL=C
aosp="android-8.1.0_r48"
phh="android-8.1"
if [ "$1" == "android-9.0" ];then
aosp="android-9.0.0_r16"
phh="android-9.0"
fi
if [ "$release" == true ];then
[ -z "$version" ] && exit 1
[ ! -f "$originFolder/release/config.ini" ] && exit 1
fi
repo init -u https://android.googlesource.com/platform/manifest -b $aosp
if [ -d .repo/local_manifests ] ;then
( cd .repo/local_manifests; git fetch; git reset --hard; git checkout origin/$phh)
else
git clone https://github.com/phhusson/treble_manifest .repo/local_manifests -b $phh
fi
repo sync -c -j 1 --force-sync
(cd device/phh/treble; git clean -fdx; bash generate.sh)
(cd vendor/foss; git clean -fdx; bash update.sh)
. build/envsetup.sh
buildVariant() {
lunch $1
make BUILD_NUMBER=$rom_fp installclean
make BUILD_NUMBER=$rom_fp -j8 systemimage
make BUILD_NUMBER=$rom_fp vndk-test-sepolicy
xz -c $OUT/system.img > release/$rom_fp/system-${2}.img.xz
}
repo manifest -r > release/$rom_fp/manifest.xml
bash "$originFolder"/list-patches.sh
cp patches.zip release/$rom_fp/patches.zip
buildVariant treble_arm64_avN-userdebug arm64-aonly-vanilla-nosu
buildVariant treble_arm64_agS-userdebug arm64-aonly-gapps-su
buildVariant treble_arm64_afS-userdebug arm64-aonly-floss-su
buildVariant treble_arm64_bvN-userdebug arm64-ab-vanilla-nosu
buildVariant treble_arm64_bgS-userdebug arm64-ab-gapps-su
buildVariant treble_arm64_bfS-userdebug arm64-ab-floss-su
buildVariant treble_arm_avN-userdebug arm-aonly-vanilla-nosu
[ "$1" != "android-9.0" ] && buildVariant treble_arm_aoS-userdebug arm-aonly-go-su
if [ "$release" == true ];then
(
rm -Rf venv
pip install virtualenv
export PATH=$PATH:~/.local/bin/
virtualenv -p /usr/bin/python3 venv
source venv/bin/activate
pip install -r $originFolder/release/requirements.txt
name="AOSP 8.1"
[ "$1" == "android-9.0" ] && name="AOSP 9.0"
python $originFolder/release/push.py "$name" "$version" release/$rom_fp/
rm -Rf venv
)
fi