bp2build: add bazel_module: { bp2build_available } prop.
This CL adds a per-target allowlist to instruct bp2build on which modules it should generate Bazel targets for.
Test: soong tests
Change-Id: I869e66fce405c2c6689b381569b8cc0118cbcf76
diff --git a/bp2build/testing.go b/bp2build/testing.go
index b5f5448..1f0ada2 100644
--- a/bp2build/testing.go
+++ b/bp2build/testing.go
@@ -27,6 +27,8 @@
android.ModuleBase
props customProps
+
+ bazelProps bazel.Properties
}
// OutputFiles is needed because some instances of this module use dist with a
@@ -42,6 +44,7 @@
func customModuleFactoryBase() android.Module {
module := &customModule{}
module.AddProperties(&module.props)
+ module.AddProperties(&module.bazelProps)
return module
}
@@ -124,6 +127,10 @@
func customBp2BuildMutator(ctx android.TopDownMutatorContext) {
if m, ok := ctx.Module().(*customModule); ok {
+ if !m.bazelProps.Bazel_module.Bp2build_available {
+ return
+ }
+
attrs := &customBazelModuleAttributes{
String_prop: m.props.String_prop,
String_list_prop: m.props.String_list_prop,
@@ -143,6 +150,10 @@
// module to target.
func customBp2BuildMutatorFromStarlark(ctx android.TopDownMutatorContext) {
if m, ok := ctx.Module().(*customModule); ok {
+ if !m.bazelProps.Bazel_module.Bp2build_available {
+ return
+ }
+
baseName := m.Name()
attrs := &customBazelModuleAttributes{}