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() { |
| 6 | local top="$(dirname "$0")"/../../../.. |
| 7 | source $top/build/make/tools/finalization/environment.sh |
| 8 | |
| 9 | # TODO(b/314010764): finalize LL_NDK |
Inseob Kim | 9d5066b | 2024-01-19 21:28:09 +0900 | [diff] [blame^] | 10 | |
| 11 | # system/sepolicy |
| 12 | system/sepolicy/tools/finalize-vintf-resources.sh "$top" "$FINAL_BOARD_API_LEVEL" |
Steven Moreland | 0f84e4b | 2023-12-16 02:51:26 +0000 | [diff] [blame] | 13 | |
Devin Moore | a1339af | 2024-01-11 23:51:22 +0000 | [diff] [blame] | 14 | create_new_compat_matrix |
| 15 | |
Steven Moreland | 0f84e4b | 2023-12-16 02:51:26 +0000 | [diff] [blame] | 16 | # pre-finalization build target (trunk) |
| 17 | local aidl_m="$top/build/soong/soong_ui.bash --make-mode TARGET_PRODUCT=aosp_arm64 TARGET_RELEASE=trunk TARGET_BUILD_VARIANT=userdebug DIST_DIR=out/dist" |
| 18 | AIDL_TRANSITIVE_FREEZE=true $aidl_m aidl-freeze-api |
Steven Moreland | 0f84e4b | 2023-12-16 02:51:26 +0000 | [diff] [blame] | 19 | } |
| 20 | |
Devin Moore | a1339af | 2024-01-11 23:51:22 +0000 | [diff] [blame] | 21 | function create_new_compat_matrix() { |
| 22 | # The compatibility matrix versions are bumped during vFRC |
| 23 | # These will change every time we have a new vFRC |
Devin Moore | 196c1b5 | 2024-01-17 16:40:29 +0000 | [diff] [blame] | 24 | export CURRENT_COMPATIBILITY_MATRIX_LEVEL='202404' |
| 25 | export FINAL_COMPATIBILITY_MATRIX_LEVEL='202504' |
Devin Moore | a1339af | 2024-01-11 23:51:22 +0000 | [diff] [blame] | 26 | |
| 27 | local top="$(dirname "$0")"/../../../.. |
| 28 | source $top/build/make/tools/finalization/environment.sh |
| 29 | |
| 30 | local current_file=compatibility_matrix."$CURRENT_COMPATIBILITY_MATRIX_LEVEL".xml |
| 31 | local final_file=compatibility_matrix."$FINAL_COMPATIBILITY_MATRIX_LEVEL".xml |
| 32 | local current_bp_module=framework_$current_file |
| 33 | local final_bp_module=framework_$final_file |
| 34 | local src=$top/hardware/interfaces/compatibility_matrices/$current_file |
| 35 | local dest=$top/hardware/interfaces/compatibility_matrices/$final_file |
| 36 | local bp_file=$top/hardware/interfaces/compatibility_matrices/Android.bp |
| 37 | |
| 38 | # check to see if this script needs to be run |
| 39 | if grep -q $final_bp_module $bp_file; then |
| 40 | echo "Nothing to do because the new module exists" |
| 41 | return |
| 42 | fi |
| 43 | |
| 44 | # build the targets required before touching the Android.bp/Android.mk files |
| 45 | local build_cmd="$top/build/soong/soong_ui.bash --make-mode TARGET_PRODUCT=aosp_arm64 TARGET_RELEASE=trunk TARGET_BUILD_VARIANT=userdebug DIST_DIR=out/dist" |
| 46 | $build_cmd bpfmt |
| 47 | $build_cmd bpmodify |
| 48 | $build_cmd queryview |
| 49 | |
| 50 | # create the new file and modify the level |
| 51 | sed "s/level=\""$CURRENT_COMPATIBILITY_MATRIX_LEVEL"\"/level=\""$FINAL_COMPATIBILITY_MATRIX_LEVEL"\"/" "$src" > "$dest" |
| 52 | |
| 53 | echo " |
| 54 | vintf_compatibility_matrix { |
| 55 | name: \"$final_bp_module\", |
| 56 | stem: \"$final_file\", |
| 57 | srcs: [ |
| 58 | \"$final_file\", |
| 59 | ], |
| 60 | }" >> $bp_file |
| 61 | |
| 62 | # get the previous kernel_configs properties and add them to the new module |
Devin Moore | 395d5e3 | 2024-01-17 16:47:11 +0000 | [diff] [blame] | 63 | local kernel_configs=$($top/out/host/linux-x86/bin/bazel query --config=queryview //hardware/interfaces/compatibility_matrices:"$current_bp_module"--android_common --output=build 2>$1 | grep kernel_configs | sed 's/[^\[]*\[\(.*\)],/\1/' | sed 's/ //g' | sed 's/\"//g') |
Devin Moore | a1339af | 2024-01-11 23:51:22 +0000 | [diff] [blame] | 64 | |
| 65 | $top/out/host/linux-x86/bin/bpmodify -m $final_bp_module -property kernel_configs -a $kernel_configs -w $bp_file |
| 66 | |
| 67 | $top/out/host/linux-x86/bin/bpfmt -w $bp_file |
| 68 | |
| 69 | local make_file=$top/hardware/interfaces/compatibility_matrices/Android.mk |
| 70 | # replace the current compat matrix in the make file with the final one |
| 71 | # the only place this resides is in the conditional addition |
| 72 | sed -i "s/$current_file/$final_file/g" $make_file |
| 73 | # add the current compat matrix to the unconditional addition |
| 74 | sed -i "/^ framework_compatibility_matrix.device.xml/i \ $current_bp_module \\\\" $make_file |
| 75 | } |
| 76 | |
Steven Moreland | 0f84e4b | 2023-12-16 02:51:26 +0000 | [diff] [blame] | 77 | finalize_vintf_resources |
| 78 | |