Alex Buynytskyy | afddc07 | 2023-02-09 22:40:53 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | set -ex |
| 4 | |
Alex Buynytskyy | bdcef7b | 2023-02-19 18:40:44 +0000 | [diff] [blame] | 5 | function revert_droidstubs_hack() { |
Alex Buynytskyy | 775ad5f | 2023-02-21 19:28:48 +0000 | [diff] [blame] | 6 | if grep -q 'STOPSHIP: RESTORE THIS LOGIC WHEN DECLARING "REL" BUILD' "$top/build/soong/java/droidstubs.go" ; then |
Alex Buynytskyy | bce1a51 | 2023-06-16 20:06:38 +0000 | [diff] [blame^] | 7 | 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 Buynytskyy | bdcef7b | 2023-02-19 18:40:44 +0000 | [diff] [blame] | 8 | fi |
| 9 | } |
| 10 | |
Alex Buynytskyy | f7a5e2f | 2023-04-14 11:50:04 -0700 | [diff] [blame] | 11 | function revert_resources_sdk_int_fix() { |
| 12 | if grep -q 'public static final int RESOURCES_SDK_INT = SDK_INT;' "$top/frameworks/base/core/java/android/os/Build.java" ; then |
Alex Buynytskyy | bce1a51 | 2023-06-16 20:06:38 +0000 | [diff] [blame^] | 13 | patch --strip=1 --no-backup-if-mismatch --directory="$top/frameworks/base" --input=../../build/make/tools/finalization/frameworks_base.revert_resource_sdk_int.diff |
Alex Buynytskyy | f7a5e2f | 2023-04-14 11:50:04 -0700 | [diff] [blame] | 14 | fi |
| 15 | } |
| 16 | |
Alex Buynytskyy | bdcef7b | 2023-02-19 18:40:44 +0000 | [diff] [blame] | 17 | function apply_prerelease_sdk_hack() { |
Alex Buynytskyy | 775ad5f | 2023-02-21 19:28:48 +0000 | [diff] [blame] | 18 | if ! grep -q 'STOPSHIP: hack for the pre-release SDK' "$top/frameworks/base/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java" ; then |
Alex Buynytskyy | bce1a51 | 2023-06-16 20:06:38 +0000 | [diff] [blame^] | 19 | patch --strip=1 --no-backup-if-mismatch --directory="$top/frameworks/base" --input=../../build/make/tools/finalization/frameworks_base.apply_hack.diff |
Alex Buynytskyy | bdcef7b | 2023-02-19 18:40:44 +0000 | [diff] [blame] | 20 | fi |
| 21 | } |
| 22 | |
Alex Buynytskyy | afddc07 | 2023-02-09 22:40:53 +0000 | [diff] [blame] | 23 | function finalize_sdk_rel() { |
| 24 | local top="$(dirname "$0")"/../../../.. |
| 25 | source $top/build/make/tools/finalization/environment.sh |
| 26 | |
Alex Buynytskyy | bdcef7b | 2023-02-19 18:40:44 +0000 | [diff] [blame] | 27 | # revert droidstubs hack now we are switching to REL |
| 28 | revert_droidstubs_hack |
| 29 | |
| 30 | # let the apps built with pre-release SDK parse |
| 31 | apply_prerelease_sdk_hack |
| 32 | |
Alex Buynytskyy | f7a5e2f | 2023-04-14 11:50:04 -0700 | [diff] [blame] | 33 | # in REL mode, resources would correctly set the resources_sdk_int, no fix required |
| 34 | revert_resources_sdk_int_fix |
| 35 | |
Alex Buynytskyy | afddc07 | 2023-02-09 22:40:53 +0000 | [diff] [blame] | 36 | # build/make/core/version_defaults.mk |
Alex Buynytskyy | 00a88ec | 2023-05-05 22:10:53 +0000 | [diff] [blame] | 37 | # Mark all versions "released". |
| 38 | sed -i 's/\(PLATFORM_VERSION_CODENAME\.[^[:space:]]*\) := [^[:space:]]*/\1 := REL/g' "$top/build/make/core/version_defaults.mk" |
Alex Buynytskyy | afddc07 | 2023-02-09 22:40:53 +0000 | [diff] [blame] | 39 | |
| 40 | # cts |
Alex Buynytskyy | 0fa58fa | 2023-02-13 20:22:10 +0000 | [diff] [blame] | 41 | echo "$FINAL_PLATFORM_VERSION" > "$top/cts/tests/tests/os/assets/platform_versions.txt" |
Alex Buynytskyy | bdcef7b | 2023-02-19 18:40:44 +0000 | [diff] [blame] | 42 | if [ "$FINAL_PLATFORM_CODENAME" != "$CURRENT_PLATFORM_CODENAME" ]; then |
| 43 | echo "$CURRENT_PLATFORM_CODENAME" >> "./cts/tests/tests/os/assets/platform_versions.txt" |
| 44 | fi |
Alex Buynytskyy | 0fa58fa | 2023-02-13 20:22:10 +0000 | [diff] [blame] | 45 | git -C "$top/cts" mv hostsidetests/theme/assets/${FINAL_PLATFORM_CODENAME} hostsidetests/theme/assets/${FINAL_PLATFORM_SDK_VERSION} |
Alex Buynytskyy | afddc07 | 2023-02-09 22:40:53 +0000 | [diff] [blame] | 46 | |
| 47 | # system/sepolicy |
Alex Buynytskyy | 0fa58fa | 2023-02-13 20:22:10 +0000 | [diff] [blame] | 48 | mkdir -p "$top/system/sepolicy/prebuilts/api/${FINAL_PLATFORM_SDK_VERSION}.0/" |
| 49 | cp -r "$top/system/sepolicy/public/" "$top/system/sepolicy/prebuilts/api/${FINAL_PLATFORM_SDK_VERSION}.0/" |
| 50 | cp -r "$top/system/sepolicy/private/" "$top/system/sepolicy/prebuilts/api/${FINAL_PLATFORM_SDK_VERSION}.0/" |
Alex Buynytskyy | afddc07 | 2023-02-09 22:40:53 +0000 | [diff] [blame] | 51 | |
| 52 | # prebuilts/abi-dumps/ndk |
Hsin-Yi Chen | ebce0d9 | 2023-04-06 15:04:03 +0800 | [diff] [blame] | 53 | mkdir -p "$top/prebuilts/abi-dumps/ndk/$FINAL_PLATFORM_SDK_VERSION" |
| 54 | cp -r "$top/prebuilts/abi-dumps/ndk/current/64/" "$top/prebuilts/abi-dumps/ndk/$FINAL_PLATFORM_SDK_VERSION/" |
Alex Buynytskyy | afddc07 | 2023-02-09 22:40:53 +0000 | [diff] [blame] | 55 | |
Alex Buynytskyy | afddc07 | 2023-02-09 22:40:53 +0000 | [diff] [blame] | 56 | # prebuilts/abi-dumps/platform |
Hsin-Yi Chen | ebce0d9 | 2023-04-06 15:04:03 +0800 | [diff] [blame] | 57 | mkdir -p "$top/prebuilts/abi-dumps/platform/$FINAL_PLATFORM_SDK_VERSION" |
| 58 | cp -r "$top/prebuilts/abi-dumps/platform/current/64/" "$top/prebuilts/abi-dumps/platform/$FINAL_PLATFORM_SDK_VERSION/" |
Alex Buynytskyy | f7a5e2f | 2023-04-14 11:50:04 -0700 | [diff] [blame] | 59 | |
Alex Buynytskyy | 01db2a9 | 2023-04-29 00:04:23 +0000 | [diff] [blame] | 60 | if [ "$FINAL_STATE" != "sdk" ] || [ "$FINAL_PLATFORM_CODENAME" == "$CURRENT_PLATFORM_CODENAME" ] ; then |
Alex Buynytskyy | f7a5e2f | 2023-04-14 11:50:04 -0700 | [diff] [blame] | 61 | # prebuilts/abi-dumps/vndk |
| 62 | mv "$top/prebuilts/abi-dumps/vndk/$CURRENT_PLATFORM_CODENAME" "$top/prebuilts/abi-dumps/vndk/$FINAL_PLATFORM_SDK_VERSION" |
| 63 | fi; |
Alex Buynytskyy | afddc07 | 2023-02-09 22:40:53 +0000 | [diff] [blame] | 64 | } |
| 65 | |
| 66 | finalize_sdk_rel |
| 67 | |