OLD | NEW |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 # Copyright (c) 2011 Google Inc. All rights reserved. | 3 # Copyright (c) 2011 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 import ntpath | 7 import ntpath |
8 import posixpath | 8 import posixpath |
9 import os | 9 import os |
10 import re | 10 import re |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
281 mcs = rule.get('msvs_cygwin_shell') | 281 mcs = rule.get('msvs_cygwin_shell') |
282 if mcs is None: | 282 if mcs is None: |
283 mcs = int(spec.get('msvs_cygwin_shell', 1)) | 283 mcs = int(spec.get('msvs_cygwin_shell', 1)) |
284 elif isinstance(mcs, str): | 284 elif isinstance(mcs, str): |
285 mcs = int(mcs) | 285 mcs = int(mcs) |
286 quote_cmd = int(rule.get('msvs_quote_cmd', 1)) | 286 quote_cmd = int(rule.get('msvs_quote_cmd', 1)) |
287 return _PrepareActionRaw(spec, rule['action'], mcs, | 287 return _PrepareActionRaw(spec, rule['action'], mcs, |
288 has_input_path, quote_cmd) | 288 has_input_path, quote_cmd) |
289 | 289 |
290 | 290 |
291 def _PickPrimaryInput(inputs): | 291 def _AddActionStep(actions_dict, inputs, outputs, description, command): |
292 # Pick second input as the primary one, unless there's only one. | 292 """Merge action into an existing list of actions. |
293 # TODO(bradnelson): this is a bit of a hack, | 293 |
294 # find something more general. | 294 Care must be taken so that actions which have overlapping inputs either don't |
295 if len(inputs) > 1: | 295 get assigned to the same input, or get collapsed into one. |
296 return inputs[1] | 296 |
297 else: | 297 Arguments: |
298 return inputs[0] | 298 actions_dict: dictionary keyed on input name, which maps to a list of |
299 dicts describing the actions attached to that input file. | |
300 inputs: list of inputs | |
301 outputs: list of outputs | |
302 description: description of the action | |
303 command: command line to execute | |
304 """ | |
305 # Require there to be at least one input (call sites will ensure this). | |
306 assert inputs | |
307 | |
308 action = { | |
309 'inputs': inputs, | |
310 'outputs': outputs, | |
311 'description': description, | |
312 'command': command, | |
313 } | |
314 | |
315 # Pick where to stick this action. Pick the slot with the least actions | |
316 # currently. | |
317 chosen_input = None | |
318 for i in inputs: | |
319 if (chosen_input is None or | |
320 len(actions_dict.get(i, [])) < len(actions_dict.get(chosen_input, []))): | |
321 chosen_input = i | |
322 assert chosen_input is not None | |
323 | |
jeanluc1
2011/02/01 02:00:08
You could have done:
chosen_input = reduce(lambda
| |
324 # Add it there. | |
325 if chosen_input not in actions_dict: | |
326 actions_dict[chosen_input] = [] | |
327 actions_dict[chosen_input].append(action) | |
299 | 328 |
300 | 329 |
301 def _AddCustomBuildToolForMSVS(p, spec, inputs, outputs, description, cmd): | 330 def _AddCustomBuildToolForMSVS(p, spec, primary_input, |
331 inputs, outputs, description, cmd): | |
302 """Add a custom build tool to execute something. | 332 """Add a custom build tool to execute something. |
303 | 333 |
304 Arguments: | 334 Arguments: |
305 p: the target project | 335 p: the target project |
306 spec: the target project dict | 336 spec: the target project dict |
337 primary_input: input file to attach the build tool to | |
307 inputs: list of inputs | 338 inputs: list of inputs |
308 outputs: list of outputs | 339 outputs: list of outputs |
309 description: description of the action | 340 description: description of the action |
310 cmd: command line to execute | 341 cmd: command line to execute |
311 """ | 342 """ |
312 inputs = [_FixPath(i) for i in inputs] | 343 inputs = [_FixPath(i) for i in inputs] |
313 outputs = [_FixPath(i) for i in outputs] | 344 outputs = [_FixPath(i) for i in outputs] |
314 tool = MSVSProject.Tool( | 345 tool = MSVSProject.Tool( |
315 'VCCustomBuildTool', { | 346 'VCCustomBuildTool', { |
316 'Description': description, | 347 'Description': description, |
317 'AdditionalDependencies': ';'.join(inputs), | 348 'AdditionalDependencies': ';'.join(inputs), |
318 'Outputs': ';'.join(outputs), | 349 'Outputs': ';'.join(outputs), |
319 'CommandLine': cmd, | 350 'CommandLine': cmd, |
320 }) | 351 }) |
321 primary_input = _PickPrimaryInput(inputs) | |
322 # Add to the properties of primary input for each config. | 352 # Add to the properties of primary input for each config. |
323 for config_name, c_data in spec['configurations'].iteritems(): | 353 for config_name, c_data in spec['configurations'].iteritems(): |
324 p.AddFileConfig(primary_input, | 354 p.AddFileConfig(_FixPath(primary_input), |
325 _ConfigFullName(config_name, c_data), tools=[tool]) | 355 _ConfigFullName(config_name, c_data), tools=[tool]) |
326 | 356 |
327 | 357 |
358 def _AddAccumulatedActions(p, spec, actions_dict): | |
359 """Add actions accumulated into an actions_dict, merging as needed. | |
360 | |
361 Arguments: | |
362 p: the target project | |
363 spec: the target project dict | |
364 actions_dict: dictionary keyed on input name, which maps to a list of | |
365 dicts describing the actions attached to that input file. | |
jeanluc1
2011/02/01 02:00:08
two more spaces?
| |
366 """ | |
367 for input in actions_dict: | |
368 inputs = set() | |
369 outputs = set() | |
370 description = '' | |
371 command = '' | |
372 for action in actions_dict[input]: | |
373 inputs.update(set(action['inputs'])) | |
374 outputs.update(set(action['outputs'])) | |
375 if description: | |
376 description += ', and also ' | |
377 description += action['description'] | |
jeanluc1
2011/02/01 02:00:08
Another option is to pass a list for description a
bradn
2011/02/01 02:55:52
Done.
| |
378 if command: | |
379 command += ' && ' | |
380 command += action['command'] | |
381 # Add the custom build step for one input file. | |
382 _AddCustomBuildToolForMSVS(p, spec, | |
383 primary_input=input, | |
384 inputs=inputs, | |
385 outputs=outputs, | |
386 description=description, | |
387 cmd=command) | |
388 | |
389 | |
328 def _RuleExpandPath(path, input_file): | 390 def _RuleExpandPath(path, input_file): |
329 """Given the input file to which a rule applied, string substitute a path. | 391 """Given the input file to which a rule applied, string substitute a path. |
330 | 392 |
331 Arguments: | 393 Arguments: |
332 path: a path to string expand | 394 path: a path to string expand |
333 input_file: the file to which the rule applied. | 395 input_file: the file to which the rule applied. |
334 Returns: | 396 Returns: |
335 The string substituted path. | 397 The string substituted path. |
336 """ | 398 """ |
337 path = path.replace('$(InputName)', | 399 path = path.replace('$(InputName)', |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
481 cmd = ['make', | 543 cmd = ['make', |
482 'OutDir=$(OutDir)', | 544 'OutDir=$(OutDir)', |
483 'IntDir=$(IntDir)', | 545 'IntDir=$(IntDir)', |
484 '-j', '${NUMBER_OF_PROCESSORS_PLUS_1}', | 546 '-j', '${NUMBER_OF_PROCESSORS_PLUS_1}', |
485 '-f', filename] | 547 '-f', filename] |
486 cmd = _PrepareActionRaw(spec, cmd, True, False, True) | 548 cmd = _PrepareActionRaw(spec, cmd, True, False, True) |
487 # TODO(bradnelson): this won't be needed if we have a better way to pick | 549 # TODO(bradnelson): this won't be needed if we have a better way to pick |
488 # the primary input. | 550 # the primary input. |
489 all_inputs = list(all_inputs) | 551 all_inputs = list(all_inputs) |
490 all_inputs.insert(1, filename) | 552 all_inputs.insert(1, filename) |
491 actions_to_add.append({ | 553 _AddActionStep(inputs=[_FixPath(i) for i in all_inputs], |
jeanluc1
2011/02/01 02:00:08
I would expect the first argument to be actions_to
bradn
2011/02/01 02:55:52
Done.
| |
492 'inputs': [_FixPath(i) for i in all_inputs], | 554 outputs=[_FixPath(i) for i in all_outputs], |
493 'outputs': [_FixPath(i) for i in all_outputs], | 555 description='Running %s' % cmd, |
494 'description': 'Running %s' % cmd, | 556 command=cmd) |
495 'cmd': cmd, | |
496 }) | |
497 | 557 |
498 | 558 |
499 def _EscapeEnvironmentVariableExpansion(s): | 559 def _EscapeEnvironmentVariableExpansion(s): |
500 """Escapes any % characters so that Windows-style environment variable | 560 """Escapes any % characters so that Windows-style environment variable |
501 expansions will leave them alone. | 561 expansions will leave them alone. |
502 See http://connect.microsoft.com/VisualStudio/feedback/details/106127/cl-d- name-text-containing-percentage-characters-doesnt-compile | 562 See http://connect.microsoft.com/VisualStudio/feedback/details/106127/cl-d- name-text-containing-percentage-characters-doesnt-compile |
503 to understand why we have to do this.""" | 563 to understand why we have to do this.""" |
504 s = s.replace('%', '%%') | 564 s = s.replace('%', '%%') |
505 return s | 565 return s |
506 | 566 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
589 | 649 |
590 # Handle rules that use a native rules file. | 650 # Handle rules that use a native rules file. |
591 if rules_native: | 651 if rules_native: |
592 _GenerateNativeRulesForMSVS(p, rules_native, output_dir, spec, options) | 652 _GenerateNativeRulesForMSVS(p, rules_native, output_dir, spec, options) |
593 | 653 |
594 # Handle external rules (non-native rules). | 654 # Handle external rules (non-native rules). |
595 if rules_external: | 655 if rules_external: |
596 _GenerateExternalRules(rules_external, output_dir, spec, | 656 _GenerateExternalRules(rules_external, output_dir, spec, |
597 sources, options, actions_to_add) | 657 sources, options, actions_to_add) |
598 _AdjustSourcesForRules(rules, sources, excluded_sources) | 658 _AdjustSourcesForRules(rules, sources, excluded_sources) |
599 | 659 |
600 | 660 |
601 def _AdjustSourcesForRules(rules, sources, excluded_sources): | 661 def _AdjustSourcesForRules(rules, sources, excluded_sources): |
602 # Add outputs generated by each rule (if applicable). | 662 # Add outputs generated by each rule (if applicable). |
603 for rule in rules: | 663 for rule in rules: |
604 # Done if not processing outputs as sources. | 664 # Done if not processing outputs as sources. |
605 if int(rule.get('process_outputs_as_sources', False)): | 665 if int(rule.get('process_outputs_as_sources', False)): |
606 # Add in the outputs from this rule. | 666 # Add in the outputs from this rule. |
607 trigger_files = _FindRuleTriggerFiles(rule, sources) | 667 trigger_files = _FindRuleTriggerFiles(rule, sources) |
608 for tf in trigger_files: | 668 for tf in trigger_files: |
609 inputs, outputs = _RuleInputsAndOutputs(rule, tf) | 669 inputs, outputs = _RuleInputsAndOutputs(rule, tf) |
610 inputs.remove(tf) | 670 inputs.remove(tf) |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
675 gyp_dir = os.path.split(project.path)[0] | 735 gyp_dir = os.path.split(project.path)[0] |
676 | 736 |
677 config_type = _GetMSVSConfigurationType(spec, project.build_file) | 737 config_type = _GetMSVSConfigurationType(spec, project.build_file) |
678 for config_name, config in spec['configurations'].iteritems(): | 738 for config_name, config in spec['configurations'].iteritems(): |
679 _AddConfigurationToMSVSProject(p, spec, config_type, config_name, config) | 739 _AddConfigurationToMSVSProject(p, spec, config_type, config_name, config) |
680 | 740 |
681 # Prepare list of sources and excluded sources. | 741 # Prepare list of sources and excluded sources. |
682 sources, excluded_sources = _PrepareListOfSources(spec, project.build_file) | 742 sources, excluded_sources = _PrepareListOfSources(spec, project.build_file) |
683 | 743 |
684 # Add rules. | 744 # Add rules. |
685 actions_to_add = [] | 745 actions_to_add = {} |
686 _GenerateRulesForMSVS(p, gyp_dir, options, spec, | 746 _GenerateRulesForMSVS(p, gyp_dir, options, spec, |
687 sources, excluded_sources, | 747 sources, excluded_sources, |
688 actions_to_add) | 748 actions_to_add) |
689 sources, excluded_sources, excluded_idl = _AdjustSourcesAndConverToFilterHiera rchy(spec, options, | 749 sources, excluded_sources, excluded_idl = ( |
690 gyp_dir, sources, excluded_sources) | 750 _AdjustSourcesAndConverToFilterHierarchy( |
751 spec, options, gyp_dir, sources, excluded_sources)) | |
691 | 752 |
692 # Add in files. | 753 # Add in files. |
693 p.AddFiles(sources) | 754 p.AddFiles(sources) |
694 | 755 |
695 # Add deferred actions to add. | |
696 for a in actions_to_add: | |
697 _AddCustomBuildToolForMSVS(p, spec, | |
698 inputs=a['inputs'], | |
699 outputs=a['outputs'], | |
700 description=a['description'], | |
701 cmd=a['cmd']) | |
702 | |
703 _ExcludeFilesFromBeingBuilt(p, spec, excluded_sources, excluded_idl) | 756 _ExcludeFilesFromBeingBuilt(p, spec, excluded_sources, excluded_idl) |
704 _AddToolFilesToMSVS(p, spec) | 757 _AddToolFilesToMSVS(p, spec) |
705 _HandlePreCompileHeaderStubs(p, spec) | 758 _HandlePreCompileHeaderStubs(p, spec) |
706 _AddActionsToMSVS(p, spec) | 759 _AddActionsToMSVS(actions_to_add, spec, project.build_file) |
760 _AddCopiesForMSVS(actions_to_add, spec) | |
707 _WriteMSVSUserFile(project.path, version, spec) | 761 _WriteMSVSUserFile(project.path, version, spec) |
708 _AddCopiesForMSVS(p, spec) | 762 |
763 # Do this after all actions have been decided. | |
764 _AddAccumulatedActions(p, spec, actions_to_add) | |
709 | 765 |
710 # Write it out. | 766 # Write it out. |
711 p.Write() | 767 p.Write() |
712 | 768 |
713 | 769 |
714 def _GetUniquePlatforms(spec): | 770 def _GetUniquePlatforms(spec): |
715 """Return the list of unique platforms for this spec, e.g ['win32', ...] | 771 """Return the list of unique platforms for this spec, e.g ['win32', ...] |
716 | 772 |
717 Arguments: | 773 Arguments: |
718 spec: The target dictionary containing the properties of the target. | 774 spec: The target dictionary containing the properties of the target. |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1029 Arguments: | 1085 Arguments: |
1030 spec: The target dictionary containing the properties of the target. | 1086 spec: The target dictionary containing the properties of the target. |
1031 build_file: Filename of the .gyp file that the vcproj file comes from. | 1087 build_file: Filename of the .gyp file that the vcproj file comes from. |
1032 Returns: | 1088 Returns: |
1033 A pair of (list of sources, list of excluded sources) | 1089 A pair of (list of sources, list of excluded sources) |
1034 """ | 1090 """ |
1035 sources = set() | 1091 sources = set() |
1036 _AddNormalizedSources(sources, spec.get('sources', [])) | 1092 _AddNormalizedSources(sources, spec.get('sources', [])) |
1037 excluded_sources = set() | 1093 excluded_sources = set() |
1038 # Add in the gyp file. | 1094 # Add in the gyp file. |
1039 gyp_file = os.path.split(build_file)[1] | 1095 gyp_file = posixpath.split(build_file)[1] |
jeanluc1
2011/02/01 02:00:08
Why posixpath?
bradn
2011/02/01 02:55:52
Previously the case where there are no inputs belo
| |
1040 sources.add(_NormalizedSource(gyp_file)) | 1096 sources.add(_NormalizedSource(gyp_file)) |
1041 # Add in 'action' inputs and outputs. | 1097 # Add in 'action' inputs and outputs. |
1042 for a in spec.get('actions', []): | 1098 for a in spec.get('actions', []): |
1043 inputs = a.get('inputs') | 1099 inputs = a.get('inputs', []) |
1044 if not inputs: | |
1045 # This is an action with no inputs. Make the primary input | |
1046 # be the .gyp file itself so Visual Studio has a place to | |
1047 # hang the custom build rule. | |
1048 inputs = [gyp_file] | |
1049 a['inputs'] = inputs | |
1050 inputs = [_NormalizedSource(i) for i in inputs] | 1100 inputs = [_NormalizedSource(i) for i in inputs] |
1051 primary_input = _PickPrimaryInput(inputs) | |
1052 inputs = set(inputs) | 1101 inputs = set(inputs) |
1053 sources.update(inputs) | 1102 sources.update(inputs) |
1054 inputs.remove(primary_input) | |
1055 excluded_sources.update(inputs) | |
1056 if int(a.get('process_outputs_as_sources', False)): | 1103 if int(a.get('process_outputs_as_sources', False)): |
1057 _AddNormalizedSources(sources, a.get('outputs', [])) | 1104 _AddNormalizedSources(sources, a.get('outputs', [])) |
1058 # Add in 'copies' inputs and outputs. | 1105 # Add in 'copies' inputs and outputs. |
1059 for cpy in spec.get('copies', []): | 1106 for cpy in spec.get('copies', []): |
1060 _AddNormalizedSources(sources, cpy.get('files', [])) | 1107 _AddNormalizedSources(sources, cpy.get('files', [])) |
1061 return (sources, excluded_sources) | 1108 return (sources, excluded_sources) |
1062 | 1109 |
1063 | 1110 |
1064 def _AdjustSourcesAndConverToFilterHierarchy(spec, options, gyp_dir, sources, ex cluded_sources): | 1111 def _AdjustSourcesAndConverToFilterHierarchy(spec, options, gyp_dir, sources, ex cluded_sources): |
1065 """Adjusts the list of sources and excluded sources. | 1112 """Adjusts the list of sources and excluded sources. |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1175 source = config.get('msvs_precompiled_source') | 1222 source = config.get('msvs_precompiled_source') |
1176 if source: | 1223 if source: |
1177 source = _FixPath(source) | 1224 source = _FixPath(source) |
1178 # UsePrecompiledHeader=1 for if using precompiled headers. | 1225 # UsePrecompiledHeader=1 for if using precompiled headers. |
1179 tool = MSVSProject.Tool('VCCLCompilerTool', | 1226 tool = MSVSProject.Tool('VCCLCompilerTool', |
1180 {'UsePrecompiledHeader': '1'}) | 1227 {'UsePrecompiledHeader': '1'}) |
1181 p.AddFileConfig(source, _ConfigFullName(config_name, config), | 1228 p.AddFileConfig(source, _ConfigFullName(config_name, config), |
1182 {}, tools=[tool]) | 1229 {}, tools=[tool]) |
1183 | 1230 |
1184 | 1231 |
1185 def _AddActionsToMSVS(p, spec): | 1232 def _AddActionsToMSVS(actions_to_add, spec, gyp_file): |
1186 # Add actions. | 1233 # Add actions. |
1187 actions = spec.get('actions', []) | 1234 actions = spec.get('actions', []) |
1188 for a in actions: | 1235 for a in actions: |
1189 cmd = _PrepareAction(spec, a, has_input_path=False) | 1236 cmd = _PrepareAction(spec, a, has_input_path=False) |
1190 _AddCustomBuildToolForMSVS(p, spec, | 1237 # Attach actions to the gyp file if nothing else is there. |
jeanluc1
2011/02/01 02:00:08
When would this happen? What does it mean?
bradn
2011/02/01 02:55:52
We have a few test cases where actions have no inp
| |
1191 inputs=a.get('inputs', []), | 1238 inputs = a.get('inputs') |
1192 outputs=a.get('outputs', []), | 1239 if not inputs: |
1193 description=a.get('message', a['action_name']), | 1240 inputs = [gyp_file] |
jeanluc1
2011/02/01 02:00:08
Could have been:
inputs = a.get('inputs') or [gyp_
bradn
2011/02/01 02:55:52
Duh...
Done.
| |
1194 cmd=cmd) | 1241 # Add the action. |
1242 _AddActionStep(actions_to_add, | |
1243 inputs=inputs, | |
1244 outputs=a.get('outputs', []), | |
1245 description=a.get('message', a['action_name']), | |
1246 command=cmd) | |
1195 | 1247 |
1196 | 1248 |
1197 def _WriteMSVSUserFile(project_path, version, spec): | 1249 def _WriteMSVSUserFile(project_path, version, spec): |
1198 # Add run_as and test targets. | 1250 # Add run_as and test targets. |
1199 if 'run_as' in spec: | 1251 if 'run_as' in spec: |
1200 run_as = spec['run_as'] | 1252 run_as = spec['run_as'] |
1201 action = run_as.get('action', []) | 1253 action = run_as.get('action', []) |
1202 environment = run_as.get('environment', []) | 1254 environment = run_as.get('environment', []) |
1203 working_directory = run_as.get('working_directory', '.') | 1255 working_directory = run_as.get('working_directory', '.') |
1204 elif int(spec.get('test', 0)): | 1256 elif int(spec.get('test', 0)): |
1205 action = ['$(TargetPath)', '--gtest_print_time'] | 1257 action = ['$(TargetPath)', '--gtest_print_time'] |
1206 environment = [] | 1258 environment = [] |
1207 working_directory = '.' | 1259 working_directory = '.' |
1208 else: | 1260 else: |
1209 return # Nothing to add | 1261 return # Nothing to add |
1210 # Write out the user file. | 1262 # Write out the user file. |
1211 user_file = _CreateMSVSUserFile(project_path, version, spec) | 1263 user_file = _CreateMSVSUserFile(project_path, version, spec) |
1212 for config_name, c_data in spec['configurations'].iteritems(): | 1264 for config_name, c_data in spec['configurations'].iteritems(): |
1213 user_file.AddDebugSettings(_ConfigFullName(config_name, c_data), | 1265 user_file.AddDebugSettings(_ConfigFullName(config_name, c_data), |
1214 action, environment, working_directory) | 1266 action, environment, working_directory) |
1215 user_file.Write() | 1267 user_file.Write() |
1216 | 1268 |
1217 | 1269 |
1218 def _AddCopiesForMSVS(p, spec): | 1270 def _AddCopiesForMSVS(actions_to_add, spec): |
1219 copies = _GetCopies(spec) | 1271 copies = _GetCopies(spec) |
1220 for inputs, outputs, cmd, description in copies: | 1272 for inputs, outputs, cmd, description in copies: |
1221 _AddCustomBuildToolForMSVS(p, spec, inputs=inputs, outputs=outputs, | 1273 _AddActionStep(actions_to_add, inputs=inputs, outputs=outputs, |
1222 description=description, cmd=cmd) | 1274 description=description, command=cmd) |
1223 | 1275 |
1224 | 1276 |
1225 def _GetCopies(spec): | 1277 def _GetCopies(spec): |
1226 copies = [] | 1278 copies = [] |
1227 # Add copies. | 1279 # Add copies. |
1228 for cpy in spec.get('copies', []): | 1280 for cpy in spec.get('copies', []): |
1229 for src in cpy.get('files', []): | 1281 for src in cpy.get('files', []): |
1230 dst = os.path.join(cpy['destination'], os.path.basename(src)) | 1282 dst = os.path.join(cpy['destination'], os.path.basename(src)) |
1231 # _AddCustomBuildToolForMSVS() will call _FixPath() on the inputs and | 1283 # _AddCustomBuildToolForMSVS() will call _FixPath() on the inputs and |
1232 # outputs, so do the same for our generated command line. | 1284 # outputs, so do the same for our generated command line. |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1429 configs = set() | 1481 configs = set() |
1430 for qualified_target in target_list: | 1482 for qualified_target in target_list: |
1431 spec = target_dicts[qualified_target] | 1483 spec = target_dicts[qualified_target] |
1432 for config_name, config in spec['configurations'].iteritems(): | 1484 for config_name, config in spec['configurations'].iteritems(): |
1433 configs.add(_ConfigFullName(config_name, config)) | 1485 configs.add(_ConfigFullName(config_name, config)) |
1434 configs = list(configs) | 1486 configs = list(configs) |
1435 | 1487 |
1436 # Figure out all the projects that will be generated and their guids | 1488 # Figure out all the projects that will be generated and their guids |
1437 project_objects = _CreateProjectObjects(target_list, target_dicts, options, | 1489 project_objects = _CreateProjectObjects(target_list, target_dicts, options, |
1438 msvs_version) | 1490 msvs_version) |
1439 | 1491 |
1440 # Generate each project. | 1492 # Generate each project. |
1441 for project in project_objects.values(): | 1493 for project in project_objects.values(): |
1442 fixpath_prefix = project.fixpath_prefix | 1494 fixpath_prefix = project.fixpath_prefix |
1443 _GenerateProject(project, options, msvs_version) | 1495 _GenerateProject(project, options, msvs_version) |
1444 fixpath_prefix = None | 1496 fixpath_prefix = None |
1445 | 1497 |
1446 for build_file in data.keys(): | 1498 for build_file in data.keys(): |
1447 # Validate build_file extension | 1499 # Validate build_file extension |
1448 if build_file[-4:] != '.gyp': | 1500 if build_file[-4:] != '.gyp': |
1449 continue | 1501 continue |
1450 sln_path = build_file[:-4] + options.suffix + '.sln' | 1502 sln_path = build_file[:-4] + options.suffix + '.sln' |
1451 if options.generator_output: | 1503 if options.generator_output: |
1452 sln_path = os.path.join(options.generator_output, sln_path) | 1504 sln_path = os.path.join(options.generator_output, sln_path) |
1453 # Get projects in the solution, and their dependents. | 1505 # Get projects in the solution, and their dependents. |
1454 sln_projects = gyp.common.BuildFileTargets(target_list, build_file) | 1506 sln_projects = gyp.common.BuildFileTargets(target_list, build_file) |
1455 sln_projects += gyp.common.DeepDependencyTargets(target_dicts, sln_projects) | 1507 sln_projects += gyp.common.DeepDependencyTargets(target_dicts, sln_projects) |
1456 # Create folder hierarchy. | 1508 # Create folder hierarchy. |
1457 root_entries = _GatherSolutionFolders( | 1509 root_entries = _GatherSolutionFolders( |
1458 sln_projects, project_objects, flat=msvs_version.FlatSolution()) | 1510 sln_projects, project_objects, flat=msvs_version.FlatSolution()) |
1459 # Create solution. | 1511 # Create solution. |
1460 sln = MSVSNew.MSVSSolution(sln_path, | 1512 sln = MSVSNew.MSVSSolution(sln_path, |
1461 entries=root_entries, | 1513 entries=root_entries, |
1462 variants=configs, | 1514 variants=configs, |
1463 websiteProperties=False, | 1515 websiteProperties=False, |
1464 version=msvs_version) | 1516 version=msvs_version) |
1465 sln.Write() | 1517 sln.Write() |
OLD | NEW |