2016-08-10 17:02:31 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
if [ ! -d hardware/interfaces ] ; then
|
|
|
|
echo "Where is hardware/interfaces?";
|
|
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
|
2016-12-12 18:24:10 +01:00
|
|
|
if [ ! -d system/libhidl/transport ] ; then
|
|
|
|
echo "Where is system/libhidl/transport?";
|
|
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
|
2016-08-10 17:02:31 +02:00
|
|
|
packages=$(pushd hardware/interfaces > /dev/null; \
|
2016-09-18 03:42:46 +02:00
|
|
|
find . -type f -name \*.hal -exec dirname {} \; | sort -u | \
|
2016-08-10 17:02:31 +02:00
|
|
|
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";
|
2016-11-29 01:09:37 +01:00
|
|
|
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;
|
2016-08-10 17:02:31 +02:00
|
|
|
done
|
2016-10-03 22:53:07 +02:00
|
|
|
|
2016-10-26 00:45:19 +02:00
|
|
|
# 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)
|
2016-10-03 22:53:07 +02:00
|
|
|
|
2016-10-26 00:45:19 +02:00
|
|
|
echo "Updating Android.bp files."
|
2016-10-03 22:53:07 +02:00
|
|
|
|
2016-10-26 00:45:19 +02:00
|
|
|
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";
|
2016-10-03 22:53:07 +02:00
|
|
|
done
|