Alex Buynytskyy | afddc07 | 2023-02-09 22:40:53 +0000 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | |
| 3 | set -ex |
| 4 | |
| 5 | function finalize_aidl_vndk_sdk_resources() { |
| 6 | local top="$(dirname "$0")"/../../../.. |
| 7 | source $top/build/make/tools/finalization/environment.sh |
| 8 | |
| 9 | local SDK_CODENAME="public static final int $FINA_PLATFORM_CODENAME_JAVA = CUR_DEVELOPMENT;" |
| 10 | local SDK_VERSION="public static final int $FINA_PLATFORM_CODENAME_JAVA = $FINA_PLATFORM_SDK_VERSION;" |
| 11 | |
| 12 | # default target to modify tree and build SDK |
| 13 | local m="$top/build/soong/soong_ui.bash --make-mode TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug" |
| 14 | |
| 15 | # This script is WIP and only finalizes part of the Android branch for release. |
| 16 | # The full process can be found at (INTERNAL) go/android-sdk-finalization. |
| 17 | |
| 18 | # Update references in the codebase to new API version (TODO) |
| 19 | # ... |
| 20 | |
| 21 | # VNDK definitions for new SDK version |
| 22 | cp "$top/development/vndk/tools/definition-tool/datasets/vndk-lib-extra-list-current.txt" \ |
| 23 | "$top/development/vndk/tools/definition-tool/datasets/vndk-lib-extra-list-$FINA_PLATFORM_SDK_VERSION.txt" |
| 24 | |
| 25 | AIDL_TRANSITIVE_FREEZE=true $m aidl-freeze-api create_reference_dumps |
| 26 | |
| 27 | # Generate ABI dumps |
| 28 | ANDROID_BUILD_TOP="$top" \ |
| 29 | out/host/linux-x86/bin/create_reference_dumps \ |
| 30 | -p aosp_arm64 --build-variant user |
| 31 | |
| 32 | echo "NOTE: THIS INTENTIONALLY MAY FAIL AND REPAIR ITSELF (until 'DONE')" |
| 33 | # Update new versions of files. See update-vndk-list.sh (which requires envsetup.sh) |
| 34 | $m check-vndk-list || \ |
| 35 | { cp $top/out/soong/vndk/vndk.libraries.txt $top/build/make/target/product/gsi/current.txt; } |
| 36 | echo "DONE: THIS INTENTIONALLY MAY FAIL AND REPAIR ITSELF" |
| 37 | |
| 38 | # Finalize SDK |
| 39 | |
| 40 | # build/make |
| 41 | local version_defaults="$top/build/make/core/version_defaults.mk" |
| 42 | sed -i -e "s/PLATFORM_SDK_VERSION := .*/PLATFORM_SDK_VERSION := ${FINA_PLATFORM_SDK_VERSION}/g" $version_defaults |
| 43 | sed -i -e "s/PLATFORM_VERSION_LAST_STABLE := .*/PLATFORM_VERSION_LAST_STABLE := ${FINA_PLATFORM_VERSION}/g" $version_defaults |
| 44 | sed -i -e "s/sepolicy_major_vers := .*/sepolicy_major_vers := ${FINA_PLATFORM_SDK_VERSION}/g" "$top/build/make/core/config.mk" |
| 45 | cp "$top/build/make/target/product/gsi/current.txt" "$top/build/make/target/product/gsi/$FINA_PLATFORM_SDK_VERSION.txt" |
| 46 | |
| 47 | # build/soong |
| 48 | sed -i -e "/:.*$((${FINA_PLATFORM_SDK_VERSION}-1)),/a \\\t\t\t\"${FINA_PLATFORM_CODENAME}\": ${FINA_PLATFORM_SDK_VERSION}," "$top/build/soong/android/api_levels.go" |
| 49 | |
| 50 | # cts |
| 51 | echo ${FINA_PLATFORM_VERSION} > "$top/cts/tests/tests/os/assets/platform_releases.txt" |
| 52 | sed -i -e "s/EXPECTED_SDK = $((${FINA_PLATFORM_SDK_VERSION}-1))/EXPECTED_SDK = ${FINA_PLATFORM_SDK_VERSION}/g" "$top/cts/tests/tests/os/src/android/os/cts/BuildVersionTest.java" |
| 53 | |
| 54 | # libcore |
| 55 | sed -i "s%$SDK_CODENAME%$SDK_VERSION%g" "$top/libcore/dalvik/src/main/java/dalvik/annotation/compat/VersionCodes.java" |
| 56 | |
| 57 | # platform_testing |
| 58 | local version_codes="$top/platform_testing/libraries/compatibility-common-util/src/com/android/compatibility/common/util/VersionCodes.java" |
| 59 | sed -i -e "/=.*$((${FINA_PLATFORM_SDK_VERSION}-1));/a \\ ${SDK_VERSION}" $version_codes |
| 60 | |
| 61 | # Finalize resources |
| 62 | "$top/frameworks/base/tools/aapt2/tools/finalize_res.py" \ |
| 63 | "$top/frameworks/base/core/res/res/values/public-staging.xml" \ |
| 64 | "$top/frameworks/base/core/res/res/values/public-final.xml" |
| 65 | |
| 66 | # frameworks/base |
| 67 | sed -i "s%$SDK_CODENAME%$SDK_VERSION%g" "$top/frameworks/base/core/java/android/os/Build.java" |
| 68 | sed -i -e "/=.*$((${FINA_PLATFORM_SDK_VERSION}-1)),/a \\ SDK_${FINA_PLATFORM_CODENAME_JAVA} = ${FINA_PLATFORM_SDK_VERSION}," "$top/frameworks/base/tools/aapt/SdkConstants.h" |
| 69 | sed -i -e "/=.*$((${FINA_PLATFORM_SDK_VERSION}-1)),/a \\ SDK_${FINA_PLATFORM_CODENAME_JAVA} = ${FINA_PLATFORM_SDK_VERSION}," "$top/frameworks/base/tools/aapt2/SdkConstants.h" |
| 70 | |
| 71 | # Bump Mainline SDK extension version. |
| 72 | "$top/packages/modules/SdkExtensions/gen_sdk/bump_sdk.sh" ${MAINLINE_EXTENSION} |
| 73 | local version_defaults="$top/build/make/core/version_defaults.mk" |
| 74 | sed -i -e "s/PLATFORM_SDK_EXTENSION_VERSION := .*/PLATFORM_SDK_EXTENSION_VERSION := ${MAINLINE_EXTENSION}/g" $version_defaults |
| 75 | |
| 76 | # Force update current.txt |
| 77 | $m clobber |
| 78 | $m update-api |
| 79 | } |
| 80 | |
| 81 | finalize_aidl_vndk_sdk_resources |
| 82 | |