Refactor BazelTargetModule

This eliminates the need to remove quotes, delete attributes, and
re-checking that name has correct prefix. Additionally, this allows
assignment directly to the BazelTargetModuleProperties struct, which
allows defaulting unused fields and clarity of which field is being set.

Test: go test soong tests
Test: ran ./build/bazel/scripts/milestone-2/demo.sh
Change-Id: Ia9bfcce76234c793a4ddd5f29a661150f83341c9
This commit is contained in:
Liz Kammer
2021-02-19 11:06:17 -05:00
parent ece454400d
commit fc46bc1ee4
10 changed files with 85 additions and 102 deletions

View File

@@ -129,13 +129,12 @@ func CcLibraryHeadersBp2Build(ctx android.TopDownMutatorContext) {
Deps: headerLibLabels,
}
props := bazel.NewBazelTargetModuleProperties(
module.Name(),
"cc_library_headers",
"//build/bazel/rules:cc_library_headers.bzl",
)
props := bazel.BazelTargetModuleProperties{
Rule_class: "cc_library_headers",
Bzl_load_location: "//build/bazel/rules:cc_library_headers.bzl",
}
ctx.CreateBazelTargetModule(BazelCcLibraryHeadersFactory, props, attrs)
ctx.CreateBazelTargetModule(BazelCcLibraryHeadersFactory, module.Name(), props, attrs)
}
func (m *bazelCcLibraryHeaders) Name() string {