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

Side by Side Diff: pylib/gyp/generator/msvs.py

Issue 10378042: Correct the order in which OutputDirectory and IntermediateDirectory are defined. (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: Created 8 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 | « pylib/gyp/common_test.py ('k') | pylib/gyp/xcode_emulation.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 import copy 5 import copy
6 import ntpath 6 import ntpath
7 import os 7 import os
8 import posixpath 8 import posixpath
9 import re 9 import re
10 import subprocess 10 import subprocess
(...skipping 2628 matching lines...) Expand 10 before | Expand all | Expand 10 after
2639 """ 2639 """
2640 if name not in properties: 2640 if name not in properties:
2641 properties[name] = {} 2641 properties[name] = {}
2642 values = properties[name] 2642 values = properties[name]
2643 if value not in values: 2643 if value not in values:
2644 values[value] = [] 2644 values[value] = []
2645 conditions = values[value] 2645 conditions = values[value]
2646 conditions.append(condition) 2646 conditions.append(condition)
2647 2647
2648 2648
2649 # Regex for msvs variable references ( i.e. $(FOO) ).
2650 MSVS_VARIABLE_REFERENCE = re.compile('\$\(([a-zA-Z_][a-zA-Z0-9_]*)\)')
2651
2652
2649 def _GetMSBuildPropertyGroup(spec, label, properties): 2653 def _GetMSBuildPropertyGroup(spec, label, properties):
2650 """Returns a PropertyGroup definition for the specified properties. 2654 """Returns a PropertyGroup definition for the specified properties.
2651 2655
2652 Arguments: 2656 Arguments:
2653 spec: The target project dict. 2657 spec: The target project dict.
2654 label: An optional label for the PropertyGroup. 2658 label: An optional label for the PropertyGroup.
2655 properties: The dictionary to be converted. The key is the name of the 2659 properties: The dictionary to be converted. The key is the name of the
2656 property. The value is itself a dictionary; its key is the value and 2660 property. The value is itself a dictionary; its key is the value and
2657 the value a list of condition for which this value is true. 2661 the value a list of condition for which this value is true.
2658 """ 2662 """
2659 group = ['PropertyGroup'] 2663 group = ['PropertyGroup']
2660 if label: 2664 if label:
2661 group.append({'Label': label}) 2665 group.append({'Label': label})
2662 num_configurations = len(spec['configurations']) 2666 num_configurations = len(spec['configurations'])
2663 for name, values in sorted(properties.iteritems()): 2667 def GetEdges(node):
2668 # Use a definition of edges such that user_of_variable -> used_varible.
2669 # This happens to be easier in this case, since a variable's
2670 # definition contains all variables it references in a single string.
2671 edges = set()
2672 for value in sorted(properties[node].keys()):
2673 # Add to edges all $(...) references to variables.
2674 #
2675 # Variable references that refer to names not in properties are excluded
2676 # These can exist for instance to refer built in definitions like
2677 # $(SolutionDir).
2678 #
2679 # Self references are ignored. Self reference is used in a few places to
2680 # append to the default value. I.e. PATH=$(PATH);other_path
2681 edges.update(set([v for v in MSVS_VARIABLE_REFERENCE.findall(value)
2682 if v in properties and v != node]))
2683 return edges
2684 properties_ordered = gyp.common.TopologicallySorted(
2685 properties.keys(), GetEdges)
2686 # Walk properties in the reverse of a topological sort on
2687 # user_of_variable -> used_variable as this ensures variables are
2688 # defined before they are used.
2689 # NOTE: reverse(topsort(DAG)) = topsort(reverse_edges(DAG))
2690 for name in reversed(properties_ordered):
2691 values = properties[name]
2664 for value, conditions in sorted(values.iteritems()): 2692 for value, conditions in sorted(values.iteritems()):
2665 if len(conditions) == num_configurations: 2693 if len(conditions) == num_configurations:
2666 # If the value is the same all configurations, 2694 # If the value is the same all configurations,
2667 # just add one unconditional entry. 2695 # just add one unconditional entry.
2668 group.append([name, value]) 2696 group.append([name, value])
2669 else: 2697 else:
2670 for condition in conditions: 2698 for condition in conditions:
2671 group.append([name, {'Condition': condition}, value]) 2699 group.append([name, {'Condition': condition}, value])
2672 return [group] 2700 return [group]
2673 2701
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
3075 action_spec.extend( 3103 action_spec.extend(
3076 # TODO(jeanluc) 'Document' for all or just if as_sources? 3104 # TODO(jeanluc) 'Document' for all or just if as_sources?
3077 [['FileType', 'Document'], 3105 [['FileType', 'Document'],
3078 ['Command', command], 3106 ['Command', command],
3079 ['Message', description], 3107 ['Message', description],
3080 ['Outputs', outputs] 3108 ['Outputs', outputs]
3081 ]) 3109 ])
3082 if additional_inputs: 3110 if additional_inputs:
3083 action_spec.append(['AdditionalInputs', additional_inputs]) 3111 action_spec.append(['AdditionalInputs', additional_inputs])
3084 actions_spec.append(action_spec) 3112 actions_spec.append(action_spec)
OLDNEW
« no previous file with comments | « pylib/gyp/common_test.py ('k') | pylib/gyp/xcode_emulation.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698