Add --bazel-mode and --bazel-mode-dev

This allows "bazel mixed builds prod mode", in additional to reworking
the mechanism in which mixed builds dev mode is enabled.

As a followup, CI scripts will be migrated to use the new flags, as
USE_BAZEL_ANALYSIS=1 is deprecated.

Test: Manually ran --bazel-mode with an allowlist verifying that the
module alone was enabled
Test: Manually verified --bazel-mode and --bazel-mode-dev cause a build
failure

Change-Id: If0d34360e60452f428b05828f4ec7596b7cb619a
This commit is contained in:
Chris Parsons
2022-08-18 22:04:11 -04:00
parent 5e7c4756b5
commit ef615e5841
9 changed files with 123 additions and 64 deletions

View File

@@ -96,7 +96,6 @@ const (
// Use bazel during analysis of build modules from an allowlist carefully
// curated by the build team to be proven stable.
// TODO(cparsons): Implement this mode.
BazelProdMode
)
@@ -481,14 +480,6 @@ func NewConfig(moduleListFile string, buildMode SoongBuildMode, runGoTests bool,
config.AndroidFirstDeviceTarget = FirstTarget(config.Targets[Android], "lib64", "lib32")[0]
}
// Checking USE_BAZEL_ANALYSIS must be done here instead of in the caller, so
// that we can invoke IsEnvTrue (which also registers the env var as a
// dependency of the build).
// TODO(cparsons): Remove this hack once USE_BAZEL_ANALYSIS is removed.
if buildMode == AnalysisNoBazel && config.IsEnvTrue("USE_BAZEL_ANALYSIS") {
buildMode = BazelDevMode
}
config.BuildMode = buildMode
config.BazelContext, err = NewBazelContext(config)
config.bp2buildPackageConfig = GetBp2BuildAllowList()
@@ -678,9 +669,7 @@ func (c *config) DeviceName() string {
// DeviceProduct returns the current product target. There could be multiple of
// these per device type.
//
// NOTE: Do not base conditional logic on this value. It may break product
//
// inheritance.
// NOTE: Do not base conditional logic on this value. It may break product inheritance.
func (c *config) DeviceProduct() string {
return *c.productVariables.DeviceProduct
}