From df27bbcf24db28fa68bfd264f0d3883c0e33320e Mon Sep 17 00:00:00 2001 From: Mathias Stearn Date: Fri, 11 Jul 2014 13:58:13 -0400 Subject: [PATCH] SERVER-11290 Don't actually build static libraries We don't currently use the static libraries, they are just nodes in our dependency graph. Since they are unused, building them wastes time and disk IO. We still need to generate the files to appease scons. They are filled with a UUID on the assumption that if scons thinks that a library needs to be rebuilt then anything that depends on the library should also be rebuilt. --- SConstruct | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/SConstruct b/SConstruct index 4f4a39ebd17..a4407b37667 100644 --- a/SConstruct +++ b/SConstruct @@ -26,6 +26,7 @@ import textwrap import types import urllib import urllib2 +import uuid from buildscripts import utils from buildscripts import moduleconfig @@ -485,8 +486,6 @@ if optBuild: if has_option("propagate-shell-environment"): env['ENV'] = dict(os.environ); -env['_LIBDEPS'] = '$_LIBDEPS_OBJS' - # Ignore requests to build fast and loose for release builds. if get_option('build-fast-and-loose') == "on" and not has_option('release'): # See http://www.scons.org/wiki/GoFastButton for details @@ -502,6 +501,24 @@ if has_option('mute'): env.Append( SHLINKCOMSTR = env["LINKCOMSTR"] ) env.Append( ARCOMSTR = "Generating library $TARGET" ) +env['_LIBDEPS'] = '$_LIBDEPS_OBJS' + +if env['_LIBDEPS'] == '$_LIBDEPS_OBJS': + # The libraries we build in LIBDEPS_OBJS mode are just placeholders for tracking dependencies. + # This avoids wasting time and disk IO on them. + def write_uuid_to_file(env, target, source): + with open(env.File(target[0]).abspath, 'w') as fake_lib: + fake_lib.write(str(uuid.uuid4())) + fake_lib.write('\n') + + def noop_action(env, target, source): + pass + + env['ARCOM'] = write_uuid_to_file + env['ARCOMSTR'] = 'Generating placeholder library $TARGET' + env['RANLIBCOM'] = noop_action + env['RANLIBCOMSTR'] = 'Skipping ranlib for $TARGET' + libdeps.setup_environment( env ) if env['PYSYSPLATFORM'] == 'linux3':