aboutsummaryrefslogtreecommitdiff
path: root/ui/build/soong.go
diff options
context:
space:
mode:
Diffstat (limited to 'ui/build/soong.go')
-rw-r--r--ui/build/soong.go153
1 files changed, 85 insertions, 68 deletions
diff --git a/ui/build/soong.go b/ui/build/soong.go
index 58334a907..f483b291e 100644
--- a/ui/build/soong.go
+++ b/ui/build/soong.go
@@ -137,6 +137,10 @@ func (c BlueprintConfig) PrimaryBuilderInvocations() []bootstrap.PrimaryBuilderI
return c.primaryBuilderInvocations
}
+func (c BlueprintConfig) IsBootstrap() bool {
+ return true
+}
+
func environmentArgs(config Config, tag string) []string {
return []string{
"--available_env", shared.JoinPath(config.SoongOutDir(), availableEnvFile),
@@ -212,6 +216,11 @@ func (pb PrimaryBuilderFactory) primaryBuilderInvocation(config Config) bootstra
commonArgs = append(commonArgs, pb.config.moduleDebugFile)
}
+ if pb.config.incrementalDebugFile != "" {
+ commonArgs = append(commonArgs, "--incremental-debug-file")
+ commonArgs = append(commonArgs, pb.config.incrementalDebugFile)
+ }
+
commonArgs = append(commonArgs, "-l", filepath.Join(pb.config.FileListDir(), "Android.bp.list"))
invocationEnv := make(map[string]string)
if pb.debugPort != "" {
@@ -554,7 +563,7 @@ func migrateOutputSymlinks(ctx Context, config Config) error {
return fixOutDirSymlinks(ctx, config, outDir)
}
-func runSoong(ctx Context, config Config) {
+func runSoong(ctx Context, config Config, enforceNoSoongOutput bool) {
ctx.BeginTrace(metrics.RunSoong, "soong")
defer ctx.EndTrace()
@@ -575,6 +584,9 @@ func runSoong(ctx Context, config Config) {
soongBuildEnv.Set("TOP", os.Getenv("TOP"))
soongBuildEnv.Set("LOG_DIR", config.LogsDir())
+ // Never pass SOONG_HONOR_USE_PARTIAL_COMPILE to Soong.
+ soongBuildEnv.Unset("SOONG_HONOR_USE_PARTIAL_COMPILE")
+
// For Soong bootstrapping tests
if os.Getenv("ALLOW_MISSING_DEPENDENCIES") == "true" {
soongBuildEnv.Set("ALLOW_MISSING_DEPENDENCIES", "true")
@@ -606,81 +618,86 @@ func runSoong(ctx Context, config Config) {
fifo := filepath.Join(config.OutDir(), ".ninja_fifo")
nr := status.NewNinjaReader(ctx, ctx.Status.StartTool(), fifo)
- defer nr.Close()
-
- var ninjaCmd string
- var ninjaArgs []string
- switch config.ninjaCommand {
- case NINJA_N2:
- ninjaCmd = config.N2Bin()
- ninjaArgs = []string{
- // TODO: implement these features, or remove them.
- //"-d", "keepdepfile",
- //"-d", "stats",
- //"-o", "usesphonyoutputs=yes",
- //"-o", "preremoveoutputs=yes",
- //"-w", "dupbuild=err",
- //"-w", "outputdir=err",
- //"-w", "missingoutfile=err",
- "-v",
- "-j", strconv.Itoa(config.Parallel()),
- "--frontend-file", fifo,
- "-f", filepath.Join(config.SoongOutDir(), "bootstrap.ninja"),
- }
- case NINJA_SISO:
- ninjaCmd = config.SisoBin()
- ninjaArgs = []string{
- "ninja",
- // TODO: implement these features, or remove them.
- //"-d", "keepdepfile",
- //"-d", "stats",
- //"-o", "usesphonyoutputs=yes",
- //"-o", "preremoveoutputs=yes",
- //"-w", "dupbuild=err",
- //"-w", "outputdir=err",
- //"-w", "missingoutfile=err",
- "-v",
- "-j", strconv.Itoa(config.Parallel()),
- //"--frontend-file", fifo,
- "--log_dir", config.SoongOutDir(),
- "-f", filepath.Join(config.SoongOutDir(), "bootstrap.ninja"),
+ func() {
+ defer nr.Close()
+ var ninjaCmd string
+ var ninjaArgs []string
+ switch config.ninjaCommand {
+ case NINJA_N2:
+ ninjaCmd = config.N2Bin()
+ ninjaArgs = []string{
+ // TODO: implement these features, or remove them.
+ //"-d", "keepdepfile",
+ //"-d", "stats",
+ //"-o", "usesphonyoutputs=yes",
+ //"-o", "preremoveoutputs=yes",
+ //"-w", "dupbuild=err",
+ //"-w", "outputdir=err",
+ //"-w", "missingoutfile=err",
+ "-v",
+ "-j", strconv.Itoa(config.Parallel()),
+ "--frontend-file", fifo,
+ "-f", filepath.Join(config.SoongOutDir(), "bootstrap.ninja"),
+ }
+ case NINJA_SISO:
+ ninjaCmd = config.SisoBin()
+ ninjaArgs = []string{
+ "ninja",
+ // TODO: implement these features, or remove them.
+ //"-d", "keepdepfile",
+ //"-d", "stats",
+ //"-o", "usesphonyoutputs=yes",
+ //"-o", "preremoveoutputs=yes",
+ //"-w", "dupbuild=err",
+ //"-w", "outputdir=err",
+ //"-w", "missingoutfile=err",
+ "-v",
+ "-j", strconv.Itoa(config.Parallel()),
+ //"--frontend-file", fifo,
+ "--log_dir", config.SoongOutDir(),
+ "-f", filepath.Join(config.SoongOutDir(), "bootstrap.ninja"),
+ }
+ default:
+ // NINJA_NINJA is the default.
+ ninjaCmd = config.NinjaBin()
+ ninjaArgs = []string{
+ "-d", "keepdepfile",
+ "-d", "stats",
+ "-o", "usesphonyoutputs=yes",
+ "-o", "preremoveoutputs=yes",
+ "-w", "dupbuild=err",
+ "-w", "outputdir=err",
+ "-w", "missingoutfile=err",
+ "-j", strconv.Itoa(config.Parallel()),
+ "--frontend_file", fifo,
+ "-f", filepath.Join(config.SoongOutDir(), "bootstrap.ninja"),
+ }
}
- default:
- // NINJA_NINJA is the default.
- ninjaCmd = config.NinjaBin()
- ninjaArgs = []string{
- "-d", "keepdepfile",
- "-d", "stats",
- "-o", "usesphonyoutputs=yes",
- "-o", "preremoveoutputs=yes",
- "-w", "dupbuild=err",
- "-w", "outputdir=err",
- "-w", "missingoutfile=err",
- "-j", strconv.Itoa(config.Parallel()),
- "--frontend_file", fifo,
- "-f", filepath.Join(config.SoongOutDir(), "bootstrap.ninja"),
+
+ if extra, ok := config.Environment().Get("SOONG_UI_NINJA_ARGS"); ok {
+ ctx.Printf(`CAUTION: arguments in $SOONG_UI_NINJA_ARGS=%q, e.g. "-n", can make soong_build FAIL or INCORRECT`, extra)
+ ninjaArgs = append(ninjaArgs, strings.Fields(extra)...)
}
- }
- if extra, ok := config.Environment().Get("SOONG_UI_NINJA_ARGS"); ok {
- ctx.Printf(`CAUTION: arguments in $SOONG_UI_NINJA_ARGS=%q, e.g. "-n", can make soong_build FAIL or INCORRECT`, extra)
- ninjaArgs = append(ninjaArgs, strings.Fields(extra)...)
- }
+ ninjaArgs = append(ninjaArgs, targets...)
- ninjaArgs = append(ninjaArgs, targets...)
+ cmd := Command(ctx, config, "soong bootstrap",
+ ninjaCmd, ninjaArgs...)
- cmd := Command(ctx, config, "soong bootstrap",
- ninjaCmd, ninjaArgs...)
+ var ninjaEnv Environment
- var ninjaEnv Environment
+ // This is currently how the command line to invoke soong_build finds the
+ // root of the source tree and the output root
+ ninjaEnv.Set("TOP", os.Getenv("TOP"))
- // This is currently how the command line to invoke soong_build finds the
- // root of the source tree and the output root
- ninjaEnv.Set("TOP", os.Getenv("TOP"))
+ cmd.Environment = &ninjaEnv
+ cmd.Sandbox = soongSandbox
+ cmd.RunAndStreamOrFatal()
+ }()
- cmd.Environment = &ninjaEnv
- cmd.Sandbox = soongSandbox
- cmd.RunAndStreamOrFatal()
+ if enforceNoSoongOutput && nr.HasAnyOutput() {
+ ctx.Fatalf("Soong must not output anything to stdout/stderr on a successful build, please remove the prints")
+ }
}
targets := make([]string, 0, 0)