Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: pylib/gyp/input.py

Issue 6883158: This change sorts the members in 'dependencies' section in the order from dependents to dependenc... (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: '' Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1491 matching lines...) Expand 10 before | Expand all | Expand 10 after
1502 # present. 1502 # present.
1503 1503
1504 link_dependencies = dependency_nodes[target].LinkDependencies(targets) 1504 link_dependencies = dependency_nodes[target].LinkDependencies(targets)
1505 for dependency in link_dependencies: 1505 for dependency in link_dependencies:
1506 if dependency == target: 1506 if dependency == target:
1507 continue 1507 continue
1508 if not 'dependencies' in target_dict: 1508 if not 'dependencies' in target_dict:
1509 target_dict['dependencies'] = [] 1509 target_dict['dependencies'] = []
1510 if not dependency in target_dict['dependencies']: 1510 if not dependency in target_dict['dependencies']:
1511 target_dict['dependencies'].append(dependency) 1511 target_dict['dependencies'].append(dependency)
1512 # Sort the dependencies list in the order from dependents to dependencies.
1513 # e.g. If A and B depend on C and C depends on D, sort them in A, B, C, D.
1514 # Note: flat_list is already sorted in the order from dependencies to
1515 # dependents.
1516 if 'dependencies' in target_dict:
1517 target_dict['dependencies'] = [
1518 dep for dep in flat_list if dep in target_dict['dependencies']]
1519 target_dict['dependencies'].reverse()
1512 1520
1513 # Initialize this here to speed up MakePathRelative. 1521 # Initialize this here to speed up MakePathRelative.
1514 exception_re = re.compile(r'''["']?[-/$<>]''') 1522 exception_re = re.compile(r'''["']?[-/$<>]''')
1515 1523
1516 1524
1517 def MakePathRelative(to_file, fro_file, item): 1525 def MakePathRelative(to_file, fro_file, item):
1518 # If item is a relative path, it's relative to the build file dict that it's 1526 # If item is a relative path, it's relative to the build file dict that it's
1519 # coming from. Fix it up to make it relative to the build file dict that 1527 # coming from. Fix it up to make it relative to the build file dict that
1520 # it's going into. 1528 # it's going into.
1521 # Exception: any |item| that begins with these special characters is 1529 # Exception: any |item| that begins with these special characters is
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after
2241 ValidateRunAsInTarget(target, target_dict, build_file) 2249 ValidateRunAsInTarget(target, target_dict, build_file)
2242 ValidateActionsInTarget(target, target_dict, build_file) 2250 ValidateActionsInTarget(target, target_dict, build_file)
2243 2251
2244 # Generators might not expect ints. Turn them into strs. 2252 # Generators might not expect ints. Turn them into strs.
2245 TurnIntIntoStrInDict(data) 2253 TurnIntIntoStrInDict(data)
2246 2254
2247 # TODO(mark): Return |data| for now because the generator needs a list of 2255 # TODO(mark): Return |data| for now because the generator needs a list of
2248 # build files that came in. In the future, maybe it should just accept 2256 # build files that came in. In the future, maybe it should just accept
2249 # a list, and not the whole data dict. 2257 # a list, and not the whole data dict.
2250 return [flat_list, targets, data] 2258 return [flat_list, targets, data]
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698