Merge "More finalization script fixes."

This commit is contained in:
Alex Buynytskyy 2023-02-14 05:23:54 +00:00 committed by Gerrit Code Review
commit aa055f064e
6 changed files with 59 additions and 45 deletions

View file

@ -2,15 +2,15 @@
set -ex
export FINA_BUG_ID='0'
export FINAL_BUG_ID='0'
export FINA_PLATFORM_CODENAME='UpsideDownCake'
export FINA_PLATFORM_CODENAME_JAVA='UPSIDE_DOWN_CAKE'
export FINA_PLATFORM_SDK_VERSION='34'
export FINA_PLATFORM_VERSION='14'
export FINAL_PLATFORM_CODENAME='UpsideDownCake'
export FINAL_PLATFORM_CODENAME_JAVA='UPSIDE_DOWN_CAKE'
export FINAL_PLATFORM_SDK_VERSION='34'
export FINAL_PLATFORM_VERSION='14'
export FINA_BUILD_PREFIX='UP1A'
export FINAL_BUILD_PREFIX='UP1A'
export FINA_MAINLINE_EXTENSION='6'
export FINA_MAINLINE_SDK_COMMIT_MESSAGE=''
export FINA_MAINLINE_SDK_BUILD_ID=0
export FINAL_MAINLINE_EXTENSION='6'
export FINAL_MAINLINE_SDK_COMMIT_MESSAGE=''
export FINAL_MAINLINE_SDK_BUILD_ID=0

View file

@ -6,8 +6,8 @@ function finalize_aidl_vndk_sdk_resources() {
local top="$(dirname "$0")"/../../../..
source $top/build/make/tools/finalization/environment.sh
local SDK_CODENAME="public static final int $FINA_PLATFORM_CODENAME_JAVA = CUR_DEVELOPMENT;"
local SDK_VERSION="public static final int $FINA_PLATFORM_CODENAME_JAVA = $FINA_PLATFORM_SDK_VERSION;"
local SDK_CODENAME="public static final int $FINAL_PLATFORM_CODENAME_JAVA = CUR_DEVELOPMENT;"
local SDK_VERSION="public static final int $FINAL_PLATFORM_CODENAME_JAVA = $FINAL_PLATFORM_SDK_VERSION;"
# default target to modify tree and build SDK
local m="$top/build/soong/soong_ui.bash --make-mode TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug"
@ -16,11 +16,25 @@ function finalize_aidl_vndk_sdk_resources() {
# The full process can be found at (INTERNAL) go/android-sdk-finalization.
# Update references in the codebase to new API version (TODO)
# ...
# bionic/NDK
# Adding __ANDROID_API_<>__.
# If this hasn't done then it's not used and not really needed. Still, let's check and add this.
if ! grep -q "\__.*$((${FINAL_PLATFORM_SDK_VERSION}))" api-level.h ; then
local tmpfile=$(mktemp /tmp/finalization.XXXXXX)
echo "
/** Names the \"${FINAL_PLATFORM_CODENAME:0:1}\" API level ($FINAL_PLATFORM_SDK_VERSION), for comparison against \`__ANDROID_API__\`. */
#define __ANDROID_API_${FINAL_PLATFORM_CODENAME:0:1}__ $FINAL_PLATFORM_SDK_VERSION" > "$tmpfile"
local api_level="$top/bionic/libc/include/android/api-level.h"
sed -i -e "/__.*$((${FINAL_PLATFORM_SDK_VERSION}-1))/r""$tmpfile" $api_level
rm "$tmpfile"
fi
# VNDK definitions for new SDK version
cp "$top/development/vndk/tools/definition-tool/datasets/vndk-lib-extra-list-current.txt" \
"$top/development/vndk/tools/definition-tool/datasets/vndk-lib-extra-list-$FINA_PLATFORM_SDK_VERSION.txt"
"$top/development/vndk/tools/definition-tool/datasets/vndk-lib-extra-list-$FINAL_PLATFORM_SDK_VERSION.txt"
AIDL_TRANSITIVE_FREEZE=true $m aidl-freeze-api create_reference_dumps
@ -39,24 +53,24 @@ function finalize_aidl_vndk_sdk_resources() {
# build/make
local version_defaults="$top/build/make/core/version_defaults.mk"
sed -i -e "s/PLATFORM_SDK_VERSION := .*/PLATFORM_SDK_VERSION := ${FINA_PLATFORM_SDK_VERSION}/g" $version_defaults
sed -i -e "s/PLATFORM_VERSION_LAST_STABLE := .*/PLATFORM_VERSION_LAST_STABLE := ${FINA_PLATFORM_VERSION}/g" $version_defaults
sed -i -e "s/sepolicy_major_vers := .*/sepolicy_major_vers := ${FINA_PLATFORM_SDK_VERSION}/g" "$top/build/make/core/config.mk"
cp "$top/build/make/target/product/gsi/current.txt" "$top/build/make/target/product/gsi/$FINA_PLATFORM_SDK_VERSION.txt"
sed -i -e "s/PLATFORM_SDK_VERSION := .*/PLATFORM_SDK_VERSION := ${FINAL_PLATFORM_SDK_VERSION}/g" $version_defaults
sed -i -e "s/PLATFORM_VERSION_LAST_STABLE := .*/PLATFORM_VERSION_LAST_STABLE := ${FINAL_PLATFORM_VERSION}/g" $version_defaults
sed -i -e "s/sepolicy_major_vers := .*/sepolicy_major_vers := ${FINAL_PLATFORM_SDK_VERSION}/g" "$top/build/make/core/config.mk"
cp "$top/build/make/target/product/gsi/current.txt" "$top/build/make/target/product/gsi/$FINAL_PLATFORM_SDK_VERSION.txt"
# build/soong
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"
sed -i -e "/:.*$((${FINAL_PLATFORM_SDK_VERSION}-1)),/a \\\t\t\t\"${FINAL_PLATFORM_CODENAME}\": ${FINAL_PLATFORM_SDK_VERSION}," "$top/build/soong/android/api_levels.go"
# cts
echo ${FINA_PLATFORM_VERSION} > "$top/cts/tests/tests/os/assets/platform_releases.txt"
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"
echo ${FINAL_PLATFORM_VERSION} > "$top/cts/tests/tests/os/assets/platform_releases.txt"
sed -i -e "s/EXPECTED_SDK = $((${FINAL_PLATFORM_SDK_VERSION}-1))/EXPECTED_SDK = ${FINAL_PLATFORM_SDK_VERSION}/g" "$top/cts/tests/tests/os/src/android/os/cts/BuildVersionTest.java"
# libcore
sed -i "s%$SDK_CODENAME%$SDK_VERSION%g" "$top/libcore/dalvik/src/main/java/dalvik/annotation/compat/VersionCodes.java"
# platform_testing
local version_codes="$top/platform_testing/libraries/compatibility-common-util/src/com/android/compatibility/common/util/VersionCodes.java"
sed -i -e "/=.*$((${FINA_PLATFORM_SDK_VERSION}-1));/a \\ ${SDK_VERSION}" $version_codes
sed -i -e "/=.*$((${FINAL_PLATFORM_SDK_VERSION}-1));/a \\ ${SDK_VERSION}" $version_codes
# Finalize resources
"$top/frameworks/base/tools/aapt2/tools/finalize_res.py" \
@ -65,13 +79,13 @@ function finalize_aidl_vndk_sdk_resources() {
# frameworks/base
sed -i "s%$SDK_CODENAME%$SDK_VERSION%g" "$top/frameworks/base/core/java/android/os/Build.java"
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"
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"
sed -i -e "/=.*$((${FINAL_PLATFORM_SDK_VERSION}-1)),/a \\ SDK_${FINAL_PLATFORM_CODENAME_JAVA} = ${FINAL_PLATFORM_SDK_VERSION}," "$top/frameworks/base/tools/aapt/SdkConstants.h"
sed -i -e "/=.*$((${FINAL_PLATFORM_SDK_VERSION}-1)),/a \\ SDK_${FINAL_PLATFORM_CODENAME_JAVA} = ${FINAL_PLATFORM_SDK_VERSION}," "$top/frameworks/base/tools/aapt2/SdkConstants.h"
# Bump Mainline SDK extension version.
"$top/packages/modules/SdkExtensions/gen_sdk/bump_sdk.sh" ${FINA_MAINLINE_EXTENSION}
"$top/packages/modules/SdkExtensions/gen_sdk/bump_sdk.sh" ${FINAL_MAINLINE_EXTENSION}
local version_defaults="$top/build/make/core/version_defaults.mk"
sed -i -e "s/PLATFORM_SDK_EXTENSION_VERSION := .*/PLATFORM_SDK_EXTENSION_VERSION := ${FINA_MAINLINE_EXTENSION}/g" $version_defaults
sed -i -e "s/PLATFORM_SDK_EXTENSION_VERSION := .*/PLATFORM_SDK_EXTENSION_VERSION := ${FINAL_MAINLINE_EXTENSION}/g" $version_defaults
# Force update current.txt
$m clobber

View file

@ -11,28 +11,28 @@ function finalize_sdk_rel() {
# adb keys
$m adb
LOGNAME=android-eng HOSTNAME=google.com "$top/out/host/linux-x86/bin/adb" keygen "$top/vendor/google/security/adb/${FINA_PLATFORM_VERSION}.adb_key"
LOGNAME=android-eng HOSTNAME=google.com "$top/out/host/linux-x86/bin/adb" keygen "$top/vendor/google/security/adb/${FINAL_PLATFORM_VERSION}.adb_key"
# build/make/core/version_defaults.mk
sed -i -e "s/PLATFORM_VERSION_CODENAME.${BUILD_PREFIX} := .*/PLATFORM_VERSION_CODENAME.${BUILD_PREFIX} := REL/g" "$top/build/make/core/version_defaults.mk"
sed -i -e "s/PLATFORM_VERSION_CODENAME.${FINAL_BUILD_PREFIX} := .*/PLATFORM_VERSION_CODENAME.${FINAL_BUILD_PREFIX} := REL/g" "$top/build/make/core/version_defaults.mk"
# cts
echo "$FINA_PLATFORM_VERSION" > "$top/cts/tests/tests/os/assets/platform_versions.txt"
git -C "$top/cts" mv hostsidetests/theme/assets/${FINA_PLATFORM_CODENAME} hostsidetests/theme/assets/${FINA_PLATFORM_SDK_VERSION}
echo "$FINAL_PLATFORM_VERSION" > "$top/cts/tests/tests/os/assets/platform_versions.txt"
git -C "$top/cts" mv hostsidetests/theme/assets/${FINAL_PLATFORM_CODENAME} hostsidetests/theme/assets/${FINAL_PLATFORM_SDK_VERSION}
# system/sepolicy
mkdir -p "$top/system/sepolicy/prebuilts/api/${FINA_PLATFORM_SDK_VERSION}.0/"
cp -r "$top/system/sepolicy/public/" "$top/system/sepolicy/prebuilts/api/${FINA_PLATFORM_SDK_VERSION}.0/"
cp -r "$top/system/sepolicy/private/" "$top/system/sepolicy/prebuilts/api/${FINA_PLATFORM_SDK_VERSION}.0/"
mkdir -p "$top/system/sepolicy/prebuilts/api/${FINAL_PLATFORM_SDK_VERSION}.0/"
cp -r "$top/system/sepolicy/public/" "$top/system/sepolicy/prebuilts/api/${FINAL_PLATFORM_SDK_VERSION}.0/"
cp -r "$top/system/sepolicy/private/" "$top/system/sepolicy/prebuilts/api/${FINAL_PLATFORM_SDK_VERSION}.0/"
# prebuilts/abi-dumps/ndk
mv "$top/prebuilts/abi-dumps/ndk/current" "$top/prebuilts/abi-dumps/ndk/$FINA_PLATFORM_SDK_VERSION"
mv "$top/prebuilts/abi-dumps/ndk/current" "$top/prebuilts/abi-dumps/ndk/$FINAL_PLATFORM_SDK_VERSION"
# prebuilts/abi-dumps/vndk
mv "$top/prebuilts/abi-dumps/vndk/$FINA_PLATFORM_CODENAME" "$top/prebuilts/abi-dumps/vndk/$FINA_PLATFORM_SDK_VERSION"
mv "$top/prebuilts/abi-dumps/vndk/$FINAL_PLATFORM_CODENAME" "$top/prebuilts/abi-dumps/vndk/$FINAL_PLATFORM_SDK_VERSION"
# prebuilts/abi-dumps/platform
mv "$top/prebuilts/abi-dumps/platform/current" "$top/prebuilts/abi-dumps/platform/$FINA_PLATFORM_SDK_VERSION"
mv "$top/prebuilts/abi-dumps/platform/current" "$top/prebuilts/abi-dumps/platform/$FINAL_PLATFORM_SDK_VERSION"
}
finalize_sdk_rel

View file

@ -10,7 +10,7 @@ function finalize_locally_mainline_sdk() {
TARGET_BUILD_VARIANT=userdebug UNBUNDLED_BUILD_SDKS_FROM_SOURCE=true "$top/vendor/google/build/mainline_modules_sdks.sh"
# Update prebuilts.
"$top/prebuilts/build-tools/path/linux-x86/python3" "$top/packages/modules/common/tools/finalize_sdk.py" -l -b 0 -f ${FINA_MAINLINE_EXTENSION} -r '' 0
"$top/prebuilts/build-tools/path/linux-x86/python3" "$top/packages/modules/common/tools/finalize_sdk.py" -l -b 0 -f ${FINAL_MAINLINE_EXTENSION} -r '' 0
}
finalize_locally_mainline_sdk

View file

@ -7,11 +7,11 @@ function commit_step_1_changes() {
set +e
repo forall -c '\
if [[ $(git status --short) ]]; then
repo start "$FINA_PLATFORM_CODENAME-SDK-Finalization" ;
repo start "$FINAL_PLATFORM_CODENAME-SDK-Finalization" ;
git add -A . ;
git commit -m "$FINA_PLATFORM_CODENAME is now $FINA_PLATFORM_SDK_VERSION" \
-m "Ignore-AOSP-First: $FINA_PLATFORM_CODENAME Finalization
Bug: $FINA_BUG_ID
git commit -m "$FINAL_PLATFORM_CODENAME is now $FINAL_PLATFORM_SDK_VERSION" \
-m "Ignore-AOSP-First: $FINAL_PLATFORM_CODENAME Finalization
Bug: $FINAL_BUG_ID
Test: build";
repo upload --cbr --no-verify -o nokeycheck -t -y . ;
git clean -fdx ; git reset --hard ;

View file

@ -4,11 +4,11 @@
function commit_step_2_changes() {
repo forall -c '\
if [[ $(git status --short) ]]; then
repo start "$FINA_PLATFORM_CODENAME-SDK-Finalization-Rel" ;
repo start "$FINAL_PLATFORM_CODENAME-SDK-Finalization-Rel" ;
git add -A . ;
git commit -m "$FINA_PLATFORM_CODENAME/$FINA_PLATFORM_SDK_VERSION is now REL" \
-m "Ignore-AOSP-First: $FINA_PLATFORM_CODENAME Finalization
Bug: $FINA_BUG_ID
git commit -m "$FINAL_PLATFORM_CODENAME/$FINAL_PLATFORM_SDK_VERSION is now REL" \
-m "Ignore-AOSP-First: $FINAL_PLATFORM_CODENAME Finalization
Bug: $FINAL_BUG_ID
Test: build";
repo upload --cbr --no-verify -o nokeycheck -t -y . ;
@ -26,7 +26,7 @@ function finalize_step_2_main() {
source $top/build/make/tools/finalization/finalize-sdk-rel.sh
# Update prebuilts.
"$top/prebuilts/build-tools/path/linux-x86/python3" "$top/packages/modules/common/tools/finalize_sdk.py" -b ${FINA_BUG_ID} -f ${FINA_MAINLINE_EXTENSION} -r "${FINA_MAINLINE_SDK_COMMIT_MESSAGE}" ${FINA_MAINLINE_SDK_BUILD_ID}
"$top/prebuilts/build-tools/path/linux-x86/python3" "$top/packages/modules/common/tools/finalize_sdk.py" -b ${FINAL_BUG_ID} -f ${FINAL_MAINLINE_EXTENSION} -r "${FINAL_MAINLINE_SDK_COMMIT_MESSAGE}" ${FINAL_MAINLINE_SDK_BUILD_ID}
# build to confirm everything is OK
AIDL_FROZEN_REL=true $m