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 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 13 matching lines...) Expand all Loading... | |
24 # contains lowercase hex letters, MSVS will be fine. However, | 24 # contains lowercase hex letters, MSVS will be fine. However, |
25 # IncrediBuild BuildConsole will parse the solution file, but then | 25 # IncrediBuild BuildConsole will parse the solution file, but then |
26 # silently skip building the target causing hard to track down errors. | 26 # silently skip building the target causing hard to track down errors. |
27 # Note that this only happens with the BuildConsole, and does not occur | 27 # Note that this only happens with the BuildConsole, and does not occur |
28 # if IncrediBuild is executed from inside Visual Studio. This regex | 28 # if IncrediBuild is executed from inside Visual Studio. This regex |
29 # validates that the string looks like a GUID with all uppercase hex | 29 # validates that the string looks like a GUID with all uppercase hex |
30 # letters. | 30 # letters. |
31 VALID_MSVS_GUID_CHARS = re.compile('^[A-F0-9\-]+$') | 31 VALID_MSVS_GUID_CHARS = re.compile('^[A-F0-9\-]+$') |
32 | 32 |
33 | 33 |
34 # Regex for msvs variable references. | |
35 MSVS_VARIABLE_REFERENCE = re.compile('\$\(([a-zA-Z_][a-zA-Z0-9_]*)\)') | |
36 | |
37 | |
34 generator_default_variables = { | 38 generator_default_variables = { |
35 'EXECUTABLE_PREFIX': '', | 39 'EXECUTABLE_PREFIX': '', |
36 'EXECUTABLE_SUFFIX': '.exe', | 40 'EXECUTABLE_SUFFIX': '.exe', |
37 'STATIC_LIB_PREFIX': '', | 41 'STATIC_LIB_PREFIX': '', |
38 'SHARED_LIB_PREFIX': '', | 42 'SHARED_LIB_PREFIX': '', |
39 'STATIC_LIB_SUFFIX': '.lib', | 43 'STATIC_LIB_SUFFIX': '.lib', |
40 'SHARED_LIB_SUFFIX': '.dll', | 44 'SHARED_LIB_SUFFIX': '.dll', |
41 'INTERMEDIATE_DIR': '$(IntDir)', | 45 'INTERMEDIATE_DIR': '$(IntDir)', |
42 'SHARED_INTERMEDIATE_DIR': '$(OutDir)/obj/global_intermediate', | 46 'SHARED_INTERMEDIATE_DIR': '$(OutDir)/obj/global_intermediate', |
43 'OS': 'win', | 47 'OS': 'win', |
(...skipping 2598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2642 spec: The target project dict. | 2646 spec: The target project dict. |
2643 label: An optional label for the PropertyGroup. | 2647 label: An optional label for the PropertyGroup. |
2644 properties: The dictionary to be converted. The key is the name of the | 2648 properties: The dictionary to be converted. The key is the name of the |
2645 property. The value is itself a dictionary; its key is the value and | 2649 property. The value is itself a dictionary; its key is the value and |
2646 the value a list of condition for which this value is true. | 2650 the value a list of condition for which this value is true. |
2647 """ | 2651 """ |
2648 group = ['PropertyGroup'] | 2652 group = ['PropertyGroup'] |
2649 if label: | 2653 if label: |
2650 group.append({'Label': label}) | 2654 group.append({'Label': label}) |
2651 num_configurations = len(spec['configurations']) | 2655 num_configurations = len(spec['configurations']) |
2652 for name, values in sorted(properties.iteritems()): | 2656 def GetEdges(node): |
2657 edges = set() | |
2658 for value in sorted(properties[node].keys()): | |
2659 edges.update(set([v for v in MSVS_VARIABLE_REFERENCE.findall(value) | |
2660 if v in properties and v != node])) | |
gab
2012/05/10 13:57:07
It took me a little while to figure out how this w
bradn
2012/05/10 20:17:56
Done
| |
2661 return edges | |
2662 properties_ordered = gyp.common.TopologicallySorted( | |
2663 properties.keys(), GetEdges) | |
2664 properties_ordered.reverse() | |
Nico
2012/05/10 19:20:23
Here too you're reversing twice
bradn
2012/05/10 20:17:56
So I've moved to normal topological order everywhe
| |
2665 for name in properties_ordered: | |
2666 values = properties[name] | |
2653 for value, conditions in sorted(values.iteritems()): | 2667 for value, conditions in sorted(values.iteritems()): |
2654 if len(conditions) == num_configurations: | 2668 if len(conditions) == num_configurations: |
2655 # If the value is the same all configurations, | 2669 # If the value is the same all configurations, |
2656 # just add one unconditional entry. | 2670 # just add one unconditional entry. |
2657 group.append([name, value]) | 2671 group.append([name, value]) |
2658 else: | 2672 else: |
2659 for condition in conditions: | 2673 for condition in conditions: |
2660 group.append([name, {'Condition': condition}, value]) | 2674 group.append([name, {'Condition': condition}, value]) |
2661 return [group] | 2675 return [group] |
2662 | 2676 |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3064 action_spec.extend( | 3078 action_spec.extend( |
3065 # TODO(jeanluc) 'Document' for all or just if as_sources? | 3079 # TODO(jeanluc) 'Document' for all or just if as_sources? |
3066 [['FileType', 'Document'], | 3080 [['FileType', 'Document'], |
3067 ['Command', command], | 3081 ['Command', command], |
3068 ['Message', description], | 3082 ['Message', description], |
3069 ['Outputs', outputs] | 3083 ['Outputs', outputs] |
3070 ]) | 3084 ]) |
3071 if additional_inputs: | 3085 if additional_inputs: |
3072 action_spec.append(['AdditionalInputs', additional_inputs]) | 3086 action_spec.append(['AdditionalInputs', additional_inputs]) |
3073 actions_spec.append(action_spec) | 3087 actions_spec.append(action_spec) |
OLD | NEW |