#!/bin/bash MONTH="date +%B" echo echo "--------------------------------------" echo " LeOS-U Buildbot " echo " by " echo " harvey186 " echo "--------------------------------------" echo git clone https://github.com/ponces/treble_aosp -b android-14.0 git clone https://github.com/ponces/vendor_ponces.git -b android-14.0 vendor/ponces cp LeOS/patch.sh treble_aosp set -e initRepos() { if [ ! -d .repo ]; then echo "--> Initializing workspace" repo init -u https://android.googlesource.com/platform/manifest -b android-14.0.0_r17 --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/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 rm treble_aosp/patches/personal/platform_frameworks_base/0002-gmscompat-Spoof-Pixel-XL-for-Google-Photos.patch rm treble_aosp/patches/personal/platform_frameworks_base/0007-permissions-Pre-grant-google-restore-permissions.patch 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/platform_packages_apps_Settings/0001-feat-Add-Lockscreen-Weather-with-OmniJaws-2-2.patch rm treble_aosp/patches/personal/platform_build/0001-Remove-su-from-vanilla-builds.patch bash treble_aosp/patch.sh treble_aosp personal echo echo "--> Applying LeOS patches" mv patches/leos treble_aosp/patches/leos bash treble_aosp/patch.sh treble_aosp leos cp LeOS/instrumentation_test_list.mk plattform_testing/build/tasks/tests/ cp LeOS/platform_test_list.mk plattform_testing/build/tasks/tests/ echo echo "creatings host file" cp LeOS/hosts system/core/rootdir/etc/ echo "--> Generating makefiles" cd device/phh/treble cp treble_aosp/build/aosp.mk 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 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 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 cp out/target/product/leos_arm64_ab/system.img treble_adapter/LeOS-U-VNDK-arm64_bvN.img 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 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 cp out/target/product/leos_a64_ab/system.img treble_adapter/LeOS-U-VNDK-a64-bvN.img 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_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-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 } generatePackages() { echo "--> Generating packages" 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) initRepos syncRepos applyPatches setupEnv buildTrebleApp buildVanillaVariant generatePackages END=$(date +%s) ELAPSEDM=$(($(($END-$START))/60)) ELAPSEDS=$(($(($END-$START))-$ELAPSEDM*60)) echo "--> Buildbot completed in $ELAPSEDM minutes and $ELAPSEDS seconds" echo