Copy abidiffs into /abidiffs on abi breakages.

Bug: 64267858

Test: create reference abi dump for libjpeg locally. Change return type
      of libjpeg_std_err and build with :
      BOARD_VNDK_VERSION=current mm -j64 showcommands dist
      Build fails and abidiff report gets copied into out/dist/abidiffs.

Change-Id: I7c8ecfac95361e731009e5913bd3a7bb323a9597
This commit is contained in:
Jayant Chowdhary
2017-11-27 14:52:21 -08:00
parent cf31fcfc71
commit 219139df8c
2 changed files with 14 additions and 5 deletions

View File

@@ -189,6 +189,7 @@ type productVariables struct {
Override_rs_driver *string `json:",omitempty"`
DeviceKernelHeaders []string `json:",omitempty"`
DistDir *string `json:",omitempty"`
}
func boolPtr(v bool) *bool {

View File

@@ -196,11 +196,19 @@ var (
_ = pctx.SourcePathVariable("sAbiDiffer", "prebuilts/build-tools/${config.HostPrebuiltTag}/bin/header-abi-diff")
// Abidiff check turned on in advice-only mode. Builds will not fail on abi incompatibilties / extensions.
sAbiDiff = pctx.AndroidStaticRule("sAbiDiff",
blueprint.RuleParams{
Command: "$sAbiDiffer $allowFlags -lib $libName -arch $arch -check-all-apis -o ${out} -new $in -old $referenceDump",
CommandDeps: []string{"$sAbiDiffer"},
sAbiDiff = pctx.AndroidRuleFunc("sAbiDiff",
func(config android.Config) (blueprint.RuleParams, error) {
commandStr := "($sAbiDiffer $allowFlags -lib $libName -arch $arch -check-all-apis -o ${out} -new $in -old $referenceDump)"
distDir := config.ProductVariables.DistDir
if distDir != nil && *distDir != "" {
distAbiDiffDir := *distDir + "/abidiffs/"
commandStr += " || (mkdir -p " + distAbiDiffDir + " && cp ${out} " + distAbiDiffDir + " && exit 1)"
}
return blueprint.RuleParams{
Command: commandStr,
CommandDeps: []string{"$sAbiDiffer"},
}, nil
},
"allowFlags", "referenceDump", "libName", "arch")