Chromium Code Reviews| Index: pylib/gyp/common.py |
| =================================================================== |
| --- pylib/gyp/common.py (revision 836) |
| +++ pylib/gyp/common.py (working copy) |
| @@ -219,21 +219,21 @@ |
| encoded_arguments.append(EncodePOSIXShellArgument(argument)) |
| return ' '.join(encoded_arguments) |
| - |
| -def DeepDependencyTargets(target_dicts, roots): |
| +def DeepDependencyTargets(target_dicts, roots, dependencies=None): |
|
Mark Mentovai
2010/07/07 17:45:28
Could you explain what’s going on in this function
|
| """Returns the recursive list of target dependencies. |
| """ |
| - dependencies = set() |
| + dependencies = dependencies or set() |
| + unseen_deps = [] |
| for r in roots: |
| spec = target_dicts[r] |
| r_deps = list(set((spec.get('dependencies', []) + |
| spec.get('dependencies_original', [])))) |
| for d in r_deps: |
| - if d not in roots: |
| + if d not in dependencies and d not in roots: |
| dependencies.add(d) |
| - for d in DeepDependencyTargets(target_dicts, r_deps): |
| - if d not in roots: |
| - dependencies.add(d) |
| + unseen_deps.append(d) |
| + if unseen_deps: |
| + DeepDependencyTargets(target_dicts, unseen_deps, dependencies) |
| return list(dependencies) |