blob: f153a8413658b44b14f899978ac826193f9570e9 [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
Steven Moreland13b5d802016-12-12 09:24:10 -08008if [ ! -d system/libhidl/transport ] ; then
9 echo "Where is system/libhidl/transport?";
10 exit 1;
11fi
12
Iliyan Malchev7fd352e2016-08-10 08:02:31 -070013packages=$(pushd hardware/interfaces > /dev/null; \
Iliyan Malchev15e15582016-09-17 18:42:46 -070014 find . -type f -name \*.hal -exec dirname {} \; | sort -u | \
Iliyan Malchev7fd352e2016-08-10 08:02:31 -070015 cut -c3- | \
16 awk -F'/' \
17 '{printf("android.hardware"); for(i=1;i<NF;i++){printf(".%s", $i);}; printf("@%s\n", $NF);}'; \
18 popd > /dev/null)
19
20for p in $packages; do
21 echo "Updating $p";
Yifan Honge19e5822016-11-28 16:09:37 -080022 hidl-gen -Lmakefile -r android.hardware:hardware/interfaces -r android.hidl:system/libhidl/transport $p;
23 hidl-gen -Landroidbp -r android.hardware:hardware/interfaces -r android.hidl:system/libhidl/transport $p;
Iliyan Malchev7fd352e2016-08-10 08:02:31 -070024done
Steven Moreland7b66dd92016-10-03 13:53:07 -070025
Steven Moreland7a4f1182016-10-25 15:45:19 -070026# subdirectories of hardware/interfaces which contain an Android.bp file
27android_dirs=$(find hardware/interfaces/*/ \
28 -name "Android.bp" \
29 -printf "%h\n" \
30 | cut -d "/" -f1-3 \
31 | sort | uniq)
Steven Moreland7b66dd92016-10-03 13:53:07 -070032
Steven Moreland7a4f1182016-10-25 15:45:19 -070033echo "Updating Android.bp files."
Steven Moreland7b66dd92016-10-03 13:53:07 -070034
Steven Moreland7a4f1182016-10-25 15:45:19 -070035for bp_dir in $android_dirs; do
36 bp="$bp_dir/Android.bp"
37 # locations of Android.bp files in specific subdirectory of hardware/interfaces
38 android_bps=$(find $bp_dir \
39 -name "Android.bp" \
40 ! -path $bp_dir/Android.bp \
41 -printf "%h\n" \
42 | sort)
43
44 echo "// This is an autogenerated file, do not edit." > "$bp";
45 echo "subdirs = [" >> "$bp";
46 for a in $android_bps; do
47 echo " \"${a#$bp_dir/}\"," >> "$bp";
48 done
49 echo "]" >> "$bp";
Steven Moreland7b66dd92016-10-03 13:53:07 -070050done