Merge "Fix instantiation of config.bazelForceEnabledModules"

This commit is contained in:
Mark Dacek
2023-05-04 18:20:00 +00:00
committed by Gerrit Code Review
2 changed files with 8 additions and 5 deletions

View File

@@ -606,7 +606,7 @@ func NewConfig(cmdArgs CmdArgs, availableEnv map[string]string) (Config, error)
setBazelMode(cmdArgs.BazelMode, "--bazel-mode", BazelProdMode) setBazelMode(cmdArgs.BazelMode, "--bazel-mode", BazelProdMode)
setBazelMode(cmdArgs.BazelModeStaging, "--bazel-mode-staging", BazelStagingMode) setBazelMode(cmdArgs.BazelModeStaging, "--bazel-mode-staging", BazelStagingMode)
for _, module := range strings.Split(cmdArgs.BazelForceEnabledModules, ",") { for _, module := range getForceEnabledModulesFromFlag(cmdArgs.BazelForceEnabledModules) {
config.bazelForceEnabledModules[module] = struct{}{} config.bazelForceEnabledModules[module] = struct{}{}
} }
config.BazelContext, err = NewBazelContext(config) config.BazelContext, err = NewBazelContext(config)
@@ -615,6 +615,13 @@ func NewConfig(cmdArgs CmdArgs, availableEnv map[string]string) (Config, error)
return Config{config}, err return Config{config}, err
} }
func getForceEnabledModulesFromFlag(forceEnabledFlag string) []string {
if forceEnabledFlag == "" {
return []string{}
}
return strings.Split(forceEnabledFlag, ",")
}
// mockFileSystem replaces all reads with accesses to the provided map of // mockFileSystem replaces all reads with accesses to the provided map of
// filenames to contents stored as a byte slice. // filenames to contents stored as a byte slice.
func (c *config) mockFileSystem(bp string, fs map[string][]byte) { func (c *config) mockFileSystem(bp string, fs map[string][]byte) {

View File

@@ -337,10 +337,6 @@ func checkForAllowlistIntegrityError(configuration android.Config, isStagingMode
// This indicates the allowlisting of this variant had no effect. // This indicates the allowlisting of this variant had no effect.
// TODO(b/280457637): Return true for nonexistent modules. // TODO(b/280457637): Return true for nonexistent modules.
func isAllowlistMisconfiguredForModule(module string, mixedBuildsEnabled map[string]struct{}, mixedBuildsDisabled map[string]struct{}) bool { func isAllowlistMisconfiguredForModule(module string, mixedBuildsEnabled map[string]struct{}, mixedBuildsDisabled map[string]struct{}) bool {
//TODO(dacek): Why does this occur in the allowlists?
if module == "" {
return false
}
_, enabled := mixedBuildsEnabled[module] _, enabled := mixedBuildsEnabled[module]
if enabled { if enabled {