Merge "Finalization script fixes." am: 2ba40b5be6 am: 510ada3933

Original change: https://android-review.googlesource.com/c/platform/build/+/2538137

Change-Id: I19bbf7043b8869d9b17b102e1dd8182d3d11e605
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Alex Buynytskyy 2023-04-17 16:26:32 +00:00 committed by Automerger Merge Worker
commit d0b8fd305b
5 changed files with 82 additions and 8 deletions

View file

@ -8,8 +8,7 @@ function finalize_main_step1() {
if [ "$FINAL_STATE" = "unfinalized" ] ; then
# Build finalization artifacts.
# source $top/build/make/tools/finalization/finalize-aidl-vndk-sdk-resources.sh
echo "Build finalization artifacts."
source $top/build/make/tools/finalization/finalize-aidl-vndk-sdk-resources.sh
fi;
}

View file

@ -8,6 +8,12 @@ function apply_droidstubs_hack() {
fi
}
function apply_resources_sdk_int_fix() {
if ! grep -q 'public static final int RESOURCES_SDK_INT = SDK_INT;' "$top/frameworks/base/core/java/android/os/Build.java" ; then
git -C "$top/frameworks/base" apply --allow-empty ../../build/make/tools/finalization/frameworks_base.apply_resource_sdk_int.diff
fi
}
function finalize_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.
@ -109,7 +115,10 @@ function finalize_aidl_vndk_sdk_resources() {
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 "/:.*$((${FINAL_PLATFORM_SDK_VERSION}-1)),/a \\\t\t\t\"${FINAL_PLATFORM_CODENAME}\": ${FINAL_PLATFORM_SDK_VERSION}," "$top/build/soong/android/api_levels.go"
local codename_version="\"${FINAL_PLATFORM_CODENAME}\": ${FINAL_PLATFORM_SDK_VERSION}"
if ! grep -q "$codename_version" "$top/build/soong/android/api_levels.go" ; then
sed -i -e "/:.*$((${FINAL_PLATFORM_SDK_VERSION}-1)),/a \\\t\t$codename_version," "$top/build/soong/android/api_levels.go"
fi
# cts
echo ${FINAL_PLATFORM_VERSION} > "$top/cts/tests/tests/os/assets/platform_releases.txt"
@ -129,13 +138,17 @@ 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"
apply_resources_sdk_int_fix
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.
set +e
local SDKEXT="packages/modules/SdkExtensions/"
"$top/packages/modules/SdkExtensions/gen_sdk/bump_sdk.sh" ${FINAL_MAINLINE_EXTENSION}
set -e
# Leave the last commit as a set of modified files.
# The code to create a finalization topic will pick it up later.
git -C ${SDKEXT} reset HEAD~1
local version_defaults="$top/build/make/core/version_defaults.mk"
sed -i -e "s/PLATFORM_SDK_EXTENSION_VERSION := .*/PLATFORM_SDK_EXTENSION_VERSION := ${FINAL_MAINLINE_EXTENSION}/g" $version_defaults

View file

@ -8,6 +8,12 @@ function revert_droidstubs_hack() {
fi
}
function revert_resources_sdk_int_fix() {
if grep -q 'public static final int RESOURCES_SDK_INT = SDK_INT;' "$top/frameworks/base/core/java/android/os/Build.java" ; then
git -C "$top/frameworks/base" apply --allow-empty ../../build/make/tools/finalization/frameworks_base.revert_resource_sdk_int.diff
fi
}
function apply_prerelease_sdk_hack() {
if ! grep -q 'STOPSHIP: hack for the pre-release SDK' "$top/frameworks/base/core/java/android/content/pm/parsing/FrameworkParsingPackageUtils.java" ; then
git -C "$top/frameworks/base" apply --allow-empty ../../build/make/tools/finalization/frameworks_base.apply_hack.diff
@ -24,6 +30,9 @@ function finalize_sdk_rel() {
# let the apps built with pre-release SDK parse
apply_prerelease_sdk_hack
# in REL mode, resources would correctly set the resources_sdk_int, no fix required
revert_resources_sdk_int_fix
# 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"
@ -43,12 +52,14 @@ function finalize_sdk_rel() {
mkdir -p "$top/prebuilts/abi-dumps/ndk/$FINAL_PLATFORM_SDK_VERSION"
cp -r "$top/prebuilts/abi-dumps/ndk/current/64/" "$top/prebuilts/abi-dumps/ndk/$FINAL_PLATFORM_SDK_VERSION/"
# prebuilts/abi-dumps/vndk
mv "$top/prebuilts/abi-dumps/vndk/$CURRENT_PLATFORM_CODENAME" "$top/prebuilts/abi-dumps/vndk/$FINAL_PLATFORM_SDK_VERSION"
# prebuilts/abi-dumps/platform
mkdir -p "$top/prebuilts/abi-dumps/platform/$FINAL_PLATFORM_SDK_VERSION"
cp -r "$top/prebuilts/abi-dumps/platform/current/64/" "$top/prebuilts/abi-dumps/platform/$FINAL_PLATFORM_SDK_VERSION/"
if [ "$FINAL_STATE" != "sdk" ] ; then
# prebuilts/abi-dumps/vndk
mv "$top/prebuilts/abi-dumps/vndk/$CURRENT_PLATFORM_CODENAME" "$top/prebuilts/abi-dumps/vndk/$FINAL_PLATFORM_SDK_VERSION"
fi;
}
finalize_sdk_rel

View file

@ -0,0 +1,24 @@
From cdb47fc90b8d6860ec1dc5efada1f9ccd471618b Mon Sep 17 00:00:00 2001
From: Alex Buynytskyy <alexbuy@google.com>
Date: Tue, 11 Apr 2023 22:12:44 +0000
Subject: [PATCH] Don't force +1 for resource resolution.
Bug: 277674088
Fixes: 277674088
Test: boots, no crashes
Change-Id: I17e743a0f1cf6f98fddd40c358dea5a8b9cc7723
---
diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java
index eb47170..4d3e92b 100755
--- a/core/java/android/os/Build.java
+++ b/core/java/android/os/Build.java
@@ -493,7 +493,7 @@
* @hide
*/
@TestApi
- public static final int RESOURCES_SDK_INT = SDK_INT + ACTIVE_CODENAMES.length;
+ public static final int RESOURCES_SDK_INT = SDK_INT;
/**
* The current lowest supported value of app target SDK. Applications targeting

View file

@ -0,0 +1,27 @@
From c7e460bb19071d867cd7ca04282ce42694f4f358 Mon Sep 17 00:00:00 2001
From: Alex Buynytskyy <alexbuy@google.com>
Date: Wed, 12 Apr 2023 01:06:26 +0000
Subject: [PATCH] Revert "Don't force +1 for resource resolution."
It's not required for master.
This reverts commit f1cb683988f81579a76ddbf9993848a4a06dd28c.
Bug: 277674088
Test: boots, no crashes
Change-Id: Ia1692548f26496fdc6f1e4f0557213c7996d6823
---
diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java
index 4d3e92b..eb47170 100755
--- a/core/java/android/os/Build.java
+++ b/core/java/android/os/Build.java
@@ -493,7 +493,7 @@
* @hide
*/
@TestApi
- public static final int RESOURCES_SDK_INT = SDK_INT;
+ public static final int RESOURCES_SDK_INT = SDK_INT + ACTIVE_CODENAMES.length;
/**
* The current lowest supported value of app target SDK. Applications targeting