LeOS-GSI/build-u.sh

204 lines
6.3 KiB
Bash
Raw Normal View History

2024-01-08 17:18:43 +01:00
#!/bin/bash
MONTH="date +%B"
echo
echo "--------------------------------------"
echo " LeOS-U Buildbot "
echo " by "
echo " harvey186 "
echo "--------------------------------------"
echo
2024-01-10 15:58:53 +01:00
#git clone http://62.178.96.192:3000/JoJo/LeOS-GSI.git -b LeOS-U
##### only for testing ###
sudo rm -R treble_aosp
###-
2024-01-08 17:18:43 +01:00
git clone https://github.com/ponces/treble_aosp -b android-14.0
2024-01-10 15:58:53 +01:00
cp LeOS/patch.sh treble_aosp/patch.sh
2024-01-08 17:18:43 +01:00
2024-01-10 15:58:53 +01:00
#git clone https://github.com/ponces/vendor_ponces.git -b android-14.0 vendor/ponces
2024-01-08 17:18:43 +01:00
set -e
initRepos() {
if [ ! -d .repo ]; then
echo "--> Initializing workspace"
repo init -u https://android.googlesource.com/platform/manifest -b android-14.0.0_r21 --git-lfs
echo
echo "--> Preparing local manifest"
mkdir -p .repo/local_manifests
cp treble_aosp/build/manifest.xml .repo/local_manifests/aosp.xml
# cp LeOS/leos.xml .repo/local_manifests/leos.xml
cp LeOS/eOS.xml .repo/local_manifests/eOS.xml
cp LeOS/removeAOSP.xml .repo/local_manifests/remove.xml
echo
fi
}
syncRepos() {
echo "--> Syncing repos"
repo sync -c --force-sync --no-clone-bundle --no-tags -j$(nproc --all)
echo
}
applyPatches() {
echo "--> Applying TrebleDroid patches"
bash treble_aosp/patch.sh treble_aosp trebledroid
echo
echo "--> Applying ponces personal patches"
rm treble_aosp/patches/personal/platform_frameworks_base/0001-gmscompat-Change-attestation-and-instrumentation-to-.patch
2024-01-10 15:58:53 +01:00
rm treble_aosp/patches/personal/platform_frameworks_base/0002-gmscompat-Spoof-Pixel-XL-for-Google-Photos.patch
2024-01-08 17:18:43 +01:00
rm treble_aosp/patches/personal/platform_frameworks_base/0003-monet-Use-Style.SPRITZ-by-default.patch
rm treble_aosp/patches/personal/platform_frameworks_base/0004-fw-b-Use-ro.build.version.incremental-to-signal-OTA-.patch
2024-01-10 15:58:53 +01:00
rm treble_aosp/patches/personal/platform_frameworks_base/0005-SystemUI-fix-SliceView-layout.patch
2024-01-08 17:18:43 +01:00
rm treble_aosp/patches/personal/platform_frameworks_base/0006-Add-android.permission.READ_PHONE_STATE-to-manifest.patch
rm treble_aosp/patches/personal/platform_frameworks_base/0007-permissions-Pre-grant-google-restore-permissions.patch
2024-01-10 15:58:53 +01:00
rm -R treble_aosp/patches/personal/platform_frameworks_base/0008-feat-Add-Lockscreen-Weather-with-OmniJaws-1-2.patch
rm -R treble_aosp/patches/personal/device_phh_treble
rm -R treble_aosp/patches/personal/platform_build
rm -R treble_aosp/patches/personal/platform_packages_apps_Trebuchet
rm -R treble_aosp/patches/personal/platform_packages_apps_Aperture
2024-01-08 17:18:43 +01:00
rm -R treble_aosp/patches/personal/platform_packages_apps_Settings/0001-feat-Add-Lockscreen-Weather-with-OmniJaws-2-2.patch
bash treble_aosp/patch.sh treble_aosp personal
echo
echo "--> Applying LeOS patches"
2024-01-10 15:58:53 +01:00
cp -R patches/leos treble_aosp/patches/leos
2024-01-08 17:18:43 +01:00
bash treble_aosp/patch.sh treble_aosp leos
2024-01-10 15:58:53 +01:00
echo "testlists"
2024-01-08 17:18:43 +01:00
cp LeOS/instrumentation_test_list.mk platform_testing/build/tasks/tests/
cp LeOS/platform_test_list.mk platform_testing/build/tasks/tests/
2024-01-10 15:58:53 +01:00
echo "texte"
2024-01-08 17:18:43 +01:00
cp LeOS/texte.sh .
bash texte.sh
echo
echo "--> Generating makefiles"
cp treble_aosp/build/aosp.mk device/phh/treble/
cd device/phh/treble
bash generate.sh aosp
cd ../../..
echo
}
setupEnv() {
echo "--> Setting up build environment"
source build/envsetup.sh &>/dev/null
# mkdir -p $BD
echo
}
buildTrebleApp() {
echo "--> Building treble_app"
cd treble_app
bash build.sh release
cp TrebleApp.apk ../vendor/hardware_overlay/TrebleApp/app.apk
cd ..
echo
}
buildVanillaVariant() {
echo "--> Building treble_arm64_bvS"
export WITHOUT_CHECK_API=true
export USE_CCACHE=1
export CCACHE_SIZE=50G
export WITH_SU=true
lunch leos_arm64_bvS-userdebug
#make installclean
make -j12 RELAX_USES_LIBRARY_CHECK=true systemimage
echo
echo "--> Building treble_a64_bvS"
export WITHOUT_CHECK_API=true
export USE_CCACHE=1
export CCACHE_SIZE=50G
export WITH_SU=true
lunch leos_a64_bvS-userdebug
#make installclean
make -j12 RELAX_USES_LIBRARY_CHECK=true systemimage
echo "--> Building LeOS-U-VNDKLITE-arm64-bvS.img"
cd treble_adapter
sudo bash lite-adapter.sh 64 ../out/target/product/leos_arm64_ab/system.img
mv s.img LeOS-U-VNDKLITE-arm64-bvS.img
sudo rm -rf d tmp
echo "--> Building LeOS-U-VNDKLITE-arm64-bvN"
sudo bash lite-adapterN.sh 64 ../out/target/product/leos_arm64_ab/system.img
mv s.img LeOS-U-VNDKLITE-arm64-bvN.img
sudo rm -rf d tmp
cd ..
echo
echo "--> Building LeOS-U-VNDKLITE-a64-bvS.img"
cd treble_adapter
sudo bash lite-adapterSa64.sh 32 ../out/target/product/leos_a64_ab/system.img
mv s.img LeOS-U-VNDKLITE-a64-bvS.img
sudo rm -rf d tmp
echo "--> Building LeOS-U-VNDKLITE-a64-bvN"
sudo bash lite-adapterNa64.sh 32 ../out/target/product/leos_a64_ab/system.img
mv s.img LeOS-U-VNDKLITE-a64-bvN.img
sudo rm -rf d tmp
cd ..
echo
cd prebuilts/prebuiltapks/foss_nano/
bash update.sh
cd ../../..
echo "--> Building treble_arm64_bvN"
export WITHOUT_CHECK_API=true
export USE_CCACHE=1
export CCACHE_SIZE=50G
export WITH_SU=true
lunch leos_arm64_bvN-userdebug
#make installclean
make -j12 RELAX_USES_LIBRARY_CHECK=true systemimage
echo
echo "--> Building treble_a64_bvN"
export WITHOUT_CHECK_API=true
export USE_CCACHE=1
export CCACHE_SIZE=50G
export WITH_SU=true
lunch leos_a64_bvN-userdebug
#make installclean
make -j12 RELAX_USES_LIBRARY_CHECK=true systemimage
}
generatePackages() {
echo "--> Generating packages"
cp out/target/product/leos_arm64_ab/system.img treble_adapter/LeOS-U-VNDK-arm64_bvN.img
cp out/target/product/leos_a64_ab/system.img treble_adapter/LeOS-U-VNDK-a64-bvN.img
cd treble_adapter
xz -vT0 *.img
cp *.img.xz /media/ich/exSSD2/leos-cloud/LeOS-Files/LeOS-U/$MONTH/
echo
}
echo "READY"
START=$(date +%s)
2024-01-10 15:58:53 +01:00
initRepos
syncRepos
applyPatches
2024-01-11 09:47:47 +01:00
setupEnv
buildTrebleApp
buildVanillaVariant
generatePackages
2024-01-08 17:18:43 +01:00
END=$(date +%s)
ELAPSEDM=$(($(($END-$START))/60))
ELAPSEDS=$(($(($END-$START))-$ELAPSEDM*60))
echo "--> Buildbot completed in $ELAPSEDM minutes and $ELAPSEDS seconds"
echo