platform_hardware_interfaces/update-makefiles.sh
Steven Moreland 7b66dd9b23 Auto hardware/interfaces/Android.bp
Bug: 31909444
Test: make various interfaces, mma -j
Change-Id: Ie2de39572e482415b5279110586a0cb7e5220c8e
2016-10-03 13:55:42 -07:00

34 lines
No EOL
1,014 B
Bash
Executable file

#!/bin/bash
if [ ! -d hardware/interfaces ] ; then
echo "Where is hardware/interfaces?";
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 $p;
hidl-gen -Landroidbp -r android.hardware:hardware/interfaces $p;
done
bp="hardware/interfaces/Android.bp"
androidbps=$(find hardware/interfaces/*/ \
-name "Android.bp" \
-exec dirname {} \; \
| sort)
echo "Updating $bp"
echo "// This is an autogenerated file, do not edit." > $bp;
echo "subdirs = [" >> $bp;
for a in $androidbps; do
echo " \"${a#*hardware/interfaces/}\"," >> $bp;
done
echo "]" >> $bp;