diff options
author | Mathew Robinson <chasinglogic@gmail.com> | 2020-01-29 16:11:37 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-02-13 15:21:41 +0000 |
commit | 65c27c5f9899e2cf72b392a3f1174767afec8823 (patch) | |
tree | df097f6326258335080de20f0a214ce17fdc505c | |
parent | e87edace22b258809b6f209a3cdc6c123149a16b (diff) | |
download | mongo-65c27c5f9899e2cf72b392a3f1174767afec8823.tar.gz |
SERVER-45786 Generate Resmoke configuration file to auto-set installDir
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | SConstruct | 30 | ||||
-rw-r--r-- | buildscripts/resmoke.ini.in | 2 |
3 files changed, 35 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore index e3e028ec492..66aaf48b32d 100644 --- a/.gitignore +++ b/.gitignore @@ -185,3 +185,6 @@ codereview.rc # Python venvs and virtualenvs python3-venv python2-venv + +# Generated resmoke configuration file +resmoke.ini
\ No newline at end of file diff --git a/SConstruct b/SConstruct index 0ad7edac1ea..5116821ad32 100644 --- a/SConstruct +++ b/SConstruct @@ -3743,6 +3743,33 @@ env["NINJA_SYNTAX"] = "#site_scons/third_party/ninja_syntax.py" env.Tool('ccache') env.Tool('icecream') +resmoke_config = env.Substfile( + target="#resmoke.ini", + source="buildscripts/resmoke.ini.in", + SUBST_DICT={ + "@install_dir@": "$PREFIX_BINDIR" if get_option("install-mode") == "hygienic" else env.Dir("#").abspath, + } +) + +# Substfile does a poor job of detecting if it needs to rebuild a +# file. Since this file is cheap to generate we make it always build +# because it's better to spend the < 1 second generating it than +# having a developer waste time debugging why they're running the +# wrong binaries from Resmoke. +# +# This doesn't make this file always generate, it only generates if +# the below Depends wiring have changed. Basically it skips SCons' +# Deciders +env.AlwaysBuild(resmoke_config) +if get_option("install-mode") == "hygienic": + # We only need to change the config if PREFIX_BINDIR has changed + # since Resmoke's installDir flag points here. + env.Depends(env.Dir("$PREFIX_BINDIR"), resmoke_config) +else: + # This depends really isn't true but it's the only reliable way + # for non-hygienic builds to make sure this file is made. + env.Depends(env.Dir("$BUILD_DIR"), resmoke_config) + if get_option('ninja') == 'true': ninja_builder = Tool("ninja") ninja_builder.generate(env) @@ -3765,6 +3792,7 @@ if get_option('ninja') == 'true': source=[ env.Alias("install-all-meta"), env.Alias("test-execution-aliases"), + resmoke_config, ], ) else: @@ -3773,6 +3801,7 @@ if get_option('ninja') == 'true': source=[ env.Alias("all"), env.Alias("test-execution-aliases"), + resmoke_config, ], ) @@ -4338,6 +4367,7 @@ if has_option("cache"): addNoCacheEmitter(env['BUILDERS']['SharedLibrary']) addNoCacheEmitter(env['BUILDERS']['LoadableModule']) + env.SConscript( dirs=[ 'src', diff --git a/buildscripts/resmoke.ini.in b/buildscripts/resmoke.ini.in new file mode 100644 index 00000000000..5ee714b6dd2 --- /dev/null +++ b/buildscripts/resmoke.ini.in @@ -0,0 +1,2 @@ +[resmoke] +install_dir = @install_dir@
\ No newline at end of file |