diff options
author | Andrew Morrow <acm@mongodb.com> | 2019-02-11 18:01:43 -0500 |
---|---|---|
committer | Andrew Morrow <acm@mongodb.com> | 2019-02-12 13:29:30 -0500 |
commit | 2244659e80a511232cf681b5fb8c90705d4709ea (patch) | |
tree | 1e3443382f3a15aeda739057c07f8a2dd03e3c0b /SConstruct | |
parent | 87881b0424d3706f57efa14b26729c9b5a7a0d4d (diff) | |
download | mongo-2244659e80a511232cf681b5fb8c90705d4709ea.tar.gz |
SERVER-33958 Allow thin archives to interact with the cache
Diffstat (limited to 'SConstruct')
-rw-r--r-- | SConstruct | 49 |
1 files changed, 28 insertions, 21 deletions
diff --git a/SConstruct b/SConstruct index fbf09e8feda..fcb305a6708 100644 --- a/SConstruct +++ b/SConstruct @@ -1288,27 +1288,6 @@ 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 for now both developer and release builds # use the "static" mode. Somday later, we probably want to make the developer build default # dynamic, but that will require the hygienic builds project. @@ -3842,6 +3821,34 @@ if has_option('jlink'): new_emitter = SCons.Builder.ListEmitter([base_emitter, jlink_emitter]) builder.emitter = new_emitter +# Keep this late in the game so that we can investigate attributes set by all the tools that have run. +if has_option("cache"): + if get_option("cache") == "nolinked": + def noCacheEmitter(target, source, env): + for t in target: + try: + if getattr(t.attributes, 'thin_archive', False): + continue + except(AttributeError): + pass + 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): + origEmitter.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']) + env.SConscript( dirs=[ 'src', |