Merge "Add --multitree-build flag"
This commit is contained in:
@@ -83,6 +83,8 @@ type CmdArgs struct {
|
||||
ModuleActionsFile string
|
||||
DocFile string
|
||||
|
||||
MultitreeBuild bool
|
||||
|
||||
BazelMode bool
|
||||
BazelModeDev bool
|
||||
BazelModeStaging bool
|
||||
@@ -229,6 +231,10 @@ type config struct {
|
||||
Bp2buildPackageConfig Bp2BuildConversionAllowlist
|
||||
Bp2buildSoongConfigDefinitions soongconfig.Bp2BuildSoongConfigDefinitions
|
||||
|
||||
// If MultitreeBuild is true then this is one inner tree of a multitree
|
||||
// build directed by the multitree orchestrator.
|
||||
MultitreeBuild bool
|
||||
|
||||
// If testAllowNonExistentPaths is true then PathForSource and PathForModuleSrc won't error
|
||||
// in tests when a path doesn't exist.
|
||||
TestAllowNonExistentPaths bool
|
||||
@@ -449,7 +455,8 @@ func NewConfig(cmdArgs CmdArgs, availableEnv map[string]string) (Config, error)
|
||||
mixedBuildEnabledModules: make(map[string]struct{}),
|
||||
bazelForceEnabledModules: make(map[string]struct{}),
|
||||
|
||||
UseBazelProxy: cmdArgs.UseBazelProxy,
|
||||
MultitreeBuild: cmdArgs.MultitreeBuild,
|
||||
UseBazelProxy: cmdArgs.UseBazelProxy,
|
||||
}
|
||||
|
||||
config.deviceConfig = &deviceConfig{
|
||||
|
@@ -78,6 +78,7 @@ func init() {
|
||||
flag.StringVar(&cmdlineArgs.OutFile, "o", "build.ninja", "the Ninja file to output")
|
||||
flag.StringVar(&cmdlineArgs.BazelForceEnabledModules, "bazel-force-enabled-modules", "", "additional modules to build with Bazel. Comma-delimited")
|
||||
flag.BoolVar(&cmdlineArgs.EmptyNinjaFile, "empty-ninja-file", false, "write out a 0-byte ninja file")
|
||||
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)")
|
||||
|
@@ -78,6 +78,7 @@ type configImpl struct {
|
||||
queryview bool
|
||||
reportMkMetrics bool // Collect and report mk2bp migration progress metrics.
|
||||
soongDocs bool
|
||||
multitreeBuild bool // This is a multitree build.
|
||||
skipConfig bool
|
||||
skipKati bool
|
||||
skipKatiNinja bool
|
||||
@@ -475,6 +476,10 @@ func NewConfig(ctx Context, args ...string) Config {
|
||||
ret.environ.Set("ANDROID_JAVA11_HOME", java11Home)
|
||||
ret.environ.Set("PATH", strings.Join(newPath, string(filepath.ListSeparator)))
|
||||
|
||||
if ret.MultitreeBuild() {
|
||||
ret.environ.Set("MULTITREE_BUILD", "true")
|
||||
}
|
||||
|
||||
outDir := ret.OutDir()
|
||||
buildDateTimeFile := filepath.Join(outDir, "build_date.txt")
|
||||
if buildDateTime, ok := ret.environ.Get("BUILD_DATETIME"); ok && buildDateTime != "" {
|
||||
@@ -782,6 +787,8 @@ func (c *configImpl) parseArgs(ctx Context, args []string) {
|
||||
c.skipMetricsUpload = true
|
||||
} else if arg == "--mk-metrics" {
|
||||
c.reportMkMetrics = true
|
||||
} else if arg == "--multitree-build" {
|
||||
c.multitreeBuild = true
|
||||
} else if arg == "--bazel-mode" {
|
||||
c.bazelProdMode = true
|
||||
} else if arg == "--bazel-mode-dev" {
|
||||
@@ -1080,6 +1087,10 @@ func (c *configImpl) IsVerbose() bool {
|
||||
return c.verbose
|
||||
}
|
||||
|
||||
func (c *configImpl) MultitreeBuild() bool {
|
||||
return c.multitreeBuild
|
||||
}
|
||||
|
||||
func (c *configImpl) SkipKati() bool {
|
||||
return c.skipKati
|
||||
}
|
||||
|
@@ -902,6 +902,15 @@ func TestGetConfigArgsBuildModulesInDirectory(t *testing.T) {
|
||||
curDir: ".",
|
||||
tidyOnly: "",
|
||||
expectedArgs: []string{},
|
||||
}, {
|
||||
description: "multitree build action executed at root directory",
|
||||
dirsInTrees: []string{},
|
||||
buildFiles: []string{},
|
||||
rootSymlink: false,
|
||||
args: []string{"--multitree-build"},
|
||||
curDir: ".",
|
||||
tidyOnly: "",
|
||||
expectedArgs: []string{"--multitree-build"},
|
||||
}, {
|
||||
description: "build action executed at root directory in symlink",
|
||||
dirsInTrees: []string{},
|
||||
|
@@ -168,6 +168,10 @@ func (pb PrimaryBuilderFactory) primaryBuilderInvocation() bootstrap.PrimaryBuil
|
||||
commonArgs = append(commonArgs, "-t")
|
||||
}
|
||||
|
||||
if !pb.config.multitreeBuild {
|
||||
commonArgs = append(commonArgs, "--multitree-build")
|
||||
}
|
||||
|
||||
commonArgs = append(commonArgs, "-l", filepath.Join(pb.config.FileListDir(), "Android.bp.list"))
|
||||
invocationEnv := make(map[string]string)
|
||||
if pb.debugPort != "" {
|
||||
@@ -275,6 +279,9 @@ func bootstrapBlueprint(ctx Context, config Config) {
|
||||
if len(config.bazelForceEnabledModules) > 0 {
|
||||
mainSoongBuildExtraArgs = append(mainSoongBuildExtraArgs, "--bazel-force-enabled-modules="+config.bazelForceEnabledModules)
|
||||
}
|
||||
if config.MultitreeBuild() {
|
||||
mainSoongBuildExtraArgs = append(mainSoongBuildExtraArgs, "--multitree-build")
|
||||
}
|
||||
|
||||
queryviewDir := filepath.Join(config.SoongOutDir(), "queryview")
|
||||
// The BUILD files will be generated in out/soong/.api_bp2build (no symlinks to src files)
|
||||
|
Reference in New Issue
Block a user