Enforce that output files are created in primary ninja execution
Missing output files in ninja execution will be treated as errors.
Products can bypass this using the newly introduced
BUILD_BROKEN_MISSING_OUTPUTS flag.
Test: m nothing # verified missingoutfile appears in out/soong.log
Test: checkbuild passes on presubmits
Change-Id: I4eebcd08aa57fc6ccf1688c32e0d1fe06d66ab9a
diff --git a/ui/build/ninja.go b/ui/build/ninja.go
index 551b8ab..ae27330 100644
--- a/ui/build/ninja.go
+++ b/ui/build/ninja.go
@@ -77,6 +77,14 @@
"-w", "dupbuild=err",
"-w", "missingdepfile=err")
+ if !config.BuildBrokenMissingOutputs() {
+ // Missing outputs will be treated as errors.
+ // BUILD_BROKEN_MISSING_OUTPUTS can be used to bypass this check.
+ args = append(args,
+ "-w", "missingoutfile=err",
+ )
+ }
+
cmd := Command(ctx, config, "ninja", executable, args...)
// Set up the nsjail sandbox Ninja runs in.