blob: 9660e3fc8ca1faf23a4e53d18d9f3e2d51f70614 [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 Moorebdc54ad2024-02-09 23:18:55 +000044 local aidl_m="$top/build/soong/soong_ui.bash --make-mode"
Hsin-Yi Chena7d22002024-02-07 17:12:53 +080045 AIDL_TRANSITIVE_FREEZE=true $aidl_m aidl-freeze-api create_reference_dumps
46
Devin Moorebc461362025-01-11 00:25:22 +000047 finalize_compat_matrix $build_test_only
48
Justin Yun651a3a02024-12-13 15:16:01 +090049 if ! [ "$build_test_only" = "true" ]; then
50 # Generate LLNDK ABI dumps
51 # This command depends on ANDROID_BUILD_TOP
52 "$ANDROID_HOST_OUT/bin/create_reference_dumps" -release "$TARGET_RELEASE" --build-variant "$TARGET_BUILD_VARIANT" --lib-variant LLNDK
53 fi
Steven Moreland0f84e4b2023-12-16 02:51:26 +000054}
55
Devin Mooref463a812025-01-08 19:02:21 +000056function finalize_compat_matrix() {
Justin Yun651a3a02024-12-13 15:16:01 +090057 local build_test_only=$1
Justin Yun7fc38022024-07-19 08:43:20 +090058 local CURRENT_COMPATIBILITY_MATRIX_LEVEL="$FINAL_BOARD_API_LEVEL"
Devin Moorea1339af2024-01-11 23:51:22 +000059
Devin Mooref463a812025-01-08 19:02:21 +000060 "$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 +000061
Justin Yun651a3a02024-12-13 15:16:01 +090062 if ! [ "$build_test_only" = "true" ]; then
63 # Freeze the current framework manifest file. This relies on the
Devin Moorebc461362025-01-11 00:25:22 +000064 # interfaces already being frozen because we are building with fina_0 which
65 # inherits from `next` where RELEASE_AIDL_USE_UNFROZEN=false
Justin Yun651a3a02024-12-13 15:16:01 +090066 "$top/system/libhidl/vintfdata/freeze.sh" "$CURRENT_COMPATIBILITY_MATRIX_LEVEL"
67 fi
Devin Moorea1339af2024-01-11 23:51:22 +000068}
69
Devin Moorebdc54ad2024-02-09 23:18:55 +000070function freeze_framework_manifest() {
71 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
72
73}
74
75
Justin Yun651a3a02024-12-13 15:16:01 +090076finalize_vintf_resources $@
Steven Moreland0f84e4b2023-12-16 02:51:26 +000077