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

View File

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

View File

@@ -96,7 +96,6 @@ type CmdArgs struct {
MultitreeBuild bool MultitreeBuild bool
BazelMode bool BazelMode bool
BazelModeDev bool
BazelModeStaging bool BazelModeStaging bool
BazelForceEnabledModules string BazelForceEnabledModules string
@@ -132,11 +131,6 @@ const (
// Generate a documentation file for module type definitions and exit. // Generate a documentation file for module type definitions and exit.
GenerateDocFile 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 // Use bazel during analysis of a few allowlisted build modules. The allowlist
// is considered "staging, as these are modules being prepared to be released // is considered "staging, as these are modules being prepared to be released
// into prod mode shortly after. // 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.BazelApiBp2buildDir, ApiBp2build)
setBuildMode(cmdArgs.ModuleGraphFile, GenerateModuleGraph) setBuildMode(cmdArgs.ModuleGraphFile, GenerateModuleGraph)
setBuildMode(cmdArgs.DocFile, GenerateDocFile) setBuildMode(cmdArgs.DocFile, GenerateDocFile)
setBazelMode(cmdArgs.BazelModeDev, "--bazel-mode-dev", BazelDevMode)
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)
@@ -726,7 +719,7 @@ func (c *config) IsMixedBuildsEnabled() bool {
return true return true
}).(bool) }).(bool)
bazelModeEnabled := c.BuildMode == BazelProdMode || c.BuildMode == BazelDevMode || c.BuildMode == BazelStagingMode bazelModeEnabled := c.BuildMode == BazelProdMode || c.BuildMode == BazelStagingMode
return globalMixedBuildsSupport && bazelModeEnabled 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 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 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 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)") var onlySoong = flag.Bool("only-soong", false, "Only run product config and Soong (not Kati)")
@@ -229,10 +228,6 @@ func getBazelArg() string {
count++ count++
str = "--bazel-mode-staging" str = "--bazel-mode-staging"
} }
if *bazelModeDev {
count++
str = "--bazel-mode-dev"
}
if count > 1 { if count > 1 {
// Can't set more than one // 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.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.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.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.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.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") 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 { if config.bazelProdMode {
count++ count++
} }
if config.bazelDevMode {
count++
}
if config.bazelStagingMode { if config.bazelStagingMode {
count++ count++
} }
if count > 1 { if count > 1 {
ctx.Fatalln("Conflicting bazel mode.\n" + 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 pathReplaced bool
bazelProdMode bool bazelProdMode bool
bazelDevMode bool
bazelStagingMode bool bazelStagingMode bool
// Set by multiproduct_kati // Set by multiproduct_kati
@@ -853,8 +852,6 @@ func (c *configImpl) parseArgs(ctx Context, args []string) {
c.multitreeBuild = true c.multitreeBuild = true
} else if arg == "--bazel-mode" { } else if arg == "--bazel-mode" {
c.bazelProdMode = true c.bazelProdMode = true
} else if arg == "--bazel-mode-dev" {
c.bazelDevMode = true
} else if arg == "--bazel-mode-staging" { } else if arg == "--bazel-mode-staging" {
c.bazelStagingMode = true c.bazelStagingMode = true
} else if arg == "--search-api-dir" { } else if arg == "--search-api-dir" {
@@ -960,7 +957,7 @@ func (c *configImpl) parseArgs(ctx Context, args []string) {
c.arguments = append(c.arguments, arg) c.arguments = append(c.arguments, arg)
} }
} }
if (!c.bazelProdMode) && (!c.bazelDevMode) && (!c.bazelStagingMode) { if (!c.bazelProdMode) && (!c.bazelStagingMode) {
c.bazelProdMode = defaultBazelProdMode(c) c.bazelProdMode = defaultBazelProdMode(c)
} }
} }
@@ -1385,7 +1382,7 @@ func (c *configImpl) UseRBE() bool {
} }
func (c *configImpl) BazelBuildEnabled() bool { func (c *configImpl) BazelBuildEnabled() bool {
return c.bazelProdMode || c.bazelDevMode || c.bazelStagingMode return c.bazelProdMode || c.bazelStagingMode
} }
func (c *configImpl) StartRBE() bool { func (c *configImpl) StartRBE() bool {

View File

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

View File

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