14 """Buildgen transitive dependencies
16 This takes the list of libs, node_modules, and targets from our
17 yaml dictionary, and adds to each the transitive closure
18 of the list of dependencies.
23 """Returns a list of transitive dependencies from node.
25 Recursively iterate all dependent node in a depth-first fashion and
26 list a result using a topological sorting.
32 def recursive_helper(node):
35 for dep
in node.get(
"deps", []):
38 next_node = lib_map.get(dep)
39 recursive_helper(next_node)
41 result.insert(0, node[
"name"])
43 recursive_helper(node)
48 """The exported plugin code for transitive_dependencies.
50 Iterate over each list and check each item for a deps list. We add a
51 transitive_deps property to each with the transitive closure of those
52 dependency lists. The result list is sorted in a topological ordering.
54 lib_map = {lib[
'name']: lib
for lib
in dictionary.get(
'libs')}
56 for target_name, target_list
in list(dictionary.items()):
57 for target
in target_list:
58 if isinstance(target, dict):
59 if 'deps' in target
or target_name ==
'libs':
60 if not 'deps' in target:
65 python_dependencies = dictionary.get(
'python_dependencies')
67 lib_map, python_dependencies)