summaryrefslogtreecommitdiff
path: root/SConstruct
diff options
context:
space:
mode:
authorAndrew Morrow <acm@mongodb.com>2016-08-08 21:13:07 -0400
committerAndrew Morrow <acm@mongodb.com>2016-08-13 13:12:32 -0400
commitbd66e1bdbc627979e7bb6824fbdfc132093a9bf9 (patch)
treee4ad3b067b77c76d69ad987f71788d9de1056f86 /SConstruct
parentf210923e76fa101ca417a085dd370219221cdda0 (diff)
downloadmongo-bd66e1bdbc627979e7bb6824fbdfc132093a9bf9.tar.gz
SERVER-25402 Add an option to not cache linked artifacts
Diffstat (limited to 'SConstruct')
-rw-r--r--SConstruct27
1 files changed, 26 insertions, 1 deletions
diff --git a/SConstruct b/SConstruct
index add7f7b52c0..358bd840180 100644
--- a/SConstruct
+++ b/SConstruct
@@ -15,6 +15,8 @@ import uuid
from buildscripts import utils
from buildscripts import moduleconfig
+import SCons
+
from mongo_scons_utils import (
default_buildinfo_environment_data,
default_variant_dir_generator,
@@ -426,8 +428,10 @@ add_option('win-version-min',
)
add_option('cache',
+ choices=["all", "nolinked"],
+ const='all',
help='Use an object cache rather than a per-build variant directory (experimental)',
- nargs=0,
+ nargs='?',
)
add_option('cache-dir',
@@ -1119,6 +1123,27 @@ if has_option("cache"):
env.FatalError("Mixing --cache and --gcov doesn't work correctly yet. See SERVER-11084")
env.CacheDir(str(env.Dir(cacheDir)))
+ if get_option("cache") == "nolinked":
+ def noCacheEmitter(target, source, env):
+ for t in target:
+ env.NoCache(t)
+ return target, source
+
+ def addNoCacheEmitter(builder):
+ origEmitter = builder.emitter
+ if SCons.Util.is_Dict(origEmitter):
+ for k,v in origEmitter:
+ origEmitter[k] = SCons.Builder.ListEmitter([v, noCacheEmitter])
+ elif SCons.Util.is_List(origEmitter):
+ emitter.append(noCacheEmitter)
+ else:
+ builder.emitter = SCons.Builder.ListEmitter([origEmitter, noCacheEmitter])
+
+ addNoCacheEmitter(env['BUILDERS']['Program'])
+ addNoCacheEmitter(env['BUILDERS']['StaticLibrary'])
+ addNoCacheEmitter(env['BUILDERS']['SharedLibrary'])
+ addNoCacheEmitter(env['BUILDERS']['LoadableModule'])
+
# Normalize the link model. If it is auto, then a release build uses 'object' mode. Otherwise
# we automatically select the 'static' model on non-windows platforms, or 'object' if on
# Windows. If the user specified, honor the request, unless it conflicts with the requirement