summaryrefslogtreecommitdiff
path: root/SConstruct
diff options
context:
space:
mode:
authorAndrew Morrow <acm@mongodb.com>2016-08-15 22:44:28 -0400
committerAndrew Morrow <acm@mongodb.com>2016-08-17 13:29:55 -0400
commitd25e46c8f1bbbebaca2d8ecba255c214b9200138 (patch)
treef60cecce8bc6036301fd1d5c0ddc106593aef075 /SConstruct
parent8e19a43ce5401c6333efc7c7dee291778bcec94a (diff)
downloadmongo-d25e46c8f1bbbebaca2d8ecba255c214b9200138.tar.gz
SERVER-25608 Add a SCons target and config vars for cache pruning
Diffstat (limited to 'SConstruct')
-rw-r--r--SConstruct27
1 files changed, 27 insertions, 0 deletions
diff --git a/SConstruct b/SConstruct
index c4a8ba07ffd..bc895815410 100644
--- a/SConstruct
+++ b/SConstruct
@@ -591,6 +591,20 @@ env_vars.Add('ARFLAGS',
help='Sets flags for the archiver',
converter=variable_shlex_converter)
+env_vars.Add(
+ 'CACHE_SIZE',
+ help='Maximum size of the cache (in gigabytes)',
+ default=32,
+ converter=lambda x:int(x)
+)
+
+env_vars.Add(
+ 'CACHE_PRUNE_TARGET',
+ help='Maximum percent in-use in cache after pruning',
+ default=66,
+ converter=lambda x:int(x)
+)
+
env_vars.Add('CC',
help='Select the C compiler to use')
@@ -2951,6 +2965,19 @@ env.Requires(dependencyDb, all)
# since presumably we can re-install them from the origin if needed.
env.NoCache(env.FindInstalledFiles())
+# Declare the cache prune target
+cachePrune = env.Command(
+ target="#cache-prune",
+ source=[
+ "#buildscripts/scons_cache_prune.py",
+ ],
+ action="$PYTHON ${SOURCES[0]} --cache-dir=${CACHE_DIR.abspath} --cache-size=${CACHE_SIZE} --prune-ratio=${CACHE_PRUNE_TARGET/100.00}",
+ CACHE_DIR=env.Dir(cacheDir),
+)
+
+env.AlwaysBuild(cachePrune)
+env.Alias('cache-prune', cachePrune)
+
# Substitute environment variables in any build targets so that we can
# say, for instance:
#