aboutsummaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorMarkDacek <dacek@google.com>2023-03-16 19:15:19 +0000
committerMark Dacek <dacek@google.com>2023-04-14 02:17:54 +0000
commit9c094ca153a7ff41fbe96e6fe8c0e9c9878ed810 (patch)
treea507bdbb5722107da5dc974ffab8234facb06555 /android
parent3d1b6964ecbc7114bf67dfae175d97dd450e55ae (diff)
downloadsoong-9c094ca153a7ff41fbe96e6fe8c0e9c9878ed810.tar.gz
Fix issue where bazel-force-enabled-modules aren't actually analyzed.
Bug: 273910287 Test: run mixed_mode_test.sh Change-Id: I309c423b6e7f505ad1db0d9327e7de6b8298dfe9
Diffstat (limited to 'android')
-rw-r--r--android/bazel_handler.go6
-rw-r--r--android/config.go10
-rw-r--r--android/test_config.go1
3 files changed, 13 insertions, 4 deletions
diff --git a/android/bazel_handler.go b/android/bazel_handler.go
index 5c429e21d..ade2c496a 100644
--- a/android/bazel_handler.go
+++ b/android/bazel_handler.go
@@ -84,8 +84,12 @@ func RegisterMixedBuildsMutator(ctx RegistrationContext) {
func mixedBuildsPrepareMutator(ctx BottomUpMutatorContext) {
if m := ctx.Module(); m.Enabled() {
if mixedBuildMod, ok := m.(MixedBuildBuildable); ok {
- if mixedBuildMod.IsMixedBuildSupported(ctx) && MixedBuildsEnabled(ctx) {
+ queueMixedBuild := mixedBuildMod.IsMixedBuildSupported(ctx) && MixedBuildsEnabled(ctx)
+ if queueMixedBuild {
mixedBuildMod.QueueBazelCall(ctx)
+ } else if _, ok := ctx.Config().bazelForceEnabledModules[m.Name()]; ok {
+ // TODO(b/273910287) - remove this once --ensure_allowlist_integrity is added
+ ctx.ModuleErrorf("Attempted to force enable an unready module: %s. Did you forget to Bp2BuildDefaultTrue its directory?\n", m.Name())
}
}
}
diff --git a/android/config.go b/android/config.go
index 2904581ea..032172d6e 100644
--- a/android/config.go
+++ b/android/config.go
@@ -592,12 +592,11 @@ func NewConfig(cmdArgs CmdArgs, availableEnv map[string]string) (Config, error)
setBazelMode(cmdArgs.BazelMode, "--bazel-mode", BazelProdMode)
setBazelMode(cmdArgs.BazelModeStaging, "--bazel-mode-staging", BazelStagingMode)
- config.BazelContext, err = NewBazelContext(config)
- config.Bp2buildPackageConfig = GetBp2BuildAllowList()
-
for _, module := range strings.Split(cmdArgs.BazelForceEnabledModules, ",") {
config.bazelForceEnabledModules[module] = struct{}{}
}
+ config.BazelContext, err = NewBazelContext(config)
+ config.Bp2buildPackageConfig = GetBp2BuildAllowList()
return Config{config}, err
}
@@ -1934,3 +1933,8 @@ func (c *config) BuildFromTextStub() bool {
func (c *config) SetBuildFromTextStub(b bool) {
c.buildFromTextStub = b
}
+func (c *config) AddForceEnabledModules(forceEnabled []string) {
+ for _, forceEnabledModule := range forceEnabled {
+ c.bazelForceEnabledModules[forceEnabledModule] = struct{}{}
+ }
+}
diff --git a/android/test_config.go b/android/test_config.go
index 07ca33d56..28d9ec403 100644
--- a/android/test_config.go
+++ b/android/test_config.go
@@ -65,6 +65,7 @@ func TestConfig(buildDir string, env map[string]string, bp string, fs map[string
BuildMode: BazelProdMode,
mixedBuildDisabledModules: make(map[string]struct{}),
mixedBuildEnabledModules: make(map[string]struct{}),
+ bazelForceEnabledModules: make(map[string]struct{}),
}
config.deviceConfig = &deviceConfig{
config: config,