blob: a624ee30d765d2aaa5f3ab50a7d18e46f7b93dd7 [file] [log] [blame]
Yifan Hong653a8452020-10-14 21:29:52 -07001#!/bin/bash
2
3mydir="$(dirname $0)"
4
5function freeze() {
6 [[ $# == 1 ]] || {
7 echo "usage: freeze.sh <level>"
8 echo "e.g. To freeze framework manifest for Android R, run:"
9 echo " freeze.sh 5"
10 return 1
11 }
12 local level="$1"
13 [[ "${ANDROID_BUILD_TOP}" ]] || {
14 echo "ANDROID_BUILD_TOP is not set; did you run envsetup.sh?"
15 return 1
16 }
17 [[ "${ANDROID_HOST_OUT}" ]] || {
18 echo "ANDROID_HOST_OUT is not set; did you run envsetup.sh?"
19 return 1
20 }
21
22 local modules_to_build=check-vintf-all
23 echo "Building ${modules_to_build}"
24 "${ANDROID_BUILD_TOP}/build/soong/soong_ui.bash" --build-mode --all-modules --dir="$(pwd)" ${modules_to_build} || {
25 echo "${modules_to_build} failed. Backwards compatibility might be broken."
26 echo "Check framework manifest changes. If this is intentional, run "
27 echo " \`vintffm --update\` with appropriate options to update frozen files."
28 return 1
29 }
30
31 echo "Updating level ${level}"
32 "${ANDROID_HOST_OUT}/bin/vintffm" --update --level "${level}" --dirmap "/system:${ANDROID_PRODUCT_OUT}/system" "${mydir}/frozen" || return 1
33
34 local files_to_diff="$(printf "${mydir}/frozen/%s\n" $(ls -1 -t -r ${mydir}/frozen | xargs -I{} basename {} | grep -B1 "${level}.xml"))"
35
36 echo
37 echo "Summary of changes:"
38 echo diff ${files_to_diff}
39 diff ${files_to_diff} || true
40}
41
42freeze $@