bp2build: refactor BazelTargetModule naming boilerplate.

This CL replaces the "__bp2build__" name prefix boilerplate with a props
creation function, and centralizes the prefixing in there.

Test: TH
Test: soong tests
Change-Id: Ic963199ab60dcce0d3361abff111cfa9acd4c21b
This commit is contained in:
Jingwen Chen
2021-02-07 10:05:16 -05:00
parent 1c2317315c
commit fb4692a743
6 changed files with 51 additions and 36 deletions

View File

@@ -57,12 +57,7 @@ func FilegroupBp2Build(ctx TopDownMutatorContext) {
Srcs: BazelLabelForModuleSrcExcludes(ctx, fg.properties.Srcs, fg.properties.Exclude_srcs),
}
// Can we automate this?
name := "__bp2build__" + fg.Name()
props := bazel.BazelTargetModuleProperties{
Name: &name,
Rule_class: "filegroup",
}
props := bazel.NewBazelTargetModuleProperties(fg.Name(), "filegroup", "")
ctx.CreateBazelTargetModule(BazelFileGroupFactory, props, attrs)
}