1#!/bin/bash
2#
3# Create two CLs for the given HIDL interface to see the diff between the
4# hidl2aidl output and the source at the tip-of-tree.
5# The first CL contains the hidl2aidl output after removing all existing AIDL
6# files.
7# The second CL contains all of the changes on top of the raw hidl2aidl output
8# that can be used for review.
9
10if [[ $# -ne 1 ]]; then
11    echo "Usage: $0 INTERFACE_NAME"
12    echo "- INTERFACE_NAME fully qualified HIDL interface name with version"
13    echo "example of creating the diffs for android.hardware.boot@1.2"
14    echo "$ ./anapic_hidl2aidl_review.sh android.hardware.boot@1.2"
15    exit 1
16fi
17
18# for pathmod
19source ${ANDROID_BUILD_TOP}/build/make/envsetup.sh
20
21set -ex
22type hidl2aidl 2>/dev/null || m hidl2aidl
23
24INTERFACE_NAME_NO_VER=${1%@*}
25pushd $(pathmod $INTERFACE_NAME_NO_VER)
26rm -rf android
27hidl2aidl -o . "$1"
28rm -rf conversion.log translate include
29git add -A
30git commit -am "convert $1" --no-edit
31git revert HEAD --no-edit
32git commit --amend --no-edit
33git diff HEAD~1 --stat
34repo upload . --no-verify --wip --hashtag=anapic_release_review
35popd
36