Return only the targets that are deep dependencies of |root_targets|.
(targets, flat_list, dependency_nodes, root_targets, data)
| 2851 | |
| 2852 | |
| 2853 | def 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 | |
| 2887 | def VerifyNoCollidingTargets(targets): |
no test coverage detected