diff options
| author | Hridya Valsaraju <hridya@google.com> | 2017-03-01 16:13:24 -0800 |
|---|---|---|
| committer | Hridya Valsaraju <hridya@google.com> | 2017-03-02 16:10:56 -0800 |
| commit | 877f4686954776b808a8a31a5c13548588a73a62 (patch) | |
| tree | 6a47d65440584d6006aba3599f48ffb4dd423d0c | |
| parent | e05c2039355c2fe3ff6865505153705f46588cd1 (diff) | |
| download | platform_system_hardware_interfaces-o-preview.tar.gz platform_system_hardware_interfaces-o-preview.tar.bz2 platform_system_hardware_interfaces-o-preview.zip | |
Add update-makefiles.sh scriptandroid-o-preview-1o-preview
Bug: 35882393
Test: make files created correctly for a test .hal file
Change-Id: If27e109769cf929efb04261ac51be16cb1ae28c2
| -rwxr-xr-x | update-makefiles.sh | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/update-makefiles.sh b/update-makefiles.sh new file mode 100755 index 00000000..acc593a5 --- /dev/null +++ b/update-makefiles.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +#TODO(b/35916648) : Cleanup script to have a common implementation +if [ ! -d system/hardware/interfaces ] ; then + echo "Where is system/hardware/interfaces?"; + exit 1; +fi + +if [ ! -d system/libhidl/transport ] ; then + echo "Where is system/libhidl/transport?"; + exit 1; +fi + +packages=$(pushd system/hardware/interfaces > /dev/null; \ + find . -type f -name \*.hal -exec dirname {} \; | sort -u | \ + cut -c3- | \ + awk -F'/' \ + '{printf("android.system"); for(i=1;i<NF;i++){printf(".%s", $i);}; printf("@%s\n", $NF);}'; \ + popd > /dev/null) + +for p in $packages; do + echo "Updating $p"; + hidl-gen -Lmakefile -r android.system:system/hardware/interfaces -r android.hidl:system/libhidl/transport $p; + rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi + hidl-gen -Landroidbp -r android.system:system/hardware/interfaces -r android.hidl:system/libhidl/transport $p; + rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi +done + +# subdirectories of system/hardware/interfaces which contain an Android.bp file +android_dirs=$(find system/hardware/interfaces/*/ \ + -name "Android.bp" \ + -printf "%h\n" \ + | cut -d "/" -f1-3 \ + | sort | uniq) + +echo "Updating Android.bp files." + +for bp_dir in $android_dirs; do + bp="$bp_dir/Android.bp" + # locations of Android.bp files in specific subdirectory of system/hardware/interfaces + android_bps=$(find $bp_dir \ + -name "Android.bp" \ + ! -path $bp_dir/Android.bp \ + -printf "%h\n" \ + | sort) + + echo "// This is an autogenerated file, do not edit." > "$bp"; + echo "subdirs = [" >> "$bp"; + for a in $android_bps; do + echo " \"${a#$bp_dir/}\"," >> "$bp"; + done + echo "]" >> "$bp"; +done |
