diff options
author | Yifan Hong <elsk@google.com> | 2020-10-14 21:29:52 -0700 |
---|---|---|
committer | Yifan Hong <elsk@google.com> | 2020-10-15 17:03:44 -0700 |
commit | 653a8453f067969fad00aefc40a77e6b73155e71 (patch) | |
tree | 741bb4c12aa7a816b189ad25abe043f68bdda44c /vintfdata | |
parent | c3d3a5e6f8a2c998d40e027226e28899d456acaa (diff) | |
download | libhidl-653a8453f067969fad00aefc40a77e6b73155e71.tar.gz |
Add script to freeze framework manifest.
Test: freeze.sh 5
Bug: 37226359
Change-Id: I00787c257e59050f2d707706051bd18407ac6ed7
Diffstat (limited to 'vintfdata')
-rwxr-xr-x | vintfdata/freeze.sh | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/vintfdata/freeze.sh b/vintfdata/freeze.sh new file mode 100755 index 0000000..a624ee3 --- /dev/null +++ b/vintfdata/freeze.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +mydir="$(dirname $0)" + +function freeze() { + [[ $# == 1 ]] || { + echo "usage: freeze.sh <level>" + echo "e.g. To freeze framework manifest for Android R, run:" + echo " freeze.sh 5" + return 1 + } + local level="$1" + [[ "${ANDROID_BUILD_TOP}" ]] || { + echo "ANDROID_BUILD_TOP is not set; did you run envsetup.sh?" + return 1 + } + [[ "${ANDROID_HOST_OUT}" ]] || { + echo "ANDROID_HOST_OUT is not set; did you run envsetup.sh?" + return 1 + } + + local modules_to_build=check-vintf-all + echo "Building ${modules_to_build}" + "${ANDROID_BUILD_TOP}/build/soong/soong_ui.bash" --build-mode --all-modules --dir="$(pwd)" ${modules_to_build} || { + echo "${modules_to_build} failed. Backwards compatibility might be broken." + echo "Check framework manifest changes. If this is intentional, run " + echo " \`vintffm --update\` with appropriate options to update frozen files." + return 1 + } + + echo "Updating level ${level}" + "${ANDROID_HOST_OUT}/bin/vintffm" --update --level "${level}" --dirmap "/system:${ANDROID_PRODUCT_OUT}/system" "${mydir}/frozen" || return 1 + + local files_to_diff="$(printf "${mydir}/frozen/%s\n" $(ls -1 -t -r ${mydir}/frozen | xargs -I{} basename {} | grep -B1 "${level}.xml"))" + + echo + echo "Summary of changes:" + echo diff ${files_to_diff} + diff ${files_to_diff} || true +} + +freeze $@ |