Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2009 Google Inc. All rights reserved. | 3 # Copyright (c) 2009 Google Inc. 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 copy import deepcopy | |
| 7 import ntpath | 8 import ntpath |
| 9 import os | |
| 8 import posixpath | 10 import posixpath |
| 9 import os | |
| 10 import re | 11 import re |
| 11 import subprocess | 12 import subprocess |
| 12 import sys | 13 import sys |
| 14 import uuid | |
| 13 | 15 |
| 14 import gyp.MSVSNew as MSVSNew | 16 import gyp.MSVSNew as MSVSNew |
| 15 import gyp.MSVSProject as MSVSProject | 17 import gyp.MSVSProject as MSVSProject |
| 16 import gyp.MSVSToolFile as MSVSToolFile | 18 import gyp.MSVSToolFile as MSVSToolFile |
| 17 import gyp.MSVSUserFile as MSVSUserFile | 19 import gyp.MSVSUserFile as MSVSUserFile |
| 18 import gyp.MSVSVersion as MSVSVersion | 20 import gyp.MSVSVersion as MSVSVersion |
| 19 import gyp.common | 21 import gyp.common |
| 20 | 22 |
| 21 | 23 |
| 22 # Regular expression for validating Visual Studio GUIDs. If the GUID | 24 # Regular expression for validating Visual Studio GUIDs. If the GUID |
| (...skipping 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1154 | 1156 |
| 1155 # Prepare the set of configurations. | 1157 # Prepare the set of configurations. |
| 1156 configs = set() | 1158 configs = set() |
| 1157 for qualified_target in target_list: | 1159 for qualified_target in target_list: |
| 1158 build_file = gyp.common.BuildFile(qualified_target) | 1160 build_file = gyp.common.BuildFile(qualified_target) |
| 1159 spec = target_dicts[qualified_target] | 1161 spec = target_dicts[qualified_target] |
| 1160 for config_name, c in spec['configurations'].iteritems(): | 1162 for config_name, c in spec['configurations'].iteritems(): |
| 1161 configs.add(_ConfigFullName(config_name, c)) | 1163 configs.add(_ConfigFullName(config_name, c)) |
| 1162 configs = list(configs) | 1164 configs = list(configs) |
| 1163 | 1165 |
| 1166 # MSVS has some "issues" with checking dependencies for the "Compile | |
| 1167 # sources" step with any source files/headers generated by actions/rules. | |
| 1168 # To work around this, if a target is building anything directly (not | |
| 1169 # type "none"), then a second target as used to run the GYP actions/rules | |
| 1170 # and is made a dependency of this target. This way the work is done | |
| 1171 # before the dependency checks for what should be recompiled. | |
| 1172 new_target_list = [] | |
| 1173 for qualified_target in target_list: | |
| 1174 spec = target_dicts[qualified_target] | |
| 1175 spec_actions = spec.get('actions', []) | |
| 1176 spec_rules = spec.get('rules', []) | |
| 1177 if spec['type'] != 'none' and (spec_actions or spec_rules): | |
| 1178 [build_file, target, toolset] = gyp.common.ParseQualifiedTarget( | |
| 1179 qualified_target) | |
| 1180 new_target = "%s:%s_prebuilt" % (build_file, target) | |
| 1181 if toolset: | |
| 1182 new_target += "#%s" % (toolset) | |
| 1183 target_dicts[new_target] = deepcopy(target_dicts[qualified_target]) | |
|
M-A Ruel
2010/07/03 14:04:55
I'd like it to check if new_target in target_dicts
| |
| 1184 if spec.has_key('dependencies'): | |
| 1185 target_dicts[new_target]['dependencies'].append(new_target) | |
| 1186 else: | |
| 1187 target_dicts[new_target]['dependencies'] = [new_target] | |
| 1188 default_config = target_dicts[new_target]['configurations'][ | |
| 1189 target_dicts[new_target]['default_configuration']] | |
| 1190 default_config['msvs_guid'] = str(uuid.uuid4()).upper() | |
| 1191 new_target_list.append(new_target) | |
| 1192 new_target_list.append(qualified_target) | |
| 1193 | |
| 1194 target_list = new_target_list | |
| 1195 | |
| 1164 # Generate each project. | 1196 # Generate each project. |
| 1165 projects = {} | 1197 projects = {} |
| 1166 for qualified_target in target_list: | 1198 for qualified_target in target_list: |
| 1167 build_file = gyp.common.BuildFile(qualified_target) | 1199 build_file = gyp.common.BuildFile(qualified_target) |
| 1168 spec = target_dicts[qualified_target] | 1200 spec = target_dicts[qualified_target] |
| 1169 if spec['toolset'] != 'target': | 1201 if spec['toolset'] != 'target': |
| 1170 raise Exception( | 1202 raise Exception( |
| 1171 'Multiple toolsets not supported in msvs build (target %s)' % | 1203 'Multiple toolsets not supported in msvs build (target %s)' % |
| 1172 qualified_target) | 1204 qualified_target) |
| 1173 default_config = spec['configurations'][spec['default_configuration']] | 1205 default_config = spec['configurations'][spec['default_configuration']] |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1207 # Create folder hierarchy. | 1239 # Create folder hierarchy. |
| 1208 root_entries = _GatherSolutionFolders( | 1240 root_entries = _GatherSolutionFolders( |
| 1209 project_objs, flat=msvs_version.FlatSolution()) | 1241 project_objs, flat=msvs_version.FlatSolution()) |
| 1210 # Create solution. | 1242 # Create solution. |
| 1211 sln = MSVSNew.MSVSSolution(sln_path, | 1243 sln = MSVSNew.MSVSSolution(sln_path, |
| 1212 entries=root_entries, | 1244 entries=root_entries, |
| 1213 variants=configs, | 1245 variants=configs, |
| 1214 websiteProperties=False, | 1246 websiteProperties=False, |
| 1215 version=msvs_version) | 1247 version=msvs_version) |
| 1216 sln.Write() | 1248 sln.Write() |
| OLD | NEW |