From 76e7de4df5b74f1a1b9bf84b1d0384ae360dad32 Mon Sep 17 00:00:00 2001 From: Mathew Robinson Date: Tue, 3 Mar 2020 09:42:43 -0500 Subject: SERVER-46129 Fix various DAG inconsistencies Some dependencies were getting wired when they should not or were false dependencies. (cherry picked from commit 727fe1181cc8ff8d3c6282662229d28651a927d9) --- SConstruct | 14 +++++++------- site_scons/site_tools/ninja_next.py | 17 ++++++++++++++--- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/SConstruct b/SConstruct index 580fd37f93d..c207d5c4602 100644 --- a/SConstruct +++ b/SConstruct @@ -3879,6 +3879,7 @@ if get_option('ninja') != 'disabled': else: ninja_builder = Tool("ninja_next") ninja_builder.generate(env) + env.Default(env.Alias("install-all-meta")) # idlc.py has the ability to print it's implicit dependencies # while generating, Ninja can consume these prints using the @@ -4242,10 +4243,8 @@ else: target="#lint-eslint", source=[ "buildscripts/eslint.py", - "jstests/", - "src/mongo/", ], - action="$PYTHON ${SOURCES[0]} --dirmode lint ${SOURCES[1:]}", + action="$PYTHON ${SOURCES[0]} --dirmode lint jstests/ src/mongo", ) lint_py = env.Command( @@ -4531,12 +4530,13 @@ env.SConscript( ) -allTargets = ['core', 'tools', 'unittests', 'integration_tests', 'libfuzzer_tests', 'benchmarks'] +if get_option("install-mode") != "hygienic": + allTargets = ['core', 'tools', 'unittests', 'integration_tests', 'libfuzzer_tests', 'benchmarks'] -if not has_option('noshell') and usemozjs: - allTargets.extend(['dbtest']) + if not has_option('noshell') and usemozjs: + allTargets.extend(['dbtest']) -env.Alias('all', allTargets) + env.Alias('all', allTargets) # run the Dagger tool if it's installed if should_dagger: diff --git a/site_scons/site_tools/ninja_next.py b/site_scons/site_tools/ninja_next.py index 89cae89d8ef..fe437b8738f 100644 --- a/site_scons/site_tools/ninja_next.py +++ b/site_scons/site_tools/ninja_next.py @@ -61,7 +61,11 @@ def _mkdir_action_function(env, node): return { "outputs": get_outputs(node), "rule": "CMD", - "implicit": get_dependencies(node), + # implicit explicitly omitted, we translate these so they can be + # used by anything that depends on these but commonly this is + # hit with a node that will depend on all of the fake + # srcnode's that SCons will never give us a rule for leading + # to an invalid ninja file. "variables": { # On Windows mkdir "-p" is always on "cmd": "{mkdir} $out".format( @@ -101,7 +105,13 @@ def is_valid_dependent_node(node): check because some nodes (like src files) won't have builders but are valid implicit dependencies. """ - return not isinstance(node, SCons.Node.Alias.Alias) or node.children() + if isinstance(node, SCons.Node.Alias.Alias): + return node.children() + + if not node.env: + return True + + return not node.env.get("NINJA_SKIP") def alias_to_ninja_build(node): @@ -110,7 +120,7 @@ def alias_to_ninja_build(node): "outputs": get_outputs(node), "rule": "phony", "implicit": [ - get_path(n) for n in node.children() if is_valid_dependent_node(n) + get_path(src_file(n)) for n in node.children() if is_valid_dependent_node(n) ], } @@ -506,6 +516,7 @@ class NinjaState: return False self.builds.append(build) + self.built.update(build["outputs"]) return True def is_generated_source(self, output): -- cgit v1.2.1