1#!/bin/bash
2# Copyright 2024 Google Inc. All rights reserved.
3
4# Script to perform a 0th step of Android Finalization: VINTF finalization, create CLs and upload to Gerrit.
5
6set -ex
7
8function commit_step_0_changes() {
9    set +e
10    repo forall -c '\
11        if [[ $(git status --short) ]]; then
12            repo start "'$repo_branch'" ;
13            git add -A . ;
14            git commit -m "Vendor API level $FINAL_BOARD_API_LEVEL is now frozen" \
15                       -m "Ignore-AOSP-First: VINTF $FINAL_BOARD_API_LEVEL Finalization
16Bug: $FINAL_BUG_ID
17Test: build";
18            repo upload '"$repo_upload_dry_run_arg"' --cbr --no-verify -o nokeycheck -t -y . ;
19        fi'
20}
21
22function finalize_step_0_main() {
23    local top="$(dirname "$0")"/../../../..
24    source $top/build/make/tools/finalization/environment.sh
25    local repo_branch="VINTF-$FINAL_BOARD_API_LEVEL-Finalization"
26    source $top/build/make/tools/finalization/command-line-options.sh
27
28    local m="$top/build/soong/soong_ui.bash --make-mode TARGET_RELEASE=next TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug"
29
30    source $top/build/make/tools/finalization/finalize-vintf-resources.sh
31
32    # move all changes to finalization branch/topic and upload to gerrit
33    commit_step_0_changes
34
35    # build to confirm everything is OK
36    AIDL_FROZEN_REL=true $m
37}
38
39finalize_step_0_main $@
40