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