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

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

Issue 177043010: Introduce the 'link_dependency' attribute that removes the targets having this (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 9 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 | test/link-dependency/gyptest-link-dependency.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1425 matching lines...) Expand 10 before | Expand all | Expand 10 after
1436 for target_name, target_dict in targets.iteritems(): 1436 for target_name, target_dict in targets.iteritems():
1437 for dependency_key in dependency_sections: 1437 for dependency_key in dependency_sections:
1438 dependencies = target_dict.get(dependency_key, []) 1438 dependencies = target_dict.get(dependency_key, [])
1439 if dependencies: 1439 if dependencies:
1440 for t in dependencies: 1440 for t in dependencies:
1441 if t == target_name: 1441 if t == target_name:
1442 if targets[t].get('variables', {}).get('prune_self_dependency', 0): 1442 if targets[t].get('variables', {}).get('prune_self_dependency', 0):
1443 target_dict[dependency_key] = Filter(dependencies, target_name) 1443 target_dict[dependency_key] = Filter(dependencies, target_name)
1444 1444
1445 1445
1446 def RemoveLinkDependenciesFromNoneTargets(targets):
1447 """Remove dependencies having the 'link_dependency' attribute from the 'none'
1448 targets."""
1449 for target_name, target_dict in targets.iteritems():
1450 for dependency_key in dependency_sections:
1451 dependencies = target_dict.get(dependency_key, [])
1452 if dependencies:
1453 for t in dependencies:
1454 if target_dict.get('type', None) == 'none':
1455 if targets[t].get('variables', {}).get('link_dependency', 0):
1456 target_dict[dependency_key] = \
1457 Filter(target_dict[dependency_key], t)
1458
1459
1446 class DependencyGraphNode(object): 1460 class DependencyGraphNode(object):
1447 """ 1461 """
1448 1462
1449 Attributes: 1463 Attributes:
1450 ref: A reference to an object that this DependencyGraphNode represents. 1464 ref: A reference to an object that this DependencyGraphNode represents.
1451 dependencies: List of DependencyGraphNodes on which this one depends. 1465 dependencies: List of DependencyGraphNodes on which this one depends.
1452 dependents: List of DependencyGraphNodes that depend on this one. 1466 dependents: List of DependencyGraphNodes that depend on this one.
1453 """ 1467 """
1454 1468
1455 class CircularException(GypError): 1469 class CircularException(GypError):
(...skipping 1244 matching lines...) Expand 10 before | Expand all | Expand 10 after
2700 # Fully qualify all dependency links. 2714 # Fully qualify all dependency links.
2701 QualifyDependencies(targets) 2715 QualifyDependencies(targets)
2702 2716
2703 # Remove self-dependencies from targets that have 'prune_self_dependencies' 2717 # Remove self-dependencies from targets that have 'prune_self_dependencies'
2704 # set to 1. 2718 # set to 1.
2705 RemoveSelfDependencies(targets) 2719 RemoveSelfDependencies(targets)
2706 2720
2707 # Expand dependencies specified as build_file:*. 2721 # Expand dependencies specified as build_file:*.
2708 ExpandWildcardDependencies(targets, data) 2722 ExpandWildcardDependencies(targets, data)
2709 2723
2724 # Remove all dependencies marked as 'link_dependency' from the targets of
2725 # type 'none'.
2726 RemoveLinkDependenciesFromNoneTargets(targets)
2727
2710 # Apply exclude (!) and regex (/) list filters only for dependency_sections. 2728 # Apply exclude (!) and regex (/) list filters only for dependency_sections.
2711 for target_name, target_dict in targets.iteritems(): 2729 for target_name, target_dict in targets.iteritems():
2712 tmp_dict = {} 2730 tmp_dict = {}
2713 for key_base in dependency_sections: 2731 for key_base in dependency_sections:
2714 for op in ('', '!', '/'): 2732 for op in ('', '!', '/'):
2715 key = key_base + op 2733 key = key_base + op
2716 if key in target_dict: 2734 if key in target_dict:
2717 tmp_dict[key] = target_dict[key] 2735 tmp_dict[key] = target_dict[key]
2718 del target_dict[key] 2736 del target_dict[key]
2719 ProcessListFiltersInDict(target_name, tmp_dict) 2737 ProcessListFiltersInDict(target_name, tmp_dict)
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
2800 ValidateRunAsInTarget(target, target_dict, build_file) 2818 ValidateRunAsInTarget(target, target_dict, build_file)
2801 ValidateActionsInTarget(target, target_dict, build_file) 2819 ValidateActionsInTarget(target, target_dict, build_file)
2802 2820
2803 # Generators might not expect ints. Turn them into strs. 2821 # Generators might not expect ints. Turn them into strs.
2804 TurnIntIntoStrInDict(data) 2822 TurnIntIntoStrInDict(data)
2805 2823
2806 # TODO(mark): Return |data| for now because the generator needs a list of 2824 # TODO(mark): Return |data| for now because the generator needs a list of
2807 # build files that came in. In the future, maybe it should just accept 2825 # build files that came in. In the future, maybe it should just accept
2808 # a list, and not the whole data dict. 2826 # a list, and not the whole data dict.
2809 return [flat_list, targets, data] 2827 return [flat_list, targets, data]
OLDNEW
« no previous file with comments | « no previous file | test/link-dependency/gyptest-link-dependency.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698