diff options
author | Daniel Moody <daniel.moody@mongodb.com> | 2021-02-24 15:09:12 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-02-24 17:04:59 +0000 |
commit | b27c452ce1a4afdf8596956aed5387025cb0e1d7 (patch) | |
tree | 6e1f7db719266b707684c61b3d837af5f0b38dd1 /site_scons | |
parent | a6f50f0c9d2c7afecf13cad922635aa9a2a15cc2 (diff) | |
download | mongo-b27c452ce1a4afdf8596956aed5387025cb0e1d7.tar.gz |
SERVER-53530 added mac support for libdeps graph generation
Diffstat (limited to 'site_scons')
-rw-r--r-- | site_scons/libdeps_next.py | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/site_scons/libdeps_next.py b/site_scons/libdeps_next.py index 847836e60d8..a5522221ac9 100644 --- a/site_scons/libdeps_next.py +++ b/site_scons/libdeps_next.py @@ -1150,14 +1150,17 @@ def generate_libdeps_graph(env): str(libdep.abspath), visibility=int(deptype.Public), direct=False) - - ld_path = ":".join([os.path.dirname(str(libdep)) for libdep in _get_libdeps(source)]) + if env['PLATFORM'] == 'darwin': + sep = ' ' + else: + sep = ':' + ld_path = sep.join([os.path.dirname(str(libdep)) for libdep in _get_libdeps(source)]) symbol_deps.append(env.Command( target=target, source=source, action=SCons.Action.Action( f'{find_symbols} $SOURCE "{ld_path}" $TARGET', - "Generating $SOURCE symbol dependencies"))) + "Generating $SOURCE symbol dependencies" if not env['VERBOSE'] else ""))) def write_graph_hash(env, target, source): import networkx @@ -1249,13 +1252,16 @@ def generate_graph(env, target, source): for symbol_deps_file in source: with open(str(symbol_deps_file)) as f: symbols = {} - for symbol, lib in json.load(f).items(): - # ignore symbols from external libraries, - # they will just clutter the graph - if lib.startswith(env.Dir("$BUILD_DIR").path): - if lib not in symbols: - symbols[lib] = [] - symbols[lib].append(symbol) + try: + for symbol, lib in json.load(f).items(): + # ignore symbols from external libraries, + # they will just clutter the graph + if lib.startswith(env.Dir("$BUILD_DIR").path): + if lib not in symbols: + symbols[lib] = [] + symbols[lib].append(symbol) + except json.JSONDecodeError: + env.FatalError(f"Failed processing json file: {str(symbol_deps_file)}") for lib in symbols: @@ -1335,7 +1341,12 @@ def setup_environment(env, emitting_shared=False, debug='off', linting='on', san env.FatalError("Libdeps graph generation is not supported with ninja builds.") if not emitting_shared: env.FatalError("Libdeps graph generation currently only supports dynamic builds.") - for bin in ['awk', 'grep', 'ldd', 'nm']: + + if env['PLATFORM'] == 'darwin': + required_bins = ['awk', 'sed', 'otool', 'nm'] + else: + required_bins = ['awk', 'grep', 'ldd', 'nm'] + for bin in required_bins: if not env.WhereIs(bin): env.FatalError(f"'{bin}' not found, Libdeps graph generation requires {bin}.") |