summaryrefslogtreecommitdiff
path: root/site_scons
diff options
context:
space:
mode:
authorDaniel Moody <daniel.moody@mongodb.com>2020-11-06 16:21:22 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-11-20 05:12:30 +0000
commitf4902aa0d320cfe1cc1d15d4e4623e4d24e32f39 (patch)
tree093d0d302e0fe8e2faa510955ee476b254b058f2 /site_scons
parenta64e0ac24cb6ce95c44350cce8b8cfc82f069cf9 (diff)
downloadmongo-f4902aa0d320cfe1cc1d15d4e4623e4d24e32f39.tar.gz
SERVER-48691 added workaround for ninja response files line to long
Diffstat (limited to 'site_scons')
-rw-r--r--site_scons/site_tools/next/ninja.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/site_scons/site_tools/next/ninja.py b/site_scons/site_tools/next/ninja.py
index 46a80d3369a..dd87ff17d40 100644
--- a/site_scons/site_tools/next/ninja.py
+++ b/site_scons/site_tools/next/ninja.py
@@ -275,6 +275,7 @@ class SConsToNinjaTranslator:
return None
build = {}
+ env = node.env if node.env else self.env
# Ideally this should never happen, and we do try to filter
# Ninja builders out of being sources of ninja builders but I
@@ -286,18 +287,23 @@ class SConsToNinjaTranslator:
build = self.handle_func_action(node, action)
elif isinstance(action, SCons.Action.LazyAction):
# pylint: disable=protected-access
- action = action._generate_cache(node.env if node.env else self.env)
+ action = action._generate_cache(env)
build = self.action_to_ninja_build(node, action=action)
elif isinstance(action, SCons.Action.ListAction):
build = self.handle_list_action(node, action)
elif isinstance(action, COMMAND_TYPES):
- build = get_command(node.env if node.env else self.env, node, action)
+ build = get_command(env, node, action)
else:
raise Exception("Got an unbuildable ListAction for: {}".format(str(node)))
if build is not None:
build["order_only"] = get_order_only(node)
+ if 'conftest' not in str(node):
+ node_callback = getattr(node.attributes, "ninja_build_callback", None)
+ if callable(node_callback):
+ node_callback(env, node, build)
+
return build
def handle_func_action(self, node, action):
@@ -1190,7 +1196,7 @@ def register_custom_rule_mapping(env, pre_subst_string, rule):
__NINJA_RULE_MAPPING[pre_subst_string] = rule
-def register_custom_rule(env, rule, command, description="", deps=None, pool=None, use_depfile=False, use_response_file=False):
+def register_custom_rule(env, rule, command, description="", deps=None, pool=None, use_depfile=False, use_response_file=False, response_file_content="$rspc"):
"""Allows specification of Ninja rules from inside SCons files."""
rule_obj = {
"command": command,
@@ -1208,7 +1214,7 @@ def register_custom_rule(env, rule, command, description="", deps=None, pool=Non
if use_response_file:
rule_obj["rspfile"] = "$out.rsp"
- rule_obj["rspfile_content"] = "$rspc"
+ rule_obj["rspfile_content"] = response_file_content
env[NINJA_RULES][rule] = rule_obj
@@ -1217,6 +1223,9 @@ def register_custom_pool(env, pool, size):
"""Allows the creation of custom Ninja pools"""
env[NINJA_POOLS][pool] = size
+def set_build_node_callback(env, node, callback):
+ if 'conftest' not in str(node):
+ setattr(node.attributes, "ninja_build_callback", callback)
def ninja_csig(original):
"""Return a dummy csig"""
@@ -1398,7 +1407,9 @@ def generate(env):
# Provide a way for custom rule authors to easily access command
# generation.
env.AddMethod(get_generic_shell_command, "NinjaGetGenericShellCommand")
+ env.AddMethod(get_command, "NinjaGetCommand")
env.AddMethod(gen_get_response_file_command, "NinjaGenResponseFileProvider")
+ env.AddMethod(set_build_node_callback, "NinjaSetBuildNodeCallback")
# Provides a way for users to handle custom FunctionActions they
# want to translate to Ninja.