API dumps: fix preamble
Before the '{}' in the preamble command wasn't getting substituted, so
we were seeing this error:
[ 87% 7/8] //system/tools/aidl/asdf:an_aidl_1-api Freezing AIDL API of an_aidl_1 as version 1
cat: {}: No such file or directory
Now, we are using xargs so that when the command fails, the build will
fail (easier to find a problem in the future), and the path gets
substituted.
Bug: N/A
Test: freezing an API adds the preamble there (and not to the .hash
file)
Change-Id: Ifbfacf9d21c77ccb88623be8839bf5ae1f3b3c46
diff --git a/build/aidl_interface.go b/build/aidl_interface.go
index ef27ba1..6bb8776 100644
--- a/build/aidl_interface.go
+++ b/build/aidl_interface.go
@@ -88,8 +88,8 @@
Command: `mkdir -p ${to} && rm -rf ${to}/* && ` +
`${bpmodifyCmd} -w -m ${name} -parameter versions -a ${version} ${bp} && ` +
`cp -rf ${apiDir}/. ${to} && ` +
- `find ${to} -type f -exec bash -c ` +
- `"cat ${apiPreamble} {} > {}.temp; mv {}.temp {}" \; && ` +
+ `find ${to} -type f -name "*.aidl" | xargs -n 1 bash -c ` +
+ `'cat ${apiPreamble} $$0 > $$0.temp && mv $$0.temp $$0' && ` +
`touch ${out}`,
CommandDeps: []string{"${bpmodifyCmd}"},
}, "to", "name", "version", "bp", "apiDir", "apiPreamble")