summaryrefslogtreecommitdiff
path: root/site_scons
diff options
context:
space:
mode:
authorKasper Laudrup <laudrup@stacktrace.dk>2017-01-10 22:37:58 +0100
committerGabriel Russell <gabriel.russell@mongodb.com>2017-01-13 13:40:48 -0500
commitde7e3c74f156248545f3148b79c5c4fc874696f7 (patch)
treeb374b8fb92531aab66a5da1c4e814e4b1fe88095 /site_scons
parent474e4f1e978a95d1f613273201d88780ab8a3b30 (diff)
downloadmongo-de7e3c74f156248545f3148b79c5c4fc874696f7.tar.gz
SERVER-27628 Use the overrided environment when generating compile_command.json
When the compilation_db scons emitter saved compilation database entried it always used the "global" environment which might not match the compilation command line actually used to build the target. That meant that using eg.: env.Library("foo", ["foo.cpp"], CXXFLAGS=["-Dfoo"]) Would not write the extra "-Dfoo" flag actually used to build the foo library to the compile_commands.json file. Instead save the environment used to generate the target and use that when writing the compile_command.json entry.
Diffstat (limited to 'site_scons')
-rw-r--r--site_scons/site_tools/compilation_db.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/site_scons/site_tools/compilation_db.py b/site_scons/site_tools/compilation_db.py
index cd4619dcfa4..be040a84d0e 100644
--- a/site_scons/site_tools/compilation_db.py
+++ b/site_scons/site_tools/compilation_db.py
@@ -51,7 +51,8 @@ def makeEmitCompilationDbEntry(comstr):
source=[],
__COMPILATIONDB_UTARGET=target,
__COMPILATIONDB_USOURCE=source,
- __COMPILATIONDB_UACTION=user_action)
+ __COMPILATIONDB_UACTION=user_action,
+ __COMPILATIONDB_ENV=env)
# TODO: Technically, these next two lines should not be required: it should be fine to
# cache the entries. However, they don't seem to update properly. Since they are quick
@@ -70,7 +71,7 @@ def CompilationDbEntryAction(target, source, env, **kw):
command = env['__COMPILATIONDB_UACTION'].strfunction(
target=env['__COMPILATIONDB_UTARGET'],
source=env['__COMPILATIONDB_USOURCE'],
- env=env)
+ env=env['__COMPILATIONDB_ENV'],)
entry = {
"directory": env.Dir('#').abspath,