1#!/bin/bash
2
3set -ex
4
5function finalize_vintf_resources() {
6    local top="$(dirname "$0")"/../../../..
7    source $top/build/make/tools/finalization/environment.sh
8    # environment needed to build dependencies and run scripts
9    # These should remain the same for all steps here to speed up build time
10    export ANDROID_BUILD_TOP="$top"
11    export ANDROID_HOST_OUT="$ANDROID_BUILD_TOP/out/host/linux-x86"
12    export ANDROID_PRODUCT_OUT="$ANDROID_BUILD_TOP/out/target/product/generic_arm64"
13    export PATH="$PATH:$ANDROID_HOST_OUT/bin/"
14    export TARGET_BUILD_VARIANT=userdebug
15    export DIST_DIR=out/dist
16    export TARGET_RELEASE=fina_0
17    export TARGET_PRODUCT=aosp_arm64
18
19    # system/sepolicy
20    "$top/system/sepolicy/tools/finalize-vintf-resources.sh" "$top" "$FINAL_BOARD_API_LEVEL"
21
22    create_new_compat_matrix_and_kernel_configs
23
24    # pre-finalization build target (trunk)
25    local aidl_m="$top/build/soong/soong_ui.bash --make-mode"
26    AIDL_TRANSITIVE_FREEZE=true $aidl_m aidl-freeze-api create_reference_dumps
27
28    # Generate LLNDK ABI dumps
29    # This command depends on ANDROID_BUILD_TOP
30    "$ANDROID_HOST_OUT/bin/create_reference_dumps" -release "$TARGET_RELEASE" --build-variant "$TARGET_BUILD_VARIANT" --lib-variant LLNDK
31}
32
33function create_new_compat_matrix_and_kernel_configs() {
34    # The compatibility matrix versions are bumped during vFRC
35    # These will change every time we have a new vFRC
36    local CURRENT_COMPATIBILITY_MATRIX_LEVEL='202404'
37    local NEXT_COMPATIBILITY_MATRIX_LEVEL='202504'
38    # The kernel configs need the letter of the Android release
39    local CURRENT_RELEASE_LETTER='v'
40    local NEXT_RELEASE_LETTER='w'
41
42
43    # build the targets required before touching the Android.bp/Android.mk files
44    local build_cmd="$top/build/soong/soong_ui.bash --make-mode"
45    $build_cmd bpmodify
46
47    "$top/prebuilts/build-tools/path/linux-x86/python3" "$top/hardware/interfaces/compatibility_matrices/bump.py" "$CURRENT_COMPATIBILITY_MATRIX_LEVEL" "$NEXT_COMPATIBILITY_MATRIX_LEVEL" "$CURRENT_RELEASE_LETTER" "$NEXT_RELEASE_LETTER"
48
49    # Freeze the current framework manifest file. This relies on the
50    # aosp_cf_x86_64-trunk_staging build target to get the right manifest
51    # fragments installed.
52    "$top/system/libhidl/vintfdata/freeze.sh" "$CURRENT_COMPATIBILITY_MATRIX_LEVEL"
53}
54
55function freeze_framework_manifest() {
56   ANDROID_PRODUCT_OUT=~/workspace/internal/main/out/target/product/vsoc_x86 ANDROID_BUILD_TOP=~/workspace/internal/main ANDROID_HOST_OUT=~/workspace/internal/main/out/host/linux-x86 ./freeze.sh 202404
57
58}
59
60
61finalize_vintf_resources
62
63