diff --git a/tools/finalization/README.md b/tools/finalization/README.md index 3e0af00d42..d0aed69ae2 100644 --- a/tools/finalization/README.md +++ b/tools/finalization/README.md @@ -6,11 +6,13 @@ This folder contains automation and CI scripts for [finalizing](https://go/andro 1. [Finalize VINTF](./finalize-vintf-resources.sh). Prepare the branch for VINTF release. 1. [Finalize SDK](./finalize-sdk-resources.sh). Prepare the branch for SDK release. SDK contains Android Java APIs and other stable APIs. Commonly referred as a 1st step. 1. [Finalize Android](./finalize-sdk-rel.sh). Mark branch as "REL", i.e. prepares for Android release. Any signed build containing these changes will be considered an official Android Release. Referred as a 2nd finalization step. -1. [Finalize SDK and submit](./step-1.sh). Do Finalize VINTF and Finalize SDK step, create CLs, organize them into topic and send to Gerrit. +1. [Finalize VINTF and submit](./step-0.sh). Do Finalize VINTF step, create CLs, organize them into topic and send to Gerrit. +1. [Finalize SDK and submit](./step-1.sh). Do Finalize SDK step, create CLs, organize them into topic and send to Gerrit. 1. [Finalize Android and submit](./step-2.sh). Do [Finalize Android](./finalize-sdk-rel.sh) step, create CLs, organize them into topic and send to Gerrit. ## CI: Performed in build targets in Finalization branches. +1. [Finalization Step 0, git_main-fina-0-release](https://android-build.corp.google.com/build_explorer/branch/git_main-fina-0-release). Test Finalize VINTF. 1. [Finalization Step 1, git_main-fina-1-release](https://android-build.corp.google.com/build_explorer/branch/git_main-fina-1-release). Test Finalize VINTF, Finalize SDK. 1. [Finalization Step 2, git_main-fina-2-release](https://android-build.corp.google.com/build_explorer/branch/git_main-fina-2-release). Test Finalize VINTF, Finalize SDK, and [2nd step/Finalize Android](./finalize-sdk-rel.sh). Use [local finalization](./localonly-steps.sh) to build and copy presubmits. 1. [Local finalization steps](./localonly-steps.sh) are done only during local testing or in the CI lab. Normally these steps use artifacts from other builds. diff --git a/tools/finalization/build-step-0.sh b/tools/finalization/build-step-0.sh new file mode 100755 index 0000000000..f81b720b2d --- /dev/null +++ b/tools/finalization/build-step-0.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# Copyright 2024 Google Inc. All rights reserved. + +set -ex + +function finalize_main_step0() { + local top="$(dirname "$0")"/../../../.. + source $top/build/make/tools/finalization/environment.sh + + if [ "$FINAL_STATE" = "unfinalized" ] ; then + # VINTF finalization + source $top/build/make/tools/finalization/finalize-vintf-resources.sh + fi; +} + +finalize_main_step0 + diff --git a/tools/finalization/build-step-1-and-2.sh b/tools/finalization/build-step-1-and-2.sh index 33d45d5808..ca2267824c 100755 --- a/tools/finalization/build-step-1-and-2.sh +++ b/tools/finalization/build-step-1-and-2.sh @@ -7,12 +7,16 @@ function finalize_main_step12() { source $top/build/make/tools/finalization/environment.sh if [ "$FINAL_STATE" = "unfinalized" ] ; then - # SDK codename -> int + # VINTF finalization source $top/build/make/tools/finalization/finalize-vintf-resources.sh + fi; + + if [ "$FINAL_STATE" = "unfinalized" ] || [ "$FINAL_STATE" = "vintf" ] ; then + # SDK codename -> int source $top/build/make/tools/finalization/finalize-sdk-resources.sh fi; - if [ "$FINAL_STATE" = "unfinalized" ] || [ "$FINAL_STATE" = "sdk" ] ; then + if [ "$FINAL_STATE" = "unfinalized" ] || [ "$FINAL_STATE" = "vintf" ] || [ "$FINAL_STATE" = "sdk" ] ; then # ADB, Platform/Mainline SDKs build and move to prebuilts source $top/build/make/tools/finalization/localonly-steps.sh diff --git a/tools/finalization/build-step-1.sh b/tools/finalization/build-step-1.sh index 88d75faa93..72946987f8 100755 --- a/tools/finalization/build-step-1.sh +++ b/tools/finalization/build-step-1.sh @@ -7,8 +7,12 @@ function finalize_main_step1() { source $top/build/make/tools/finalization/environment.sh if [ "$FINAL_STATE" = "unfinalized" ] ; then - # Build finalization artifacts. + # VINTF finalization source $top/build/make/tools/finalization/finalize-vintf-resources.sh + fi; + + if [ "$FINAL_STATE" = "unfinalized" ] || [ "$FINAL_STATE" = "vintf" ] ; then + # Build finalization artifacts. source $top/build/make/tools/finalization/finalize-sdk-resources.sh fi; } diff --git a/tools/finalization/environment.sh b/tools/finalization/environment.sh index b2d75bbcfc..701f79752e 100755 --- a/tools/finalization/environment.sh +++ b/tools/finalization/environment.sh @@ -19,11 +19,14 @@ export FINAL_MAINLINE_EXTENSION='58' # Options: # 'unfinalized' - branch is in development state, -# 'sdk' - SDK/API is finalized +# 'vintf' - VINTF is finalized +# 'sdk' - VINTF and SDK/API are finalized # 'rel' - branch is finalized, switched to REL export FINAL_STATE='unfinalized' export BUILD_FROM_SOURCE_STUB=true # FINAL versions for VINTF -export FINAL_BOARD_API_LEVEL=$(TARGET_RELEASE=fina_1 $top/build/soong/soong_ui.bash --dumpvar-mode RELEASE_BOARD_API_LEVEL) +# TODO(b/323985297): The version must match with that from the release configuration. +# Instead of hardcoding the version here, read it from a release configuration. +export FINAL_BOARD_API_LEVEL='202404' diff --git a/tools/finalization/finalize-vintf-resources.sh b/tools/finalization/finalize-vintf-resources.sh index 362d9f7ed4..c865bbf5b6 100755 --- a/tools/finalization/finalize-vintf-resources.sh +++ b/tools/finalization/finalize-vintf-resources.sh @@ -14,7 +14,7 @@ function finalize_vintf_resources() { create_new_compat_matrix # pre-finalization build target (trunk) - local aidl_m="$top/build/soong/soong_ui.bash --make-mode TARGET_PRODUCT=aosp_arm64 TARGET_RELEASE=trunk TARGET_BUILD_VARIANT=userdebug DIST_DIR=out/dist" + local aidl_m="$top/build/soong/soong_ui.bash --make-mode TARGET_PRODUCT=aosp_arm64 TARGET_RELEASE=fina_0 TARGET_BUILD_VARIANT=userdebug DIST_DIR=out/dist" AIDL_TRANSITIVE_FREEZE=true $aidl_m aidl-freeze-api } @@ -42,7 +42,7 @@ function create_new_compat_matrix() { fi # build the targets required before touching the Android.bp/Android.mk files - local build_cmd="$top/build/soong/soong_ui.bash --make-mode TARGET_PRODUCT=aosp_arm64 TARGET_RELEASE=trunk TARGET_BUILD_VARIANT=userdebug DIST_DIR=out/dist" + local build_cmd="$top/build/soong/soong_ui.bash --make-mode TARGET_PRODUCT=aosp_arm64 TARGET_RELEASE=fina_0 TARGET_BUILD_VARIANT=userdebug DIST_DIR=out/dist" $build_cmd bpfmt $build_cmd bpmodify $build_cmd queryview diff --git a/tools/finalization/step-0.sh b/tools/finalization/step-0.sh new file mode 100755 index 0000000000..e61c644de0 --- /dev/null +++ b/tools/finalization/step-0.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# Copyright 2024 Google Inc. All rights reserved. + +# Script to perform a 0th step of Android Finalization: VINTF finalization, create CLs and upload to Gerrit. + +set -ex + +function commit_step_0_changes() { + set +e + repo forall -c '\ + if [[ $(git status --short) ]]; then + repo start "VINTF-$FINAL_BOARD_API_LEVEL-Finalization" ; + git add -A . ; + git commit -m "Vendor API level $FINAL_BOARD_API_LEVEL is now frozen" \ + -m "Ignore-AOSP-First: VINTF $FINAL_BOARD_API_LEVEL Finalization +Bug: $FINAL_BUG_ID +Test: build"; + repo upload --cbr --no-verify -o nokeycheck -t -y . ; + fi' +} + +function finalize_step_0_main() { + local top="$(dirname "$0")"/../../../.. + source $top/build/make/tools/finalization/environment.sh + + local m="$top/build/soong/soong_ui.bash --make-mode TARGET_RELEASE=next TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug" + + source $top/build/make/tools/finalization/finalize-vintf-resources.sh + + # move all changes to finalization branch/topic and upload to gerrit + commit_step_0_changes + + # build to confirm everything is OK + AIDL_FROZEN_REL=true $m +} + +finalize_step_0_main diff --git a/tools/finalization/step-1.sh b/tools/finalization/step-1.sh index 65c82539f9..0e483d5510 100755 --- a/tools/finalization/step-1.sh +++ b/tools/finalization/step-1.sh @@ -21,9 +21,8 @@ function finalize_step_1_main() { local top="$(dirname "$0")"/../../../.. source $top/build/make/tools/finalization/environment.sh - local m="$top/build/soong/soong_ui.bash --make-mode TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug" + local m="$top/build/soong/soong_ui.bash --make-mode TARGET_RELEASE=next TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug" - source $top/build/make/tools/finalization/finalize-vintf-resources.sh source $top/build/make/tools/finalization/finalize-sdk-resources.sh # move all changes to finalization branch/topic and upload to gerrit diff --git a/tools/finalization/step-2.sh b/tools/finalization/step-2.sh index d0b24ae1fc..356cad023d 100755 --- a/tools/finalization/step-2.sh +++ b/tools/finalization/step-2.sh @@ -19,7 +19,7 @@ function finalize_step_2_main() { local top="$(dirname "$0")"/../../../.. source $top/build/make/tools/finalization/environment.sh - local m="$top/build/soong/soong_ui.bash --make-mode TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug" + local m="$top/build/soong/soong_ui.bash --make-mode TARGET_RELEASE=next TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug" # prebuilts etc source $top/build/make/tools/finalization/finalize-sdk-rel.sh