blob: 0f89dfc5da124d4546807969f13ca4ad6cfe5db5 [file] [log] [blame]
Iliyan Malchev7fd352e2016-08-10 08:02:31 -07001#!/bin/bash
2
3if [ ! -d hardware/interfaces ] ; then
4 echo "Where is hardware/interfaces?";
5 exit 1;
6fi
7
8packages=$(pushd hardware/interfaces > /dev/null; \
Iliyan Malchev15e15582016-09-17 18:42:46 -07009 find . -type f -name \*.hal -exec dirname {} \; | sort -u | \
Iliyan Malchev7fd352e2016-08-10 08:02:31 -070010 cut -c3- | \
11 awk -F'/' \
12 '{printf("android.hardware"); for(i=1;i<NF;i++){printf(".%s", $i);}; printf("@%s\n", $NF);}'; \
13 popd > /dev/null)
14
15for p in $packages; do
16 echo "Updating $p";
Yifan Honge19e5822016-11-28 16:09:37 -080017 hidl-gen -Lmakefile -r android.hardware:hardware/interfaces -r android.hidl:system/libhidl/transport $p;
18 hidl-gen -Landroidbp -r android.hardware:hardware/interfaces -r android.hidl:system/libhidl/transport $p;
Iliyan Malchev7fd352e2016-08-10 08:02:31 -070019done
Steven Moreland7b66dd92016-10-03 13:53:07 -070020
Steven Moreland7a4f1182016-10-25 15:45:19 -070021# subdirectories of hardware/interfaces which contain an Android.bp file
22android_dirs=$(find hardware/interfaces/*/ \
23 -name "Android.bp" \
24 -printf "%h\n" \
25 | cut -d "/" -f1-3 \
26 | sort | uniq)
Steven Moreland7b66dd92016-10-03 13:53:07 -070027
Steven Moreland7a4f1182016-10-25 15:45:19 -070028echo "Updating Android.bp files."
Steven Moreland7b66dd92016-10-03 13:53:07 -070029
Steven Moreland7a4f1182016-10-25 15:45:19 -070030for bp_dir in $android_dirs; do
31 bp="$bp_dir/Android.bp"
32 # locations of Android.bp files in specific subdirectory of hardware/interfaces
33 android_bps=$(find $bp_dir \
34 -name "Android.bp" \
35 ! -path $bp_dir/Android.bp \
36 -printf "%h\n" \
37 | sort)
38
39 echo "// This is an autogenerated file, do not edit." > "$bp";
40 echo "subdirs = [" >> "$bp";
41 for a in $android_bps; do
42 echo " \"${a#$bp_dir/}\"," >> "$bp";
43 done
44 echo "]" >> "$bp";
Steven Moreland7b66dd92016-10-03 13:53:07 -070045done