Steven Moreland | 0f84e4b | 2023-12-16 02:51:26 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | set -ex |
| 4 | |
| 5 | function finalize_vintf_resources() { |
Justin Yun | 651a3a0 | 2024-12-13 15:16:01 +0900 | [diff] [blame] | 6 | 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 Moreland | 0f84e4b | 2023-12-16 02:51:26 +0000 | [diff] [blame] | 21 | local top="$(dirname "$0")"/../../../.. |
| 22 | source $top/build/make/tools/finalization/environment.sh |
Devin Moore | bdc54ad | 2024-02-09 23:18:55 +0000 | [diff] [blame] | 23 | # 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 Moreland | 0f84e4b | 2023-12-16 02:51:26 +0000 | [diff] [blame] | 33 | |
Justin Yun | b9c461d | 2024-11-21 16:20:12 +0900 | [diff] [blame] | 34 | # 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 Kim | 9d5066b | 2024-01-19 21:28:09 +0900 | [diff] [blame] | 41 | # system/sepolicy |
Devin Moore | df129fb | 2024-02-02 22:08:32 +0000 | [diff] [blame] | 42 | "$top/system/sepolicy/tools/finalize-vintf-resources.sh" "$top" "$FINAL_BOARD_API_LEVEL" |
Steven Moreland | 0f84e4b | 2023-12-16 02:51:26 +0000 | [diff] [blame] | 43 | |
Devin Moore | bdc54ad | 2024-02-09 23:18:55 +0000 | [diff] [blame] | 44 | local aidl_m="$top/build/soong/soong_ui.bash --make-mode" |
Hsin-Yi Chen | a7d2200 | 2024-02-07 17:12:53 +0800 | [diff] [blame] | 45 | AIDL_TRANSITIVE_FREEZE=true $aidl_m aidl-freeze-api create_reference_dumps |
| 46 | |
Devin Moore | bc46136 | 2025-01-11 00:25:22 +0000 | [diff] [blame] | 47 | finalize_compat_matrix $build_test_only |
| 48 | |
Justin Yun | 651a3a0 | 2024-12-13 15:16:01 +0900 | [diff] [blame] | 49 | 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 Moreland | 0f84e4b | 2023-12-16 02:51:26 +0000 | [diff] [blame] | 54 | } |
| 55 | |
Devin Moore | f463a81 | 2025-01-08 19:02:21 +0000 | [diff] [blame] | 56 | function finalize_compat_matrix() { |
Justin Yun | 651a3a0 | 2024-12-13 15:16:01 +0900 | [diff] [blame] | 57 | local build_test_only=$1 |
Justin Yun | 7fc3802 | 2024-07-19 08:43:20 +0900 | [diff] [blame] | 58 | local CURRENT_COMPATIBILITY_MATRIX_LEVEL="$FINAL_BOARD_API_LEVEL" |
Devin Moore | a1339af | 2024-01-11 23:51:22 +0000 | [diff] [blame] | 59 | |
Devin Moore | f463a81 | 2025-01-08 19:02:21 +0000 | [diff] [blame] | 60 | "$top/prebuilts/build-tools/path/linux-x86/python3" "$top/hardware/interfaces/compatibility_matrices/finalize.py" "$CURRENT_COMPATIBILITY_MATRIX_LEVEL" |
Devin Moore | bdc54ad | 2024-02-09 23:18:55 +0000 | [diff] [blame] | 61 | |
Justin Yun | 651a3a0 | 2024-12-13 15:16:01 +0900 | [diff] [blame] | 62 | if ! [ "$build_test_only" = "true" ]; then |
| 63 | # Freeze the current framework manifest file. This relies on the |
Devin Moore | bc46136 | 2025-01-11 00:25:22 +0000 | [diff] [blame] | 64 | # interfaces already being frozen because we are building with fina_0 which |
| 65 | # inherits from `next` where RELEASE_AIDL_USE_UNFROZEN=false |
Justin Yun | 651a3a0 | 2024-12-13 15:16:01 +0900 | [diff] [blame] | 66 | "$top/system/libhidl/vintfdata/freeze.sh" "$CURRENT_COMPATIBILITY_MATRIX_LEVEL" |
| 67 | fi |
Devin Moore | a1339af | 2024-01-11 23:51:22 +0000 | [diff] [blame] | 68 | } |
| 69 | |
Devin Moore | bdc54ad | 2024-02-09 23:18:55 +0000 | [diff] [blame] | 70 | function 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 Yun | 651a3a0 | 2024-12-13 15:16:01 +0900 | [diff] [blame] | 76 | finalize_vintf_resources $@ |
Steven Moreland | 0f84e4b | 2023-12-16 02:51:26 +0000 | [diff] [blame] | 77 | |