Switch PackageContext functions to take a ctx
So that the Path and similar functions can be used directly, without
manually adding something like configErrorWrapper (it just uses it all
the time now).
Bug: 76168832
Test: out/soong/build.ninja is identical
Change-Id: I8cb524b09a84d0b8357d7c3501c71270af411e17
Merged-In: I8cb524b09a84d0b8357d7c3501c71270af411e17
(cherry picked from commit 54daaf0371fd7196bec7fd6c5960ba787b868751)
diff --git a/cc/builder.go b/cc/builder.go
index 43bd61f..d438add 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -196,10 +196,10 @@
_ = pctx.SourcePathVariable("sAbiDiffer", "prebuilts/clang-tools/${config.HostPrebuiltTag}/bin/header-abi-diff")
sAbiDiff = pctx.AndroidRuleFunc("sAbiDiff",
- func(config android.Config) (blueprint.RuleParams, error) {
+ func(ctx android.PackageRuleContext) blueprint.RuleParams {
commandStr := "($sAbiDiffer $allowFlags -lib $libName -arch $arch -check-all-apis -o ${out} -new $in -old $referenceDump)"
- distDir := config.ProductVariables.DistDir
+ distDir := ctx.Config().ProductVariables.DistDir
commandStr += " || (echo ' ---- Please update abi references by running platform/development/vndk/tools/header-checker/utils/create_reference_dumps.py -l ${libName} ----'"
if distDir != nil && *distDir != "" {
distAbiDiffDir := *distDir + "/abidiffs/"
@@ -209,7 +209,7 @@
return blueprint.RuleParams{
Command: commandStr,
CommandDeps: []string{"$sAbiDiffer"},
- }, nil
+ }
},
"allowFlags", "referenceDump", "libName", "arch")