Print abidiff file when ABI check fails
The ABI diff command provides more information for debugging.
- Print the first 50 lines of the abidiff.
- Copy lsdump to DIST_DIR.
Bug: 323447559
Test: make libc dist
Change-Id: I5cd6413b0b7a36fc2222ac37887c9c401e410e10
diff --git a/cc/builder.go b/cc/builder.go
index 10e2280..e11486e 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -304,8 +304,10 @@
sAbiDiff = pctx.RuleFunc("sAbiDiff",
func(ctx android.PackageRuleContext) blueprint.RuleParams {
commandStr := "($sAbiDiffer ${extraFlags} -lib ${libName} -arch ${arch} -o ${out} -new ${in} -old ${referenceDump})"
- commandStr += "|| (echo '${errorMessage}'"
- commandStr += " && (mkdir -p $$DIST_DIR/abidiffs && cp ${out} $$DIST_DIR/abidiffs/)"
+ commandStr += "|| (echo 'First 50 lines of abidiff:'"
+ commandStr += " && head -n 50 ${out}"
+ commandStr += " && echo '${errorMessage}'"
+ commandStr += " && (test -n \"$$DIST_DIR\" && mkdir -p $$DIST_DIR/abidiffs && cp ${out} ${in} $$DIST_DIR/abidiffs/)"
commandStr += " && exit 1)"
return blueprint.RuleParams{
Command: commandStr,