diff --git a/tools/finalization/README.md b/tools/finalization/README.md new file mode 100644 index 0000000000..501f2605a8 --- /dev/null +++ b/tools/finalization/README.md @@ -0,0 +1,22 @@ +# Finalization tools +This folder contains automation and CI scripts for [finalizing](https://go/android-finalization) Android before release. + +## Automation: +1. [Environment setup](./environment.sh). Set values for varios finalization constants. +2. [Finalize SDK](./finalize-aidl-vndk-sdk-resources.sh). Prepare the branch for SDK release. SDK contains Android Java APIs and other stable APIs. Commonly referred as a 1st step. +3. [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. +4. [Finalize SDK and submit](./step-1.sh). Do [Finalize SDK](./finalize-aidl-vndk-sdk-resources.sh) step, create CLs, organize them into topic and send to Gerrit. + a. [Update SDK and submit](./update-step-1.sh). Same as above, but updates the existings CLs. +5. [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. + a. [Update Android and submit](./update-step-2.sh). Same as above, but updates the existings CLs. + +## CI: +Performed in build targets in Finalization branches. +1. [Finalization Step 1 for Main, git_main-fina-1-release](https://android-build.googleplex.com/builds/branches/git_main-fina-1-release/grid). Test [1st step/Finalize SDK](./finalize-aidl-vndk-sdk-resources.sh). +2. [Finalization Step 1 for UDC, git_udc-fina-1-release](https://android-build.googleplex.com/builds/branches/git_udc-fina-1-release/grid). Same but for udc-dev. +3. [Finalization Step 2 for Main, git_main-fina-2-release](https://android-build.googleplex.com/builds/branches/git_main-fina-2-release/grid). Test [1st step/Finalize SDK](./finalize-aidl-vndk-sdk-resources.sh) and [2nd step/Finalize Android](./finalize-sdk-rel.sh). Use [local finalization](./localonly-steps.sh) to build and copy presubmits. +4. [Finalization Step 2 for UDC, git_udc-fina-2-release](https://android-build.googleplex.com/builds/branches/git_udc-fina-2-release/grid). Same but for udc-dev. +5. [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. + +## Utility: +[Full cleanup](./cleanup.sh). Remove all local changes and switch each project into head-less state. This is the best state to sync/rebase/finalize the branch. diff --git a/tools/finalization/build-step-1-and-2.sh b/tools/finalization/build-step-1-and-2.sh index 1b749b106f..a5aba0806b 100755 --- a/tools/finalization/build-step-1-and-2.sh +++ b/tools/finalization/build-step-1-and-2.sh @@ -9,8 +9,8 @@ function finalize_main_step12() { # SDK codename -> int source $top/build/make/tools/finalization/finalize-aidl-vndk-sdk-resources.sh - # Platform/Mainline SDKs build and move to prebuilts - source $top/build/make/tools/finalization/localonly-finalize-mainline-sdk.sh + # ADB, Platform/Mainline SDKs build and move to prebuilts + source $top/build/make/tools/finalization/localonly-steps.sh # REL source $top/build/make/tools/finalization/finalize-sdk-rel.sh diff --git a/tools/finalization/localonly-finalize-mainline-sdk.sh b/tools/finalization/localonly-steps.sh similarity index 93% rename from tools/finalization/localonly-finalize-mainline-sdk.sh rename to tools/finalization/localonly-steps.sh index 2b77c5dbbd..6107b3e090 100755 --- a/tools/finalization/localonly-finalize-mainline-sdk.sh +++ b/tools/finalization/localonly-steps.sh @@ -2,7 +2,7 @@ set -ex -function finalize_locally_mainline_sdk() { +function finalize_locally() { local top="$(dirname "$0")"/../../../.. source $top/build/make/tools/finalization/environment.sh @@ -23,5 +23,4 @@ function finalize_locally_mainline_sdk() { "$top/prebuilts/build-tools/path/linux-x86/python3" -W ignore::DeprecationWarning "$top/prebuilts/sdk/update_prebuilts.py" --local_mode -f ${FINAL_PLATFORM_SDK_VERSION} -e ${FINAL_MAINLINE_EXTENSION} --bug 1 1 } -finalize_locally_mainline_sdk - +finalize_locally diff --git a/tools/finalization/update-step-1.sh b/tools/finalization/update-step-1.sh new file mode 100644 index 0000000000..fd07b7b22a --- /dev/null +++ b/tools/finalization/update-step-1.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# Script to perform a 1st step of Android Finalization: API/SDK finalization, update CLs and upload to Gerrit. + +set -ex + +function update_step_1_changes() { + set +e + repo forall -c '\ + if [[ $(git status --short) ]]; then + git stash -u ; + repo start "$FINAL_PLATFORM_CODENAME-SDK-Finalization" ; + git stash pop ; + git add -A . ; + git commit --amend --no-edit ; + repo upload --cbr --no-verify -o nokeycheck -t -y . ; + fi' +} + +function update_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" + + # vndk etc finalization + source $top/build/make/tools/finalization/finalize-aidl-vndk-sdk-resources.sh + + # update existing CLs and upload to gerrit + update_step_1_changes + + # build to confirm everything is OK + AIDL_FROZEN_REL=true $m +} + +update_step_1_main diff --git a/tools/finalization/update-step-2.sh b/tools/finalization/update-step-2.sh new file mode 100755 index 0000000000..e65d35a3ee --- /dev/null +++ b/tools/finalization/update-step-2.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# Script to perform a 2nd step of Android Finalization: REL finalization, create CLs and upload to Gerrit. + +function update_step_2_changes() { + set +e + repo forall -c '\ + if [[ $(git status --short) ]]; then + git stash -u ; + repo start "$FINAL_PLATFORM_CODENAME-SDK-Finalization-Rel" ; + git stash pop ; + git add -A . ; + git commit --amend --no-edit ; + repo upload --cbr --no-verify -o nokeycheck -t -y . ; + fi' +} + +function update_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" + + # prebuilts etc + source $top/build/make/tools/finalization/finalize-sdk-rel.sh + + # move all changes to finalization branch/topic and upload to gerrit + update_step_2_changes + + # build to confirm everything is OK + AIDL_FROZEN_REL=true $m +} + +update_step_2_main