NDK library: switch abi diffing to STG

Bug: 156513478
Change-Id: Ie45cb7daffb9861ed5bc26792f184bffcbe90bdb
Signed-off-by: Matthias Maennich <maennich@google.com>
This commit is contained in:
Matthias Maennich
2023-06-30 23:28:15 +01:00
parent ca8ae6564f
commit 658bb4dad9

View File

@@ -31,9 +31,9 @@ import (
func init() { func init() {
pctx.HostBinToolVariable("ndkStubGenerator", "ndkstubgen") pctx.HostBinToolVariable("ndkStubGenerator", "ndkstubgen")
pctx.HostBinToolVariable("abidiff", "abidiff")
pctx.HostBinToolVariable("abidw", "abidw") pctx.HostBinToolVariable("abidw", "abidw")
pctx.HostBinToolVariable("stg", "stg") pctx.HostBinToolVariable("stg", "stg")
pctx.HostBinToolVariable("stgdiff", "stgdiff")
} }
var ( var (
@@ -58,14 +58,14 @@ var (
CommandDeps: []string{"$stg"}, CommandDeps: []string{"$stg"},
}) })
abidiff = pctx.AndroidStaticRule("abidiff", stgdiff = pctx.AndroidStaticRule("stgdiff",
blueprint.RuleParams{ blueprint.RuleParams{
// Need to create *some* output for ninja. We don't want to use tee // Need to create *some* output for ninja. We don't want to use tee
// because we don't want to spam the build output with "nothing // because we don't want to spam the build output with "nothing
// changed" messages, so redirect output message to $out, and if // changed" messages, so redirect output message to $out, and if
// changes were detected print the output and fail. // changes were detected print the output and fail.
Command: "$abidiff $args $in > $out || (cat $out && false)", Command: "$stgdiff $args --stg $in -o $out || (cat $out && false)",
CommandDeps: []string{"$abidiff"}, CommandDeps: []string{"$stgdiff"},
}, "args") }, "args")
ndkLibrarySuffix = ".ndk" ndkLibrarySuffix = ".ndk"
@@ -392,7 +392,7 @@ func findNextApiLevel(ctx ModuleContext, apiLevel android.ApiLevel) *android.Api
func (this *stubDecorator) diffAbi(ctx ModuleContext) { func (this *stubDecorator) diffAbi(ctx ModuleContext) {
// Catch any ABI changes compared to the checked-in definition of this API // Catch any ABI changes compared to the checked-in definition of this API
// level. // level.
abiDiffPath := android.PathForModuleOut(ctx, "abidiff.timestamp") abiDiffPath := android.PathForModuleOut(ctx, "stgdiff.timestamp")
prebuiltAbiDump := this.findPrebuiltAbiDump(ctx, this.apiLevel) prebuiltAbiDump := this.findPrebuiltAbiDump(ctx, this.apiLevel)
missingPrebuiltError := fmt.Sprintf( missingPrebuiltError := fmt.Sprintf(
"Did not find prebuilt ABI dump for %q (%q). Generate with "+ "Did not find prebuilt ABI dump for %q (%q). Generate with "+
@@ -408,11 +408,14 @@ func (this *stubDecorator) diffAbi(ctx ModuleContext) {
}) })
} else { } else {
ctx.Build(pctx, android.BuildParams{ ctx.Build(pctx, android.BuildParams{
Rule: abidiff, Rule: stgdiff,
Description: fmt.Sprintf("abidiff %s %s", prebuiltAbiDump, Description: fmt.Sprintf("Comparing ABI %s %s", prebuiltAbiDump,
this.abiDumpPath), this.abiDumpPath),
Output: abiDiffPath, Output: abiDiffPath,
Inputs: android.Paths{prebuiltAbiDump.Path(), this.abiDumpPath}, Inputs: android.Paths{prebuiltAbiDump.Path(), this.abiDumpPath},
Args: map[string]string{
"args": "--format=small",
},
}) })
} }
this.abiDiffPaths = append(this.abiDiffPaths, abiDiffPath) this.abiDiffPaths = append(this.abiDiffPaths, abiDiffPath)
@@ -439,13 +442,13 @@ func (this *stubDecorator) diffAbi(ctx ModuleContext) {
}) })
} else { } else {
ctx.Build(pctx, android.BuildParams{ ctx.Build(pctx, android.BuildParams{
Rule: abidiff, Rule: stgdiff,
Description: fmt.Sprintf("abidiff %s %s", this.abiDumpPath, Description: fmt.Sprintf("abidiff %s %s", this.abiDumpPath,
nextAbiDump), nextAbiDump),
Output: nextAbiDiffPath, Output: nextAbiDiffPath,
Inputs: android.Paths{this.abiDumpPath, nextAbiDump.Path()}, Inputs: android.Paths{this.abiDumpPath, nextAbiDump.Path()},
Args: map[string]string{ Args: map[string]string{
"args": "--no-added-syms", "args": "--format=small --ignore=interface_addition",
}, },
}) })
} }