summaryrefslogtreecommitdiff
path: root/SConstruct
diff options
context:
space:
mode:
authorRyan Egesdahl <ryan.egesdahl@mongodb.com>2020-10-05 10:23:55 -0700
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-10-13 06:06:23 +0000
commite7f6696a96db5438a269c5e67a06ff9e05cb897a (patch)
treee15e8f588b8124c15df7305f3b44e80943d770f9 /SConstruct
parent20f26290c6e6d58a8ae40a1484f1eb9f2fa1dc83 (diff)
downloadmongo-e7f6696a96db5438a269c5e67a06ff9e05cb897a.tar.gz
SERVER-50363 Merge --build-tools=next into stable
Merging the following fixes into the stable version of the build tools and migrate fully from --ninja=next to the --build-tools=next: * SERVER-47598 * SERVER-50010 * SERVER-47943 * SERVER-50125 * SERVER-50376 * SERVER-49457 * SERVER-49493 * SERVER-49036 * SERVER-48966 (cherry picked from commit 78bb3f3c8a658a5a9fec8d55864e426382f68bd0)
Diffstat (limited to 'SConstruct')
-rw-r--r--SConstruct122
1 files changed, 48 insertions, 74 deletions
diff --git a/SConstruct b/SConstruct
index eb924a4c580..42ae796b64e 100644
--- a/SConstruct
+++ b/SConstruct
@@ -106,10 +106,10 @@ SetOption('random', 1)
#
add_option('ninja',
- choices=['stable', 'next', 'disabled'],
+ choices=['enabled', 'disabled'],
default='disabled',
nargs='?',
- const='stable',
+ const='enabled',
type='choice',
help='Enable the build.ninja generator tool stable or canary version',
)
@@ -1129,7 +1129,7 @@ if get_option('install-mode') != 'hygienic':
# user has opted into the next gen tools, add our experimental tool
# directory into the default toolpath, ahead of whatever is already in
# there so it overrides it.
-if get_option('build-tools') == 'next' or get_option('ninja') == 'next':
+if get_option('build-tools') == 'next':
SCons.Tool.DefaultToolpath.insert(0, os.path.abspath('site_scons/site_tools/next'))
env = Environment(variables=env_vars, **envDict)
@@ -2843,31 +2843,19 @@ def doConfigure(myenv):
sanitizer_list = get_option('sanitize').split(',')
+ using_asan = 'address' in sanitizer_list
+ using_fsan = 'fuzzer' in sanitizer_list
using_lsan = 'leak' in sanitizer_list
- using_asan = 'address' in sanitizer_list or using_lsan
using_tsan = 'thread' in sanitizer_list
using_ubsan = 'undefined' in sanitizer_list
- using_fsan = 'fuzzer' in sanitizer_list
- if env['MONGO_ALLOCATOR'] in ['tcmalloc', 'tcmalloc-experimental'] and (using_lsan or using_asan):
+ if using_lsan:
+ env.FatalError("Please use --sanitize=address instead of --sanitize=leak")
+
+ if using_asan and env['MONGO_ALLOCATOR'] in ['tcmalloc', 'tcmalloc-experimental']:
# There are multiply defined symbols between the sanitizer and
# our vendorized tcmalloc.
- env.FatalError("Cannot use --sanitize=leak or --sanitize=address with tcmalloc")
-
- # If the user asked for leak sanitizer, turn on the detect_leaks
- # ASAN_OPTION. If they asked for address sanitizer as well, drop
- # 'leak', because -fsanitize=leak means no address.
- #
- # --sanitize=leak: -fsanitize=leak, detect_leaks=1
- # --sanitize=address,leak: -fsanitize=address, detect_leaks=1
- # --sanitize=address: -fsanitize=address
- #
- if using_lsan:
- if using_asan:
- myenv['ENV']['ASAN_OPTIONS'] = "detect_leaks=1"
- myenv['ENV']['LSAN_OPTIONS'] = "suppressions=%s" % myenv.File("#etc/lsan.suppressions").abspath
- if 'address' in sanitizer_list:
- sanitizer_list.remove('leak')
+ env.FatalError("Cannot use --sanitize=address with tcmalloc")
if using_fsan:
def CheckForFuzzerCompilerSupport(context):
@@ -2931,7 +2919,6 @@ def doConfigure(myenv):
blackfiles_map = {
"address" : myenv.File("#etc/asan.blacklist"),
- "leak" : myenv.File("#etc/asan.blacklist"),
"thread" : myenv.File("#etc/tsan.blacklist"),
"undefined" : myenv.File("#etc/ubsan.blacklist"),
}
@@ -3935,22 +3922,18 @@ elif env.ToolchainIs("gcc"):
# Now that we are done with configure checks, enable ccache and
# icecream if requested.
-if get_option('build-tools') == 'next' or get_option('ninja') == 'next':
- if 'CCACHE' in env and env['CCACHE']:
- ccache = Tool('ccache')
- if not ccache.exists(env):
- env.FatalError(f"Failed to load ccache tool with CCACHE={env['CCACHE']}")
- ccache(env)
- if 'ICECC' in env and env['ICECC']:
- env['ICECREAM_VERBOSE'] = env.Verbose()
- env['ICECREAM_TARGET_DIR'] = '$BUILD_ROOT/scons/icecream'
- icecream = Tool('icecream')
- if not icecream.exists(env):
- env.FatalError(f"Failed to load icecream tool with ICECC={env['ICECC']}")
- icecream(env)
-else:
- env.Tool('ccache')
- env.Tool('icecream')
+if 'CCACHE' in env and env['CCACHE']:
+ ccache = Tool('ccache')
+ if not ccache.exists(env):
+ env.FatalError(f"Failed to load ccache tool with CCACHE={env['CCACHE']}")
+ ccache(env)
+if 'ICECC' in env and env['ICECC']:
+ env['ICECREAM_VERBOSE'] = env.Verbose()
+ env['ICECREAM_TARGET_DIR'] = '$BUILD_ROOT/scons/icecream'
+ icecream = Tool('icecream')
+ if not icecream.exists(env):
+ env.FatalError(f"Failed to load icecream tool with ICECC={env['ICECC']}")
+ icecream(env)
# Defaults for SCons provided flags. SetOption only sets the option to our value
# if the user did not provide it. So for any flag here if it's explicitly passed
@@ -4005,34 +3988,31 @@ if get_option('ninja') != 'disabled':
env.FatalError("Use of ccache is mandatory with --ninja and icecream older than 1.2. You are running {}.".format(env['ICECREAM_VERSION']))
ninja_builder = Tool("ninja")
- if get_option('build-tools') == 'next' or get_option('ninja') == 'next':
- env["NINJA_BUILDDIR"] = env.Dir("$BUILD_DIR/ninja")
- ninja_builder.generate(env)
+ env["NINJA_BUILDDIR"] = env.Dir("$BUILD_DIR/ninja")
+ ninja_builder.generate(env)
- ninjaConf = Configure(env, help=False, custom_tests = {
- 'CheckNinjaCompdbExpand': env.CheckNinjaCompdbExpand,
- })
- env['NINJA_COMPDB_EXPAND'] = ninjaConf.CheckNinjaCompdbExpand()
- ninjaConf.Finish()
-
- # TODO: API for getting the sconscripts programmatically
- # exists upstream: https://github.com/SCons/scons/issues/3625
- def ninja_generate_deps(env, target, source, for_signature):
- dependencies = env.Flatten([
- 'SConstruct',
- glob(os.path.join('src', '**', 'SConscript'), recursive=True),
- glob(os.path.join(os.path.expanduser('~/.scons/'), '**', '*.py'), recursive=True),
- glob(os.path.join('site_scons', '**', '*.py'), recursive=True),
- glob(os.path.join('buildscripts', '**', '*.py'), recursive=True),
- glob(os.path.join('src/third_party/scons-*', '**', '*.py'), recursive=True),
- glob(os.path.join('src/mongo/db/modules', '**', '*.py'), recursive=True),
- ])
-
- return dependencies
-
- env['NINJA_REGENERATE_DEPS'] = ninja_generate_deps
- else:
- ninja_builder.generate(env)
+ ninjaConf = Configure(env, help=False, custom_tests = {
+ 'CheckNinjaCompdbExpand': env.CheckNinjaCompdbExpand,
+ })
+ env['NINJA_COMPDB_EXPAND'] = ninjaConf.CheckNinjaCompdbExpand()
+ ninjaConf.Finish()
+
+ # TODO: API for getting the sconscripts programmatically
+ # exists upstream: https://github.com/SCons/scons/issues/3625
+ def ninja_generate_deps(env, target, source, for_signature):
+ dependencies = env.Flatten([
+ 'SConstruct',
+ glob(os.path.join('src', '**', 'SConscript'), recursive=True),
+ glob(os.path.join(os.path.expanduser('~/.scons/'), '**', '*.py'), recursive=True),
+ glob(os.path.join('site_scons', '**', '*.py'), recursive=True),
+ glob(os.path.join('buildscripts', '**', '*.py'), recursive=True),
+ glob(os.path.join('src/third_party/scons-*', '**', '*.py'), recursive=True),
+ glob(os.path.join('src/mongo/db/modules', '**', '*.py'), recursive=True),
+ ])
+
+ return dependencies
+
+ env['NINJA_REGENERATE_DEPS'] = ninja_generate_deps
# idlc.py has the ability to print it's implicit dependencies
# while generating, Ninja can consume these prints using the
@@ -4049,15 +4029,9 @@ if get_option('ninja') != 'disabled':
)
def get_idlc_command(env, node, action, targets, sources, executor=None):
- if get_option('build-tools') == 'next' or get_option('ninja') == 'next':
- _, variables, _ = env.NinjaGetGenericShellCommand(node, action, targets, sources, executor=executor)
- else:
- _, variables = env.NinjaGetShellCommand(node, action, targets, sources, executor=executor)
+ _, variables, _ = env.NinjaGetGenericShellCommand(node, action, targets, sources, executor=executor)
variables["msvc_deps_prefix"] = "import file:"
- if get_option('build-tools') == 'next' or get_option('ninja') == 'next':
- return "IDLC", variables, env.subst(env['IDLC']).split()
- else:
- return "IDLC", variables
+ return "IDLC", variables, env.subst(env['IDLC']).split()
env.NinjaRuleMapping("$IDLCCOM", get_idlc_command)
env.NinjaRuleMapping(env["IDLCCOM"], get_idlc_command)