summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathew Robinson <chasinglogic@gmail.com>2020-01-24 13:32:15 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-01-25 03:21:36 +0000
commit38aee4fa7d5559ff143577f2427174f08c3c612e (patch)
tree1425c619c1f336071b1c5dba2b32226565ebafe5
parentb569f3769de0d771dc29adaa4a3d0f79010eddc7 (diff)
downloadmongo-38aee4fa7d5559ff143577f2427174f08c3c612e.tar.gz
SERVER-45727 Do not discard outputs
-rw-r--r--site_scons/site_tools/ninja.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/site_scons/site_tools/ninja.py b/site_scons/site_tools/ninja.py
index 6614b0d1ed7..a428e81fad2 100644
--- a/site_scons/site_tools/ninja.py
+++ b/site_scons/site_tools/ninja.py
@@ -612,7 +612,24 @@ class NinjaState:
# listed in self.rules so verify that we got a result
# before trying to check if it has a deps key.
if rule is not None and rule.get("deps"):
- build["outputs"] = build["outputs"][0:1]
+
+ # Anything using deps in Ninja can only have a single
+ # output, but we may have a build which actually
+ # produces multiple outputs which other targets can
+ # depend on. Here we slice up the outputs so we have a
+ # single output which we will use for the "real"
+ # builder and multiple phony targets that match the
+ # file names of the remaining outputs. This way any
+ # build can depend on any output from any build.
+ first_output, remaining_outputs = build["outputs"][0], build["outputs"][1:]
+ if remaining_outputs:
+ ninja.build(
+ outputs=remaining_outputs,
+ rule="phony",
+ implicit=first_output,
+ )
+
+ build["outputs"] = first_output
ninja.build(**build)