diff options
author | Andrew Morrow <acm@10gen.com> | 2013-10-05 14:15:03 -0400 |
---|---|---|
committer | Andrew Morrow <acm@10gen.com> | 2013-10-07 08:47:51 -0400 |
commit | ac2bd108337a6de9765ac396c6e5911ca5bdff7d (patch) | |
tree | 36691ac810e832c4790a97b54cc33b7ed0a49b6d /SConstruct | |
parent | 0b40bfbd29511acf9f075df34c048b1b98cf0094 (diff) | |
download | mongo-ac2bd108337a6de9765ac396c6e5911ca5bdff7d.tar.gz |
SERVER-11053 Support use of CacheDir rather than Brobdingnagian variant directory names
Diffstat (limited to 'SConstruct')
-rw-r--r-- | SConstruct | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/SConstruct b/SConstruct index 45a6ae14737..c7d9e736ee1 100644 --- a/SConstruct +++ b/SConstruct @@ -159,21 +159,26 @@ def get_variant_dir(): x = substitute( get_option( name ) ) a.append( name + "_" + x ) - s = "#build/${PYSYSPLATFORM}/" - extras = [] if has_option("extra-variant-dirs"): extras = [substitute(x) for x in get_option( 'extra-variant-dirs' ).split( ',' )] if has_option("add-branch-to-variant-dir"): extras += ["branch_" + substitute( utils.getGitBranch() )] - a += extras - if len(a) > 0: - a.sort() - s += "/".join( a ) + "/" + if has_option('cache'): + s = "#build/cached/" + s += "/".join(extras) + "/" else: - s += "normal/" + s = "#build/${PYSYSPLATFORM}/" + a += extras + + if len(a) > 0: + a.sort() + s += "/".join( a ) + "/" + else: + s += "normal/" + return s # build output @@ -321,6 +326,14 @@ elif windows: type = 'choice', default = None, choices = win_version_min_choices.keys()) +add_option('cache', + "Use an object cache rather than a per-build variant directory (experimental)", + 0, False) + +add_option('cache-dir', + "Specify the directory to use for caching objects if --cache is in use", + 1, False, default="#build/cached/.cache") + # don't run configure if user calls --help if GetOption('help'): Return() @@ -461,6 +474,13 @@ env = Environment( BUILD_DIR=variantDir, CONFIGURELOG = '#' + scons_data_dir + '/config.log' ) +if has_option("cache"): + EnsureSConsVersion( 2, 3, 0 ) + if has_option("release"): + print("Using the experimental --cache option is not permitted for --release builds") + Exit(1) + env.CacheDir(str(env.Dir(get_option('cache-dir')))) + # This could be 'if solaris', but unfortuantely that variable hasn't been set yet. if "sunos5" == os.sys.platform: # SERVER-9890: On Solaris, SCons preferentially loads the sun linker tool 'sunlink' when |