1*9e94795aSAndroid Build Coastguard Worker#!/bin/bash 2*9e94795aSAndroid Build Coastguard Worker 3*9e94795aSAndroid Build Coastguard Workerset -ex 4*9e94795aSAndroid Build Coastguard Worker 5*9e94795aSAndroid Build Coastguard Workerfunction finalize_vintf_resources() { 6*9e94795aSAndroid Build Coastguard Worker local top="$(dirname "$0")"/../../../.. 7*9e94795aSAndroid Build Coastguard Worker source $top/build/make/tools/finalization/environment.sh 8*9e94795aSAndroid Build Coastguard Worker # environment needed to build dependencies and run scripts 9*9e94795aSAndroid Build Coastguard Worker # These should remain the same for all steps here to speed up build time 10*9e94795aSAndroid Build Coastguard Worker export ANDROID_BUILD_TOP="$top" 11*9e94795aSAndroid Build Coastguard Worker export ANDROID_HOST_OUT="$ANDROID_BUILD_TOP/out/host/linux-x86" 12*9e94795aSAndroid Build Coastguard Worker export ANDROID_PRODUCT_OUT="$ANDROID_BUILD_TOP/out/target/product/generic_arm64" 13*9e94795aSAndroid Build Coastguard Worker export PATH="$PATH:$ANDROID_HOST_OUT/bin/" 14*9e94795aSAndroid Build Coastguard Worker export TARGET_BUILD_VARIANT=userdebug 15*9e94795aSAndroid Build Coastguard Worker export DIST_DIR=out/dist 16*9e94795aSAndroid Build Coastguard Worker export TARGET_RELEASE=fina_0 17*9e94795aSAndroid Build Coastguard Worker export TARGET_PRODUCT=aosp_arm64 18*9e94795aSAndroid Build Coastguard Worker 19*9e94795aSAndroid Build Coastguard Worker # build/soong 20*9e94795aSAndroid Build Coastguard Worker local vendor_api_level_map="case ${FINAL_NEXT_BOARD_API_LEVEL}:" 21*9e94795aSAndroid Build Coastguard Worker if ! grep -q "$vendor_api_level_map" "$top/build/soong/android/vendor_api_levels.go" ; then 22*9e94795aSAndroid Build Coastguard Worker sed -i -e "/case ${FINAL_BOARD_API_LEVEL}:/{N;a \\\t$vendor_api_level_map\n\t\tsdkVersion = ${FINAL_NEXT_CORRESPONDING_SDK_VERSION} 23*9e94795aSAndroid Build Coastguard Worker }" "$top/build/soong/android/vendor_api_levels.go" 24*9e94795aSAndroid Build Coastguard Worker fi 25*9e94795aSAndroid Build Coastguard Worker 26*9e94795aSAndroid Build Coastguard Worker # system/sepolicy 27*9e94795aSAndroid Build Coastguard Worker "$top/system/sepolicy/tools/finalize-vintf-resources.sh" "$top" "$FINAL_BOARD_API_LEVEL" 28*9e94795aSAndroid Build Coastguard Worker 29*9e94795aSAndroid Build Coastguard Worker create_new_compat_matrix_and_kernel_configs 30*9e94795aSAndroid Build Coastguard Worker 31*9e94795aSAndroid Build Coastguard Worker # pre-finalization build target (trunk) 32*9e94795aSAndroid Build Coastguard Worker local aidl_m="$top/build/soong/soong_ui.bash --make-mode" 33*9e94795aSAndroid Build Coastguard Worker AIDL_TRANSITIVE_FREEZE=true $aidl_m aidl-freeze-api create_reference_dumps 34*9e94795aSAndroid Build Coastguard Worker 35*9e94795aSAndroid Build Coastguard Worker # Generate LLNDK ABI dumps 36*9e94795aSAndroid Build Coastguard Worker # This command depends on ANDROID_BUILD_TOP 37*9e94795aSAndroid Build Coastguard Worker "$ANDROID_HOST_OUT/bin/create_reference_dumps" -release "$TARGET_RELEASE" --build-variant "$TARGET_BUILD_VARIANT" --lib-variant LLNDK 38*9e94795aSAndroid Build Coastguard Worker} 39*9e94795aSAndroid Build Coastguard Worker 40*9e94795aSAndroid Build Coastguard Workerfunction create_new_compat_matrix_and_kernel_configs() { 41*9e94795aSAndroid Build Coastguard Worker # The compatibility matrix versions are bumped during vFRC 42*9e94795aSAndroid Build Coastguard Worker # These will change every time we have a new vFRC 43*9e94795aSAndroid Build Coastguard Worker local CURRENT_COMPATIBILITY_MATRIX_LEVEL="$FINAL_BOARD_API_LEVEL" 44*9e94795aSAndroid Build Coastguard Worker local NEXT_COMPATIBILITY_MATRIX_LEVEL="$FINAL_NEXT_BOARD_API_LEVEL" 45*9e94795aSAndroid Build Coastguard Worker # The kernel configs need the letter of the Android release 46*9e94795aSAndroid Build Coastguard Worker local CURRENT_RELEASE_LETTER="$FINAL_CORRESPONDING_VERSION_LETTER" 47*9e94795aSAndroid Build Coastguard Worker local NEXT_RELEASE_LETTER="$FINAL_NEXT_CORRESPONDING_VERSION_LETTER" 48*9e94795aSAndroid Build Coastguard Worker 49*9e94795aSAndroid Build Coastguard Worker 50*9e94795aSAndroid Build Coastguard Worker # build the targets required before touching the Android.bp/Android.mk files 51*9e94795aSAndroid Build Coastguard Worker local build_cmd="$top/build/soong/soong_ui.bash --make-mode" 52*9e94795aSAndroid Build Coastguard Worker $build_cmd bpmodify 53*9e94795aSAndroid Build Coastguard Worker 54*9e94795aSAndroid Build Coastguard Worker "$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" "$FINAL_CORRESPONDING_PLATFORM_VERSION" 55*9e94795aSAndroid Build Coastguard Worker 56*9e94795aSAndroid Build Coastguard Worker # Freeze the current framework manifest file. This relies on the 57*9e94795aSAndroid Build Coastguard Worker # aosp_cf_x86_64-trunk_staging build target to get the right manifest 58*9e94795aSAndroid Build Coastguard Worker # fragments installed. 59*9e94795aSAndroid Build Coastguard Worker "$top/system/libhidl/vintfdata/freeze.sh" "$CURRENT_COMPATIBILITY_MATRIX_LEVEL" 60*9e94795aSAndroid Build Coastguard Worker} 61*9e94795aSAndroid Build Coastguard Worker 62*9e94795aSAndroid Build Coastguard Workerfunction freeze_framework_manifest() { 63*9e94795aSAndroid Build Coastguard Worker 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 64*9e94795aSAndroid Build Coastguard Worker 65*9e94795aSAndroid Build Coastguard Worker} 66*9e94795aSAndroid Build Coastguard Worker 67*9e94795aSAndroid Build Coastguard Worker 68*9e94795aSAndroid Build Coastguard Workerfinalize_vintf_resources 69*9e94795aSAndroid Build Coastguard Worker 70