blob: c633dabb764649b4dffbe035edccb1e7968ead1c [file] [log] [blame]
Steven Moreland0f84e4b2023-12-16 02:51:26 +00001#!/bin/bash
2
3set -ex
4
5function finalize_vintf_resources() {
Justin Yun651a3a02024-12-13 15:16:01 +09006 if [ $# -gt 1 ]; then
7 echo "No argument or '--steps_for_build_test_only' is allowed"
8 exit 1
9 fi
10 if [ $# -eq 1 ]; then
11 if [ "$1" == "--steps_for_build_test_only" ]; then
12 echo "This is only to verify building a target."
13 echo "Skip LLNDK ABI dump and VINTF check."
14 local build_test_only=true
15 else
16 echo "Unknown argument $1"
17 exit 1
18 fi
19 fi
20
Steven Moreland0f84e4b2023-12-16 02:51:26 +000021 local top="$(dirname "$0")"/../../../..
22 source $top/build/make/tools/finalization/environment.sh
Devin Moorebdc54ad2024-02-09 23:18:55 +000023 # environment needed to build dependencies and run scripts
24 # These should remain the same for all steps here to speed up build time
25 export ANDROID_BUILD_TOP="$top"
26 export ANDROID_HOST_OUT="$ANDROID_BUILD_TOP/out/host/linux-x86"
27 export ANDROID_PRODUCT_OUT="$ANDROID_BUILD_TOP/out/target/product/generic_arm64"
28 export PATH="$PATH:$ANDROID_HOST_OUT/bin/"
29 export TARGET_BUILD_VARIANT=userdebug
30 export DIST_DIR=out/dist
31 export TARGET_RELEASE=fina_0
32 export TARGET_PRODUCT=aosp_arm64
Steven Moreland0f84e4b2023-12-16 02:51:26 +000033
Justin Yunb9c461d2024-11-21 16:20:12 +090034 # build/soong
35 local vendor_api_level_map="case ${FINAL_NEXT_BOARD_API_LEVEL}:"
36 if ! grep -q "$vendor_api_level_map" "$top/build/soong/android/vendor_api_levels.go" ; then
37 sed -i -e "/case ${FINAL_BOARD_API_LEVEL}:/{N;a \\\t$vendor_api_level_map\n\t\tsdkVersion = ${FINAL_NEXT_CORRESPONDING_SDK_VERSION}
38 }" "$top/build/soong/android/vendor_api_levels.go"
39 fi
40
Inseob Kim9d5066b2024-01-19 21:28:09 +090041 # system/sepolicy
Devin Mooredf129fb2024-02-02 22:08:32 +000042 "$top/system/sepolicy/tools/finalize-vintf-resources.sh" "$top" "$FINAL_BOARD_API_LEVEL"
Steven Moreland0f84e4b2023-12-16 02:51:26 +000043
Devin Mooref463a812025-01-08 19:02:21 +000044 finalize_compat_matrix $build_test_only
Devin Moorea1339af2024-01-11 23:51:22 +000045
Steven Moreland0f84e4b2023-12-16 02:51:26 +000046 # pre-finalization build target (trunk)
Devin Moorebdc54ad2024-02-09 23:18:55 +000047 local aidl_m="$top/build/soong/soong_ui.bash --make-mode"
Hsin-Yi Chena7d22002024-02-07 17:12:53 +080048 AIDL_TRANSITIVE_FREEZE=true $aidl_m aidl-freeze-api create_reference_dumps
49
Justin Yun651a3a02024-12-13 15:16:01 +090050 if ! [ "$build_test_only" = "true" ]; then
51 # Generate LLNDK ABI dumps
52 # This command depends on ANDROID_BUILD_TOP
53 "$ANDROID_HOST_OUT/bin/create_reference_dumps" -release "$TARGET_RELEASE" --build-variant "$TARGET_BUILD_VARIANT" --lib-variant LLNDK
54 fi
Steven Moreland0f84e4b2023-12-16 02:51:26 +000055}
56
Devin Mooref463a812025-01-08 19:02:21 +000057function finalize_compat_matrix() {
Justin Yun651a3a02024-12-13 15:16:01 +090058 local build_test_only=$1
Justin Yun7fc38022024-07-19 08:43:20 +090059 local CURRENT_COMPATIBILITY_MATRIX_LEVEL="$FINAL_BOARD_API_LEVEL"
Devin Moorea1339af2024-01-11 23:51:22 +000060
Devin Mooref463a812025-01-08 19:02:21 +000061 "$top/prebuilts/build-tools/path/linux-x86/python3" "$top/hardware/interfaces/compatibility_matrices/finalize.py" "$CURRENT_COMPATIBILITY_MATRIX_LEVEL"
Devin Moorebdc54ad2024-02-09 23:18:55 +000062
Justin Yun651a3a02024-12-13 15:16:01 +090063 if ! [ "$build_test_only" = "true" ]; then
64 # Freeze the current framework manifest file. This relies on the
65 # aosp_cf_x86_64-trunk_staging build target to get the right manifest
66 # fragments installed.
67 "$top/system/libhidl/vintfdata/freeze.sh" "$CURRENT_COMPATIBILITY_MATRIX_LEVEL"
68 fi
Devin Moorea1339af2024-01-11 23:51:22 +000069}
70
Devin Moorebdc54ad2024-02-09 23:18:55 +000071function freeze_framework_manifest() {
72 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
73
74}
75
76
Justin Yun651a3a02024-12-13 15:16:01 +090077finalize_vintf_resources $@
Steven Moreland0f84e4b2023-12-16 02:51:26 +000078