| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 from compiler.ast import Const | 7 from compiler.ast import Const |
| 8 from compiler.ast import Dict | 8 from compiler.ast import Dict |
| 9 from compiler.ast import Discard | 9 from compiler.ast import Discard |
| 10 from compiler.ast import List | 10 from compiler.ast import List |
| (...skipping 1527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1538 # present. | 1538 # present. |
| 1539 | 1539 |
| 1540 link_dependencies = dependency_nodes[target].LinkDependencies(targets) | 1540 link_dependencies = dependency_nodes[target].LinkDependencies(targets) |
| 1541 for dependency in link_dependencies: | 1541 for dependency in link_dependencies: |
| 1542 if dependency == target: | 1542 if dependency == target: |
| 1543 continue | 1543 continue |
| 1544 if not 'dependencies' in target_dict: | 1544 if not 'dependencies' in target_dict: |
| 1545 target_dict['dependencies'] = [] | 1545 target_dict['dependencies'] = [] |
| 1546 if not dependency in target_dict['dependencies']: | 1546 if not dependency in target_dict['dependencies']: |
| 1547 target_dict['dependencies'].append(dependency) | 1547 target_dict['dependencies'].append(dependency) |
| 1548 # Sort the dependencies list in the order from dependents to dependencies. |
| 1549 # e.g. If A and B depend on C and C depends on D, sort them in A, B, C, D. |
| 1550 # Note: flat_list is already sorted in the order from dependencies to |
| 1551 # dependents. |
| 1552 if 'dependencies' in target_dict: |
| 1553 target_dict['dependencies'] = [ |
| 1554 dep for dep in flat_list if dep in target_dict['dependencies']] |
| 1555 |
| 1556 # The final step to implement the above algorithm would be to reverse |
| 1557 # the dependencies: |
| 1558 # target_dict['dependencies'].reverse() |
| 1559 # as an experiment, leave this out so we can measure its impact on |
| 1560 # build performance. |
| 1561 |
| 1548 | 1562 |
| 1549 # Initialize this here to speed up MakePathRelative. | 1563 # Initialize this here to speed up MakePathRelative. |
| 1550 exception_re = re.compile(r'''["']?[-/$<>]''') | 1564 exception_re = re.compile(r'''["']?[-/$<>]''') |
| 1551 | 1565 |
| 1552 | 1566 |
| 1553 def MakePathRelative(to_file, fro_file, item): | 1567 def MakePathRelative(to_file, fro_file, item): |
| 1554 # If item is a relative path, it's relative to the build file dict that it's | 1568 # If item is a relative path, it's relative to the build file dict that it's |
| 1555 # coming from. Fix it up to make it relative to the build file dict that | 1569 # coming from. Fix it up to make it relative to the build file dict that |
| 1556 # it's going into. | 1570 # it's going into. |
| 1557 # Exception: any |item| that begins with these special characters is | 1571 # Exception: any |item| that begins with these special characters is |
| (...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2292 ValidateRunAsInTarget(target, target_dict, build_file) | 2306 ValidateRunAsInTarget(target, target_dict, build_file) |
| 2293 ValidateActionsInTarget(target, target_dict, build_file) | 2307 ValidateActionsInTarget(target, target_dict, build_file) |
| 2294 | 2308 |
| 2295 # Generators might not expect ints. Turn them into strs. | 2309 # Generators might not expect ints. Turn them into strs. |
| 2296 TurnIntIntoStrInDict(data) | 2310 TurnIntIntoStrInDict(data) |
| 2297 | 2311 |
| 2298 # TODO(mark): Return |data| for now because the generator needs a list of | 2312 # TODO(mark): Return |data| for now because the generator needs a list of |
| 2299 # build files that came in. In the future, maybe it should just accept | 2313 # build files that came in. In the future, maybe it should just accept |
| 2300 # a list, and not the whole data dict. | 2314 # a list, and not the whole data dict. |
| 2301 return [flat_list, targets, data] | 2315 return [flat_list, targets, data] |
| OLD | NEW |