Refactor "staging dep on prod" allowlist dep
This allows branch-specific plugins to more easily add modules to
staging or prod mode allowlists (they need not separately ensure that
staging mode is a superset of prod mode)
Bug: 254447469
Test: TH
Test: Verified that adding tzdata modules via plugin (not part of
this CL) causes many outputs under bazel-out directories
Change-Id: I5d543e262a42cce324c59e3f9880b57ca209c13c
diff --git a/android/allowlists/allowlists.go b/android/allowlists/allowlists.go
index a1b7dbf..22ec7e7 100644
--- a/android/allowlists/allowlists.go
+++ b/android/allowlists/allowlists.go
@@ -1339,9 +1339,12 @@
"prebuilt_currysrc_org.eclipse",
}
+ // Bazel prod-mode allowlist. Modules in this list are built by Bazel
+ // in either prod mode or staging mode.
ProdMixedBuildsEnabledList = []string{}
- // Staging builds should be entirely prod, plus some near-ready ones. Add the
- // new ones to the first argument as needed.
- StagingMixedBuildsEnabledList = append([]string{}, ProdMixedBuildsEnabledList...)
+ // Staging-mode allowlist. Modules in this list are only built
+ // by Bazel with --bazel-mode-staging. This list should contain modules
+ // which will soon be added to the prod allowlist.
+ StagingMixedBuildsEnabledList = []string{}
)
diff --git a/android/bazel_handler.go b/android/bazel_handler.go
index d4af70b..f289c56 100644
--- a/android/bazel_handler.go
+++ b/android/bazel_handler.go
@@ -389,9 +389,12 @@
}
case BazelStagingMode:
modulesDefaultToBazel = false
+ // Staging mode includes all prod modules plus all staging modules.
+ for _, enabledProdModule := range allowlists.ProdMixedBuildsEnabledList {
+ enabledModules[enabledProdModule] = true
+ }
for _, enabledStagingMode := range allowlists.StagingMixedBuildsEnabledList {
enabledModules[enabledStagingMode] = true
-
}
case BazelDevMode:
modulesDefaultToBazel = true
diff --git a/android/config.go b/android/config.go
index 50f63ea..0c3e2d1 100644
--- a/android/config.go
+++ b/android/config.go
@@ -536,7 +536,7 @@
// Returns true if "Bazel builds" is enabled. In this mode, part of build
// analysis is handled by Bazel.
func (c *config) IsMixedBuildsEnabled() bool {
- return c.BuildMode == BazelProdMode || c.BuildMode == BazelDevMode
+ return c.BuildMode == BazelProdMode || c.BuildMode == BazelDevMode || c.BuildMode == BazelStagingMode
}
func (c *config) SetAllowMissingDependencies() {