Refactor mixed build allowlist handling
This refactoring prepares for introduction of bazel prod mode, an
alternative mechanism for mixed builds allowlist handling.
* Decide bazel-mode as close to soong_build main as possible
* BazelContext itself decides whether a module is allowlisted
* Separate bp2build and mixed build allowlist
Test: m nothing, manually verified all modules are mixed build disabled
(via metrics)
Test: USE_BAZEL_ANALYSIS=1 m nothing, manually verified that mixed build
disabled/enabled modules are identical before and after change.
Change-Id: I0f55d8b85000cb4a871a099edc6d7d868d7df509
diff --git a/cc/bp2build.go b/cc/bp2build.go
index ba93439..5954098 100644
--- a/cc/bp2build.go
+++ b/cc/bp2build.go
@@ -983,7 +983,7 @@
func bazelLabelForStaticModule(ctx android.BazelConversionPathContext, m blueprint.Module) string {
label := android.BazelModuleLabel(ctx, m)
- if ccModule, ok := m.(*Module); ok && ccModule.typ() == fullLibrary && !android.GenerateCcLibraryStaticOnly(m.Name()) {
+ if ccModule, ok := m.(*Module); ok && ccModule.typ() == fullLibrary && !android.GetBp2BuildAllowList().GenerateCcLibraryStaticOnly(m.Name()) {
label += "_bp2build_cc_library_static"
}
return label
diff --git a/cc/library.go b/cc/library.go
index 621b58c..41dca01 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -282,7 +282,7 @@
// For some cc_library modules, their static variants are ready to be
// converted, but not their shared variants. For these modules, delegate to
// the cc_library_static bp2build converter temporarily instead.
- if android.GenerateCcLibraryStaticOnly(ctx.Module().Name()) {
+ if android.GetBp2BuildAllowList().GenerateCcLibraryStaticOnly(ctx.Module().Name()) {
sharedOrStaticLibraryBp2Build(ctx, m, true)
return
}