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:50:07 +0000
commitfe670ef960a85d5fa01a58401529447d31dcd279 (patch)
treed111b3d5141a1698db42315f681ab516fd91425d
parent6f431d930572323ccb919c824e3ed007d5b27391 (diff)
downloadmongo-fe670ef960a85d5fa01a58401529447d31dcd279.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 150ae43b4b5..70923c5bdcc 100644
--- a/SConstruct
+++ b/SConstruct
@@ -4541,6 +4541,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 4dadefe32ba..c5781a5af70 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@ "$@"',