Merge "Remove bazel dev mode"

This commit is contained in:
Treehugger Robot
2023-06-15 18:28:13 +00:00
committed by Gerrit Code Review
9 changed files with 9 additions and 52 deletions

View File

@@ -229,8 +229,6 @@ type mixedBuildBazelContext struct {
bazelEnabledModules map[string]bool
// DCLA modules are enabled when used in apex.
bazelDclaEnabledModules map[string]bool
// If true, modules are bazel-enabled by default, unless present in bazelDisabledModules.
modulesDefaultToBazel bool
targetProduct string
targetBuildVariant string
@@ -497,10 +495,8 @@ func GetBazelEnabledAndDisabledModules(buildMode SoongBuildMode, forceEnabled ma
for enabledAdHocModule := range forceEnabled {
enabledModules[enabledAdHocModule] = true
}
case BazelDevMode:
AddToStringSet(disabledModules, allowlists.MixedBuildsDisabledList)
default:
panic("Expected BazelProdMode, BazelStagingMode, or BazelDevMode")
panic("Expected BazelProdMode or BazelStagingMode")
}
return enabledModules, disabledModules
}
@@ -518,7 +514,7 @@ func GetBazelEnabledModules(buildMode SoongBuildMode) []string {
}
func NewBazelContext(c *config) (BazelContext, error) {
if c.BuildMode != BazelProdMode && c.BuildMode != BazelStagingMode && c.BuildMode != BazelDevMode {
if c.BuildMode != BazelProdMode && c.BuildMode != BazelStagingMode {
return noopBazelContext{}, nil
}
@@ -582,7 +578,6 @@ func NewBazelContext(c *config) (BazelContext, error) {
return &mixedBuildBazelContext{
bazelRunner: &builtinBazelRunner{c.UseBazelProxy, absolutePath(c.outDir)},
paths: &paths,
modulesDefaultToBazel: c.BuildMode == BazelDevMode,
bazelEnabledModules: enabledModules,
bazelDisabledModules: disabledModules,
bazelDclaEnabledModules: dclaEnabledModules,
@@ -606,7 +601,7 @@ func (context *mixedBuildBazelContext) IsModuleNameAllowed(moduleName string, wi
return true
}
return context.modulesDefaultToBazel
return false
}
func (context *mixedBuildBazelContext) IsModuleDclaAllowed(moduleName string) bool {

View File

@@ -263,7 +263,6 @@ func TestIsModuleNameAllowed(t *testing.T) {
}
bazelContext := &mixedBuildBazelContext{
modulesDefaultToBazel: false,
bazelEnabledModules: enabledModules,
bazelDisabledModules: disabledModules,
bazelDclaEnabledModules: dclaEnabledModules,

View File

@@ -96,7 +96,6 @@ type CmdArgs struct {
MultitreeBuild bool
BazelMode bool
BazelModeDev bool
BazelModeStaging bool
BazelForceEnabledModules string
@@ -132,11 +131,6 @@ const (
// Generate a documentation file for module type definitions and exit.
GenerateDocFile
// Use bazel during analysis of many allowlisted build modules. The allowlist
// is considered a "developer mode" allowlist, as some modules may be
// allowlisted on an experimental basis.
BazelDevMode
// Use bazel during analysis of a few allowlisted build modules. The allowlist
// is considered "staging, as these are modules being prepared to be released
// into prod mode shortly after.
@@ -622,7 +616,6 @@ func NewConfig(cmdArgs CmdArgs, availableEnv map[string]string) (Config, error)
setBuildMode(cmdArgs.BazelApiBp2buildDir, ApiBp2build)
setBuildMode(cmdArgs.ModuleGraphFile, GenerateModuleGraph)
setBuildMode(cmdArgs.DocFile, GenerateDocFile)
setBazelMode(cmdArgs.BazelModeDev, "--bazel-mode-dev", BazelDevMode)
setBazelMode(cmdArgs.BazelMode, "--bazel-mode", BazelProdMode)
setBazelMode(cmdArgs.BazelModeStaging, "--bazel-mode-staging", BazelStagingMode)
@@ -726,7 +719,7 @@ func (c *config) IsMixedBuildsEnabled() bool {
return true
}).(bool)
bazelModeEnabled := c.BuildMode == BazelProdMode || c.BuildMode == BazelDevMode || c.BuildMode == BazelStagingMode
bazelModeEnabled := c.BuildMode == BazelProdMode || c.BuildMode == BazelStagingMode
return globalMixedBuildsSupport && bazelModeEnabled
}

View File

@@ -50,7 +50,6 @@ var alternateResultDir = flag.Bool("dist", false, "write select results to $DIST
var bazelMode = flag.Bool("bazel-mode", false, "use bazel for analysis of certain modules")
var bazelModeStaging = flag.Bool("bazel-mode-staging", false, "use bazel for analysis of certain near-ready modules")
var bazelModeDev = flag.Bool("bazel-mode-dev", false, "use bazel for analysis of a large number of modules (less stable)")
var onlyConfig = flag.Bool("only-config", false, "Only run product config (not Soong or Kati)")
var onlySoong = flag.Bool("only-soong", false, "Only run product config and Soong (not Kati)")
@@ -229,10 +228,6 @@ func getBazelArg() string {
count++
str = "--bazel-mode-staging"
}
if *bazelModeDev {
count++
str = "--bazel-mode-dev"
}
if count > 1 {
// Can't set more than one

View File

@@ -86,7 +86,6 @@ func init() {
flag.BoolVar(&cmdlineArgs.MultitreeBuild, "multitree-build", false, "this is a multitree build")
flag.BoolVar(&cmdlineArgs.BazelMode, "bazel-mode", false, "use bazel for analysis of certain modules")
flag.BoolVar(&cmdlineArgs.BazelModeStaging, "bazel-mode-staging", false, "use bazel for analysis of certain near-ready modules")
flag.BoolVar(&cmdlineArgs.BazelModeDev, "bazel-mode-dev", false, "use bazel for analysis of a large number of modules (less stable)")
flag.BoolVar(&cmdlineArgs.UseBazelProxy, "use-bazel-proxy", false, "communicate with bazel using unix socket proxy instead of spawning subprocesses")
flag.BoolVar(&cmdlineArgs.BuildFromTextStub, "build-from-text-stub", false, "build Java stubs from API text files instead of source files")
flag.BoolVar(&cmdlineArgs.EnsureAllowlistIntegrity, "ensure-allowlist-integrity", false, "verify that allowlisted modules are mixed-built")

View File

@@ -114,15 +114,12 @@ func checkBazelMode(ctx Context, config Config) {
if config.bazelProdMode {
count++
}
if config.bazelDevMode {
count++
}
if config.bazelStagingMode {
count++
}
if count > 1 {
ctx.Fatalln("Conflicting bazel mode.\n" +
"Do not specify more than one of --bazel-mode and --bazel-mode-dev and --bazel-mode-staging ")
"Do not specify more than one of --bazel-mode and --bazel-mode-staging ")
}
}

View File

@@ -111,7 +111,6 @@ type configImpl struct {
pathReplaced bool
bazelProdMode bool
bazelDevMode bool
bazelStagingMode bool
// Set by multiproduct_kati
@@ -853,8 +852,6 @@ func (c *configImpl) parseArgs(ctx Context, args []string) {
c.multitreeBuild = true
} else if arg == "--bazel-mode" {
c.bazelProdMode = true
} else if arg == "--bazel-mode-dev" {
c.bazelDevMode = true
} else if arg == "--bazel-mode-staging" {
c.bazelStagingMode = true
} else if arg == "--search-api-dir" {
@@ -960,7 +957,7 @@ func (c *configImpl) parseArgs(ctx Context, args []string) {
c.arguments = append(c.arguments, arg)
}
}
if (!c.bazelProdMode) && (!c.bazelDevMode) && (!c.bazelStagingMode) {
if (!c.bazelProdMode) && (!c.bazelStagingMode) {
c.bazelProdMode = defaultBazelProdMode(c)
}
}
@@ -1385,7 +1382,7 @@ func (c *configImpl) UseRBE() bool {
}
func (c *configImpl) BazelBuildEnabled() bool {
return c.bazelProdMode || c.bazelDevMode || c.bazelStagingMode
return c.bazelProdMode || c.bazelStagingMode
}
func (c *configImpl) StartRBE() bool {

View File

@@ -1018,7 +1018,6 @@ func TestBuildConfig(t *testing.T) {
environ Environment
arguments []string
useBazel bool
bazelDevMode bool
bazelProdMode bool
bazelStagingMode bool
expectedBuildConfig *smpb.BuildConfig
@@ -1096,19 +1095,6 @@ func TestBuildConfig(t *testing.T) {
NinjaWeightListSource: smpb.BuildConfig_NOT_USED.Enum(),
},
},
{
name: "bazel mixed build from dev mode",
environ: Environment{},
bazelDevMode: true,
expectedBuildConfig: &smpb.BuildConfig{
ForceUseGoma: proto.Bool(false),
UseGoma: proto.Bool(false),
UseRbe: proto.Bool(false),
BazelMixedBuild: proto.Bool(true),
ForceDisableBazelMixedBuild: proto.Bool(false),
NinjaWeightListSource: smpb.BuildConfig_NOT_USED.Enum(),
},
},
{
name: "bazel mixed build from prod mode",
environ: Environment{},
@@ -1158,8 +1144,8 @@ func TestBuildConfig(t *testing.T) {
"USE_RBE=1",
"BUILD_BROKEN_DISABLE_BAZEL=1",
},
useBazel: true,
bazelDevMode: true,
useBazel: true,
bazelProdMode: true,
expectedBuildConfig: &smpb.BuildConfig{
ForceUseGoma: proto.Bool(true),
UseGoma: proto.Bool(true),
@@ -1176,7 +1162,6 @@ func TestBuildConfig(t *testing.T) {
t.Run(tc.name, func(t *testing.T) {
c := &configImpl{
environ: &tc.environ,
bazelDevMode: tc.bazelDevMode,
bazelProdMode: tc.bazelProdMode,
bazelStagingMode: tc.bazelStagingMode,
arguments: tc.arguments,

View File

@@ -272,9 +272,6 @@ func bootstrapBlueprint(ctx Context, config Config) {
if config.bazelProdMode {
mainSoongBuildExtraArgs = append(mainSoongBuildExtraArgs, "--bazel-mode")
}
if config.bazelDevMode {
mainSoongBuildExtraArgs = append(mainSoongBuildExtraArgs, "--bazel-mode-dev")
}
if config.bazelStagingMode {
mainSoongBuildExtraArgs = append(mainSoongBuildExtraArgs, "--bazel-mode-staging")
}