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:
@@ -34,7 +34,7 @@ func genProto(ctx android.ModuleContext, protoFiles android.Paths, flags android
|
||||
|
||||
outDir := srcJarFile.ReplaceExtension(ctx, "tmp")
|
||||
|
||||
rule := android.NewRuleBuilder()
|
||||
rule := android.NewRuleBuilder(pctx, ctx)
|
||||
|
||||
rule.Command().Text("rm -rf").Flag(outDir.String())
|
||||
rule.Command().Text("mkdir -p").Flag(outDir.String())
|
||||
@@ -42,13 +42,13 @@ func genProto(ctx android.ModuleContext, protoFiles android.Paths, flags android
|
||||
for _, protoFile := range shard {
|
||||
depFile := srcJarFile.InSameDir(ctx, protoFile.String()+".d")
|
||||
rule.Command().Text("mkdir -p").Flag(filepath.Dir(depFile.String()))
|
||||
android.ProtoRule(ctx, rule, protoFile, flags, flags.Deps, outDir, depFile, nil)
|
||||
android.ProtoRule(rule, protoFile, flags, flags.Deps, outDir, depFile, nil)
|
||||
}
|
||||
|
||||
// Proto generated java files have an unknown package name in the path, so package the entire output directory
|
||||
// into a srcjar.
|
||||
rule.Command().
|
||||
BuiltTool(ctx, "soong_zip").
|
||||
BuiltTool("soong_zip").
|
||||
Flag("-jar").
|
||||
Flag("-write_if_changed").
|
||||
FlagWithOutput("-o ", srcJarFile).
|
||||
@@ -66,7 +66,7 @@ func genProto(ctx android.ModuleContext, protoFiles android.Paths, flags android
|
||||
ruleDesc += " " + strconv.Itoa(i)
|
||||
}
|
||||
|
||||
rule.Build(pctx, ctx, ruleName, ruleDesc)
|
||||
rule.Build(ruleName, ruleDesc)
|
||||
}
|
||||
|
||||
return srcJarFiles
|
||||
|
Reference in New Issue
Block a user