.hash files can have multiple hashes
I have wanted this since the beginning :) HIDL interfaces have benefited
from supporting this repeatedly. Although we encounter the problem a lot
less in AIDL, since we already allow backwards compatible new versions,
and we don't have comments in aidl_api files, there are two cases where
we have hit this recently:
- a late backwards compatible change to the biometrics face AIDL HAL
(changing a type to be @nullable). While this doesn't affect the wire
protocol or stability over the wire, it does require adding a new hash.
So, VTS will fail on old devices that don't have the patch. Late in
release, this has caused problems for certain HIDL changes.
- we want to add '@hide' to V1 of FMQ, so we need two hashes for it
(this is the most straightforward resolution of b/194739778 to decouple
the issue from -java-shallow, which is slightly contentious/complex)
Of course, THIS SHOULD BE USED AS A SOLUTION OF LAST RESORT!
Fixes: 194509098
Test: libaidlmetadata_test
Change-Id: Id5080d026e9352dac17e02a1895ae9abfbac030c
diff --git a/build/aidl_api.go b/build/aidl_api.go
index 18d2d53..07281ea 100644
--- a/build/aidl_api.go
+++ b/build/aidl_api.go
@@ -43,7 +43,7 @@
}, "optionalFlags", "imports", "old", "new", "messageFile", "checkApiLevel")
aidlVerifyHashRule = pctx.StaticRule("aidlVerifyHashRule", blueprint.RuleParams{
- Command: `if [ $$(cd '${apiDir}' && { find ./ -name "*.aidl" -print0 | LC_ALL=C sort -z | xargs -0 sha1sum && echo ${version}; } | sha1sum | cut -d " " -f 1) = $$(read -r <'${hashFile}' hash extra; printf %s $$hash) ]; then ` +
+ Command: `if [ $$(cd '${apiDir}' && { find ./ -name "*.aidl" -print0 | LC_ALL=C sort -z | xargs -0 sha1sum && echo ${version}; } | sha1sum | cut -d " " -f 1) = $$(tail -1 '${hashFile}') ]; then ` +
`touch ${out}; else cat '${messageFile}' && exit 1; fi`,
Description: "Verify ${apiDir} files have not been modified",
}, "apiDir", "version", "messageFile", "hashFile")