summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Moody <daniel.moody@mongodb.com>2022-03-17 10:37:08 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-04-13 18:23:00 +0000
commite7b7713e9757cf07c20125c78d948663c10c6985 (patch)
tree1a474d785edd523942368c8fe5cd0bd68cc7cbb3
parent1114c6f99f229c6ff7d79d19f8b7b0cede65e349 (diff)
downloadmongo-e7b7713e9757cf07c20125c78d948663c10c6985.tar.gz
SERVER-56003 use separate run icecc scripts for multiple ninja file builds.
(cherry picked from commit fc2b624564c1ec4f7d27c98e5a0074920e7ee5a1)
-rw-r--r--SConstruct11
-rw-r--r--site_scons/site_tools/icecream.py4
2 files changed, 13 insertions, 2 deletions
diff --git a/SConstruct b/SConstruct
index 6ca61d5de44..088c4e61b0e 100644
--- a/SConstruct
+++ b/SConstruct
@@ -3990,6 +3990,17 @@ if 'CCACHE' in env and env['CCACHE']:
if 'ICECC' in env and env['ICECC']:
env['ICECREAM_VERBOSE'] = env.Verbose()
env['ICECREAM_TARGET_DIR'] = '$BUILD_ROOT/scons/icecream'
+
+ # Posssibly multiple ninja files are in play, and there are cases where ninja will
+ # use the wrong icecc run script, so we must create a unique script per ninja variant
+ # for ninja to track separately. We will use the variant dir which contains the each
+ # separate ninja builds meta files. This has to be under an additional flag then just
+ # ninja disabled, because the run icecc script is generated under a context where ninja
+ # is always disabled via the scons callback mechanism. The __NINJA_NO flag is intended
+ # to differentiate this particular context.
+ if env.get('__NINJA_NO') or get_option('ninja') != 'disabled':
+ env['ICECREAM_RUN_SCRIPT_SUBPATH'] = '$VARIANT_DIR'
+
icecream = Tool('icecream')
if not icecream.exists(env):
env.FatalError(f"Failed to load icecream tool with ICECC={env['ICECC']}")
diff --git a/site_scons/site_tools/icecream.py b/site_scons/site_tools/icecream.py
index e1a6b6c89fd..f9e436eb69c 100644
--- a/site_scons/site_tools/icecream.py
+++ b/site_scons/site_tools/icecream.py
@@ -58,7 +58,7 @@ def icecc_create_env(env, target, source, for_signature):
# store it in a known location. Add any files requested from the user environment.
create_env = "ICECC_VERSION_TMP=$$(${SOURCES[0]} --$ICECC_COMPILER_TYPE ${SOURCES[1]} ${SOURCES[2]}"
- # TODO: It would be a little more elegant if things in
+ # TODO: SERVER-57393 It would be a little more elegant if things in
# ICECC_CREATE_ENV_ADDFILES were handled as sources, because we
# would get automatic dependency tracking. However, there are some
# wrinkles around the mapped case so we have opted to leave it as
@@ -328,7 +328,7 @@ def generate(env):
# of such a node easily. Creating a Substfile means that SCons
# will take care of generating a file that Ninja can use.
run_icecc = setupEnv.Textfile(
- target="$ICECREAM_TARGET_DIR/run-icecc.sh",
+ target="$ICECREAM_TARGET_DIR/$ICECREAM_RUN_SCRIPT_SUBPATH/run-icecc.sh",
source=[
'#!/bin/sh',
'ICECC_VERSION=@icecc_version_arch@@icecc_version@ exec @icecc@ "$@"',