summaryrefslogtreecommitdiff
path: root/buildscripts
diff options
context:
space:
mode:
authorRyan Egesdahl <ryan.egesdahl@mongodb.com>2020-10-20 08:43:36 -0700
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-11-26 08:56:00 +0000
commit82ef2151223ec184682e752436ac07916500253f (patch)
tree656de495698932e1fecd1725f6e4b95786193109 /buildscripts
parent515723d10def74299cf7729148f946b538b82797 (diff)
downloadmongo-82ef2151223ec184682e752436ac07916500253f.tar.gz
SERVER-48291 Add global dependency pushdown to libdeps
We sometimes have situations where a dependency applies at a large scope, such as in the case of tcmalloc, which can apply everywhere. What we have done previously is to hack these dependencies into the LIBDEPS environment variable by adding a builder to all nodes that can produce a compiler result. This is, as stated previously, hackish and hard to control, and it results in adding a Public dependency to all those nodes. What we now do instead is to define LIBDEPS_GLOBAL on the *build environment* (not the Builder node) listing the targets we would like to push down to all other nodes below that point. This has the effect of adding those targets as Private dependencies on all Builder nodes from that point downward, which means some common Public dependencies can be converted to a Private dependency that is stated only once.
Diffstat (limited to 'buildscripts')
-rwxr-xr-x[-rw-r--r--]buildscripts/libdeps/gacli.py0
-rw-r--r--buildscripts/libdeps/graph_analyzer.py16
-rwxr-xr-xbuildscripts/scons.py3
3 files changed, 14 insertions, 5 deletions
diff --git a/buildscripts/libdeps/gacli.py b/buildscripts/libdeps/gacli.py
index a89f8d7346e..a89f8d7346e 100644..100755
--- a/buildscripts/libdeps/gacli.py
+++ b/buildscripts/libdeps/gacli.py
diff --git a/buildscripts/libdeps/graph_analyzer.py b/buildscripts/libdeps/graph_analyzer.py
index ac3d7339b7f..a17c11c76c6 100644
--- a/buildscripts/libdeps/graph_analyzer.py
+++ b/buildscripts/libdeps/graph_analyzer.py
@@ -29,11 +29,19 @@ graph generated from SCons generate-libdeps-graph target. The graph
represents the dependency information between all binaries from the build.
"""
+import sys
+
from enum import Enum, auto
from pathlib import Path
import networkx
+sys.path.append(str(Path(__file__).parent.parent))
+import scons # pylint: disable=wrong-import-position
+
+sys.path.append(str(Path(scons.MONGODB_ROOT).joinpath('site_scons')))
+from libdeps_next import deptype # pylint: disable=wrong-import-position
+
class CountTypes(Enum):
"""Enums for the different types of counts to perform on a graph."""
@@ -106,23 +114,23 @@ class LibdepsGraph(networkx.DiGraph):
return len([
edge for edge in self.edges(data=True) if edge[2].get(EdgeProps.direct.name) == 1
- and edge[2].get(EdgeProps.visibility.name) == 0
+ and edge[2].get(EdgeProps.visibility.name) == int(deptype.Public)
])
def public_edge_count(self):
"""Count the graphs public edges."""
- return self.number_of_edge_types(EdgeProps.visibility.name, 0)
+ return self.number_of_edge_types(EdgeProps.visibility.name, int(deptype.Public))
def private_edge_count(self):
"""Count the graphs private edges."""
- return self.number_of_edge_types(EdgeProps.visibility.name, 1)
+ return self.number_of_edge_types(EdgeProps.visibility.name, int(deptype.Private))
def interface_edge_count(self):
"""Count the graphs interface edges."""
- return self.number_of_edge_types(EdgeProps.visibility.name, 2)
+ return self.number_of_edge_types(EdgeProps.visibility.name, int(deptype.Interface))
def direct_depends(self, node):
"""For given nodes, report what nodes depend directly on that node."""
diff --git a/buildscripts/scons.py b/buildscripts/scons.py
index 8d26f5057cf..6143dc7e3b6 100755
--- a/buildscripts/scons.py
+++ b/buildscripts/scons.py
@@ -23,4 +23,5 @@ except ImportError as import_err:
print("ImportError:", import_err)
sys.exit(1)
-SCons.Script.main()
+if __name__ == '__main__':
+ SCons.Script.main()