MCPcopy Create free account
hub / github.com/nodejs/node / PruneUnwantedTargets

Function PruneUnwantedTargets

tools/gyp/pylib/gyp/input.py:2853–2884  ·  view source on GitHub ↗

Return only the targets that are deep dependencies of |root_targets|.

(targets, flat_list, dependency_nodes, root_targets, data)

Source from the content-addressed store, hash-verified

2851
2852
2853def PruneUnwantedTargets(targets, flat_list, dependency_nodes, root_targets, data):
2854 """Return only the targets that are deep dependencies of |root_targets|."""
2855 qualified_root_targets = []
2856 for target in root_targets:
2857 target = target.strip()
2858 qualified_targets = gyp.common.FindQualifiedTargets(target, flat_list)
2859 if not qualified_targets:
2860 raise GypError("Could not find target %s" % target)
2861 qualified_root_targets.extend(qualified_targets)
2862
2863 wanted_targets = {}
2864 for target in qualified_root_targets:
2865 wanted_targets[target] = targets[target]
2866 for dependency in dependency_nodes[target].DeepDependencies():
2867 wanted_targets[dependency] = targets[dependency]
2868
2869 wanted_flat_list = [t for t in flat_list if t in wanted_targets]
2870
2871 # Prune unwanted targets from each build_file's data dict.
2872 for build_file in data["target_build_files"]:
2873 if "targets" not in data[build_file]:
2874 continue
2875 new_targets = []
2876 for target in data[build_file]["targets"]:
2877 qualified_name = gyp.common.QualifiedTarget(
2878 build_file, target["target_name"], target["toolset"]
2879 )
2880 if qualified_name in wanted_targets:
2881 new_targets.append(target)
2882 data[build_file]["targets"] = new_targets
2883
2884 return wanted_targets, wanted_flat_list
2885
2886
2887def VerifyNoCollidingTargets(targets):

Callers 1

LoadFunction · 0.85

Calls 4

GypErrorClass · 0.90
DeepDependenciesMethod · 0.80
extendMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected