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