platform_hardware_interfaces/update-makefiles.sh
Steven Moreland 13b5d8034e Add check to update-makefiles.sh.
Now that we also have packages like android.hidl.base which reside in
system/libhidl/transport which are read in by hidl-gen (see
-randroid.hidl:system/libhidl/transport in the same file), we can
display a pretty warning message if they are missing.

We'll have to remember to update this after b/33276472.

Test: ran update-makefiles.sh
Change-Id: Ia3e3183dd5139cf3a8d1bf7bd25c201d1b098c79
2016-12-12 09:24:10 -08:00

50 lines
1.6 KiB
Bash
Executable file

#!/bin/bash
if [ ! -d hardware/interfaces ] ; then
echo "Where is hardware/interfaces?";
exit 1;
fi
if [ ! -d system/libhidl/transport ] ; then
echo "Where is system/libhidl/transport?";
exit 1;
fi
packages=$(pushd hardware/interfaces > /dev/null; \
find . -type f -name \*.hal -exec dirname {} \; | sort -u | \
cut -c3- | \
awk -F'/' \
'{printf("android.hardware"); 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.hardware:hardware/interfaces -r android.hidl:system/libhidl/transport $p;
hidl-gen -Landroidbp -r android.hardware:hardware/interfaces -r android.hidl:system/libhidl/transport $p;
done
# subdirectories of hardware/interfaces which contain an Android.bp file
android_dirs=$(find 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 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