blob: c49f974bcd4cea8096dc875d6e5ace2479102118 [file] [log] [blame]
Alex Buynytskyyafddc072023-02-09 22:40:53 +00001#!/bin/bash
2
3set -ex
4
Alex Buynytskyybdcef7b2023-02-19 18:40:44 +00005function revert_droidstubs_hack() {
Alex Buynytskyy775ad5f2023-02-21 19:28:48 +00006 if grep -q 'STOPSHIP: RESTORE THIS LOGIC WHEN DECLARING "REL" BUILD' "$top/build/soong/java/droidstubs.go" ; then
Alex Buynytskyybce1a512023-06-16 20:06:38 +00007 patch --strip=1 --no-backup-if-mismatch --directory="$top/build/soong" --input=../../build/make/tools/finalization/build_soong_java_droidstubs.go.revert_hack.diff
Alex Buynytskyybdcef7b2023-02-19 18:40:44 +00008 fi
9}
10
11function apply_prerelease_sdk_hack() {
Alex Buynytskyy775ad5f2023-02-21 19:28:48 +000012 if ! grep -q 'STOPSHIP: hack for the pre-release SDK' "$top/frameworks/base/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java" ; then
Alex Buynytskyybce1a512023-06-16 20:06:38 +000013 patch --strip=1 --no-backup-if-mismatch --directory="$top/frameworks/base" --input=../../build/make/tools/finalization/frameworks_base.apply_hack.diff
Alex Buynytskyybdcef7b2023-02-19 18:40:44 +000014 fi
15}
16
Alex Buynytskyyafddc072023-02-09 22:40:53 +000017function finalize_sdk_rel() {
18 local top="$(dirname "$0")"/../../../..
19 source $top/build/make/tools/finalization/environment.sh
20
Alex Buynytskyybdcef7b2023-02-19 18:40:44 +000021 # revert droidstubs hack now we are switching to REL
22 revert_droidstubs_hack
23
24 # let the apps built with pre-release SDK parse
25 apply_prerelease_sdk_hack
26
Alex Buynytskyyafddc072023-02-09 22:40:53 +000027 # cts
Alex Buynytskyy5b34f3f2024-03-15 00:29:59 +000028 if ! grep -q "${FINAL_PLATFORM_VERSION}" "$top/cts/tests/tests/os/assets/platform_versions.txt" ; then
29 echo ${FINAL_PLATFORM_VERSION} >> "$top/cts/tests/tests/os/assets/platform_versions.txt"
30 fi
Alex Buynytskyybdcef7b2023-02-19 18:40:44 +000031 if [ "$FINAL_PLATFORM_CODENAME" != "$CURRENT_PLATFORM_CODENAME" ]; then
32 echo "$CURRENT_PLATFORM_CODENAME" >> "./cts/tests/tests/os/assets/platform_versions.txt"
33 fi
Alex Buynytskyy0fa58fa2023-02-13 20:22:10 +000034 git -C "$top/cts" mv hostsidetests/theme/assets/${FINAL_PLATFORM_CODENAME} hostsidetests/theme/assets/${FINAL_PLATFORM_SDK_VERSION}
Alex Buynytskyyafddc072023-02-09 22:40:53 +000035
Hsin-Yi Chenb18cd882024-04-16 17:08:45 +080036 # prebuilts/abi-dumps/platform
Hsin-Yi Chena2440a32024-05-15 15:49:34 +080037 "$top/build/soong/soong_ui.bash" --make-mode TARGET_RELEASE=next TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug create_reference_dumps
38 ANDROID_BUILD_TOP="$top" "$top/out/host/linux-x86/bin/create_reference_dumps" -release next --build-variant userdebug --lib-variant APEX
Alex Buynytskyyafddc072023-02-09 22:40:53 +000039}
40
41finalize_sdk_rel
42