Alex Buynytskyy | 13c8267 | 2022-12-07 18:54:51 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # Continuous Integration script for *-finalization-2 branches. |
| 3 | # Reverts previous finalization script commits and runs local build. |
| 4 | |
| 5 | set -ex |
| 6 | |
| 7 | function revert_to_unfinalized_state() { |
| 8 | declare -a projects=( |
| 9 | "build/make/" |
| 10 | "build/soong/" |
| 11 | "cts/" |
| 12 | "frameworks/base/" |
| 13 | "frameworks/hardware/interfaces/" |
| 14 | "frameworks/libs/modules-utils/" |
| 15 | "frameworks/libs/net/" |
| 16 | "hardware/interfaces/" |
| 17 | "libcore/" |
| 18 | "packages/services/Car/" |
| 19 | "platform_testing/" |
| 20 | "prebuilts/abi-dumps/ndk/" |
| 21 | "prebuilts/abi-dumps/platform/" |
| 22 | "prebuilts/abi-dumps/vndk/" |
| 23 | "system/hardware/interfaces/" |
| 24 | "system/tools/aidl/" |
| 25 | "tools/platform-compat" |
| 26 | "device/generic/car" |
| 27 | "development" |
| 28 | ) |
| 29 | |
| 30 | for project in "${projects[@]}" |
| 31 | do |
| 32 | local git_path="$top/$project" |
| 33 | echo "Reverting: $git_path" |
| 34 | baselineHash="$(git -C $git_path log --format=%H --no-merges --max-count=1 --grep ^FINALIZATION_STEP_1_BASELINE_COMMIT)" ; |
| 35 | if [[ $baselineHash ]]; then |
| 36 | previousHash="$(git -C $git_path log --format=%H --no-merges --max-count=100 --grep ^FINALIZATION_STEP_1_SCRIPT_COMMIT $baselineHash..HEAD | tr \n \040)" ; |
| 37 | else |
| 38 | previousHash="$(git -C $git_path log --format=%H --no-merges --max-count=100 --grep ^FINALIZATION_STEP_1_SCRIPT_COMMIT | tr \n \040)" ; |
| 39 | fi ; |
| 40 | if [[ $previousHash ]]; then git -C $git_path revert --no-commit --strategy=ort --strategy-option=ours $previousHash ; fi ; |
| 41 | done |
| 42 | } |
| 43 | |
| 44 | function finalize_step_2_main() { |
| 45 | local top="$(dirname "$0")"/../.. |
| 46 | local m="$top/build/soong/soong_ui.bash --make-mode TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug" |
| 47 | |
| 48 | revert_to_unfinalized_state |
| 49 | |
| 50 | # vndk etc finalization |
| 51 | source $top/build/make/finalize-aidl-vndk-sdk-resources.sh |
| 52 | |
| 53 | # prebuilts etc |
| 54 | source $top/build/make/finalize-sdk-rel.sh |
| 55 | |
| 56 | # build to confirm everything is OK |
| 57 | AIDL_FROZEN_REL=true $m |
| 58 | } |
| 59 | |
| 60 | finalize_step_2_main |