OLD | NEW |
---|---|
1 # Copyright (c) 2012 Google Inc. All rights reserved. | 1 # Copyright (c) 2012 Google Inc. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 from compiler.ast import Const | 5 from compiler.ast import Const |
6 from compiler.ast import Dict | 6 from compiler.ast import Dict |
7 from compiler.ast import Discard | 7 from compiler.ast import Discard |
8 from compiler.ast import List | 8 from compiler.ast import List |
9 from compiler.ast import Module | 9 from compiler.ast import Module |
10 from compiler.ast import Node | 10 from compiler.ast import Node |
(...skipping 1584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1595 dependencies that a dependency has advertised settings should be exported | 1595 dependencies that a dependency has advertised settings should be exported |
1596 through the dependency for. | 1596 through the dependency for. |
1597 """ | 1597 """ |
1598 | 1598 |
1599 dependencies = self.DirectDependencies(dependencies) | 1599 dependencies = self.DirectDependencies(dependencies) |
1600 return self._AddImportedDependencies(targets, dependencies) | 1600 return self._AddImportedDependencies(targets, dependencies) |
1601 | 1601 |
1602 def DeepDependencies(self, dependencies=None): | 1602 def DeepDependencies(self, dependencies=None): |
1603 """Returns a list of all of a target's dependencies, recursively.""" | 1603 """Returns a list of all of a target's dependencies, recursively.""" |
1604 if dependencies == None: | 1604 if dependencies == None: |
1605 dependencies = [] | 1605 dependencies = set() |
1606 | 1606 |
1607 for dependency in self.dependencies: | 1607 for dependency in self.dependencies: |
1608 # Check for None, corresponding to the root node. | 1608 # Check for None, corresponding to the root node. |
1609 if dependency.ref != None and dependency.ref not in dependencies: | 1609 if dependency.ref != None and dependency.ref not in dependencies: |
1610 dependencies.append(dependency.ref) | 1610 dependencies.add(dependency.ref) |
1611 dependency.DeepDependencies(dependencies) | 1611 dependency.DeepDependencies(dependencies) |
1612 | 1612 |
1613 return dependencies | 1613 return dependencies |
Nico
2014/04/11 16:11:01
DeepDependencies() now won't return results in det
| |
1614 | 1614 |
1615 def _LinkDependenciesInternal(self, targets, include_shared_libraries, | 1615 def _LinkDependenciesInternal(self, targets, include_shared_libraries, |
1616 dependencies=None, initial=True): | 1616 dependencies=None, initial=True): |
1617 """Returns a list of dependency targets that are linked into this target. | 1617 """Returns a list of dependency targets that are linked into this target. |
1618 | 1618 |
1619 This function has a split personality, depending on the setting of | 1619 This function has a split personality, depending on the setting of |
1620 |initial|. Outside callers should always leave |initial| at its default | 1620 |initial|. Outside callers should always leave |initial| at its default |
1621 setting. | 1621 setting. |
1622 | 1622 |
1623 When adding a target to the list of dependencies, this function will | 1623 When adding a target to the list of dependencies, this function will |
(...skipping 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2815 ValidateRunAsInTarget(target, target_dict, build_file) | 2815 ValidateRunAsInTarget(target, target_dict, build_file) |
2816 ValidateActionsInTarget(target, target_dict, build_file) | 2816 ValidateActionsInTarget(target, target_dict, build_file) |
2817 | 2817 |
2818 # Generators might not expect ints. Turn them into strs. | 2818 # Generators might not expect ints. Turn them into strs. |
2819 TurnIntIntoStrInDict(data) | 2819 TurnIntIntoStrInDict(data) |
2820 | 2820 |
2821 # TODO(mark): Return |data| for now because the generator needs a list of | 2821 # TODO(mark): Return |data| for now because the generator needs a list of |
2822 # build files that came in. In the future, maybe it should just accept | 2822 # build files that came in. In the future, maybe it should just accept |
2823 # a list, and not the whole data dict. | 2823 # a list, and not the whole data dict. |
2824 return [flat_list, targets, data] | 2824 return [flat_list, targets, data] |
OLD | NEW |