Add command line flag for extra bazel-built modules
Test: m libcore --bazel-mode-staging --bazel-force-enabled-modules=libcore and find out/bazel/ -name libcore* Change-Id: I065696d06ce07e05300a41e133867a6e7a891b5e
This commit is contained in:
@@ -109,6 +109,8 @@ type configImpl struct {
|
||||
emptyNinjaFile bool
|
||||
|
||||
metricsUploader string
|
||||
|
||||
bazelForceEnabledModules string
|
||||
}
|
||||
|
||||
const srcDirFileCheck = "build/soong/root.bp"
|
||||
@@ -238,7 +240,7 @@ func loadEnvConfig(ctx Context, config *configImpl) error {
|
||||
}
|
||||
|
||||
func defaultBazelProdMode(cfg *configImpl) bool {
|
||||
// Envirnoment flag to disable Bazel for users which experience
|
||||
// Environment flag to disable Bazel for users which experience
|
||||
// broken bazel-handled builds, or significant performance regressions.
|
||||
if cfg.IsBazelMixedBuildForceDisabled() {
|
||||
return false
|
||||
@@ -747,6 +749,8 @@ func (c *configImpl) parseArgs(ctx Context, args []string) {
|
||||
buildCmd = strings.TrimPrefix(buildCmd, "\"")
|
||||
buildCmd = strings.TrimSuffix(buildCmd, "\"")
|
||||
ctx.Metrics.SetBuildCommand([]string{buildCmd})
|
||||
} else if strings.HasPrefix(arg, "--bazel-force-enabled-modules=") {
|
||||
c.bazelForceEnabledModules = strings.TrimPrefix(arg, "--bazel-force-enabled-modules=")
|
||||
} else if len(arg) > 0 && arg[0] == '-' {
|
||||
parseArgNum := func(def int) int {
|
||||
if len(arg) > 2 {
|
||||
@@ -1494,6 +1498,10 @@ func (c *configImpl) IsBazelMixedBuildForceDisabled() bool {
|
||||
return c.Environment().IsEnvTrue("BUILD_BROKEN_DISABLE_BAZEL")
|
||||
}
|
||||
|
||||
func (c *configImpl) BazelModulesForceEnabledByFlag() string {
|
||||
return c.bazelForceEnabledModules
|
||||
}
|
||||
|
||||
func GetMetricsUploader(topDir string, env *Environment) string {
|
||||
if p, ok := env.Get("METRICS_UPLOADER"); ok {
|
||||
metricsUploader := filepath.Join(topDir, p)
|
||||
|
@@ -273,6 +273,10 @@ func bootstrapBlueprint(ctx Context, config Config) {
|
||||
if config.bazelStagingMode {
|
||||
mainSoongBuildExtraArgs = append(mainSoongBuildExtraArgs, "--bazel-mode-staging")
|
||||
}
|
||||
if len(config.bazelForceEnabledModules) > 0 {
|
||||
mainSoongBuildExtraArgs = append(mainSoongBuildExtraArgs, "--bazel-force-enabled-modules="+config.bazelForceEnabledModules)
|
||||
}
|
||||
|
||||
queryviewDir := filepath.Join(config.SoongOutDir(), "queryview")
|
||||
// The BUILD files will be generated in out/soong/.api_bp2build (no symlinks to src files)
|
||||
// The final workspace will be generated in out/soong/api_bp2build
|
||||
|
Reference in New Issue
Block a user