Pass pctx and ctx to NewRuleBuilder

Enable the RuleBuilder and RuleBuilderCommand methods to access
the BuilderContext by passing it to NewRuleBuilder instead of
RuleBuilder.Build.

Test: genrule_test.go
Test: rule_builder_test.go
Test: m checkbuild
Change-Id: I63e6597e19167393876dc2259d6f521363b7dabc
This commit is contained in:
Colin Cross
2020-11-16 17:32:30 -08:00
parent 33e1763094
commit f1a035e6be
39 changed files with 348 additions and 314 deletions

View File

@@ -85,8 +85,8 @@ func (b *bootJarsSingleton) GenerateBuildActions(ctx android.SingletonContext) {
timestamp := android.PathForOutput(ctx, "boot-jars-package-check/stamp")
rule := android.NewRuleBuilder()
checkBootJars := rule.Command().BuiltTool(ctx, "check_boot_jars").
rule := android.NewRuleBuilder(pctx, ctx)
checkBootJars := rule.Command().BuiltTool("check_boot_jars").
Input(ctx.Config().HostToolPath(ctx, "dexdump")).
Input(android.PathForSource(ctx, "build/soong/scripts/check_boot_jars/package_allowed_list.txt"))
@@ -109,7 +109,7 @@ func (b *bootJarsSingleton) GenerateBuildActions(ctx android.SingletonContext) {
}
checkBootJars.Text("&& touch").Output(timestamp)
rule.Build(pctx, ctx, "boot_jars_package_check", "check boot jar packages")
rule.Build("boot_jars_package_check", "check boot jar packages")
// The check-boot-jars phony target depends on the timestamp created if the check succeeds.
ctx.Phony("check-boot-jars", timestamp)