Move bazel.Properties to a BazelModuleBase

This allows more direct access to the bazel label and whether the module
is bp2build available.

Test: go test *
Change-Id: I23375835d20fa53d7d94127b2dc2d5bb20487bfb
This commit is contained in:
Liz Kammer
2021-02-17 10:17:28 -05:00
parent ece454400d
commit ea6666fba9
9 changed files with 76 additions and 23 deletions

View File

@@ -25,10 +25,9 @@ type customProps struct {
type customModule struct {
android.ModuleBase
android.BazelModuleBase
props customProps
bazelProps bazel.Properties
}
// OutputFiles is needed because some instances of this module use dist with a
@@ -44,7 +43,7 @@ func (m *customModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
func customModuleFactoryBase() android.Module {
module := &customModule{}
module.AddProperties(&module.props)
module.AddProperties(&module.bazelProps)
android.InitBazelModule(module)
return module
}
@@ -127,7 +126,7 @@ func (m *customBazelModule) GenerateAndroidBuildActions(ctx android.ModuleContex
func customBp2BuildMutator(ctx android.TopDownMutatorContext) {
if m, ok := ctx.Module().(*customModule); ok {
if !m.bazelProps.Bazel_module.Bp2build_available {
if !m.ConvertWithBp2build() {
return
}
@@ -146,7 +145,7 @@ func customBp2BuildMutator(ctx android.TopDownMutatorContext) {
// module to target.
func customBp2BuildMutatorFromStarlark(ctx android.TopDownMutatorContext) {
if m, ok := ctx.Module().(*customModule); ok {
if !m.bazelProps.Bazel_module.Bp2build_available {
if !m.ConvertWithBp2build() {
return
}