| 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 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 990 build_file: The path of the gyp file. | 990 build_file: The path of the gyp file. |
| 991 Returns: | 991 Returns: |
| 992 An integer, the configuration type. | 992 An integer, the configuration type. |
| 993 """ | 993 """ |
| 994 try: | 994 try: |
| 995 config_type = { | 995 config_type = { |
| 996 'executable': '1', # .exe | 996 'executable': '1', # .exe |
| 997 'shared_library': '2', # .dll | 997 'shared_library': '2', # .dll |
| 998 'loadable_module': '2', # .dll | 998 'loadable_module': '2', # .dll |
| 999 'static_library': '4', # .lib | 999 'static_library': '4', # .lib |
| 1000 'standalone_static_library': '4', # .lib |
| 1000 'none': '10', # Utility type | 1001 'none': '10', # Utility type |
| 1001 }[spec['type']] | 1002 }[spec['type']] |
| 1002 except KeyError: | 1003 except KeyError: |
| 1003 if spec.get('type'): | 1004 if spec.get('type'): |
| 1004 raise Exception('Target type %s is not a valid target type for ' | 1005 raise Exception('Target type %s is not a valid target type for ' |
| 1005 'target %s in %s.' % | 1006 'target %s in %s.' % |
| 1006 (spec['type'], spec['target_name'], build_file)) | 1007 (spec['type'], spec['target_name'], build_file)) |
| 1007 else: | 1008 else: |
| 1008 raise Exception('Missing type field for target %s in %s.' % | 1009 raise Exception('Missing type field for target %s in %s.' % |
| 1009 (spec['target_name'], build_file)) | 1010 (spec['target_name'], build_file)) |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1146 """ | 1147 """ |
| 1147 # Select a name for the output file. | 1148 # Select a name for the output file. |
| 1148 out_file = '' | 1149 out_file = '' |
| 1149 vc_tool = '' | 1150 vc_tool = '' |
| 1150 msbuild_tool = '' | 1151 msbuild_tool = '' |
| 1151 output_file_map = { | 1152 output_file_map = { |
| 1152 'executable': ('VCLinkerTool', 'Link', '$(OutDir)', '.exe'), | 1153 'executable': ('VCLinkerTool', 'Link', '$(OutDir)', '.exe'), |
| 1153 'shared_library': ('VCLinkerTool', 'Link', '$(OutDir)', '.dll'), | 1154 'shared_library': ('VCLinkerTool', 'Link', '$(OutDir)', '.dll'), |
| 1154 'loadable_module': ('VCLinkerTool', 'Link', '$(OutDir)', '.dll'), | 1155 'loadable_module': ('VCLinkerTool', 'Link', '$(OutDir)', '.dll'), |
| 1155 'static_library': ('VCLibrarianTool', 'Lib', '$(OutDir)lib\\', '.lib'), | 1156 'static_library': ('VCLibrarianTool', 'Lib', '$(OutDir)lib\\', '.lib'), |
| 1157 'standalone_static_library': ('VCLibrarianTool', 'Lib', '$(OutDir)lib\\', |
| 1158 '.lib'), |
| 1156 } | 1159 } |
| 1157 output_file_props = output_file_map.get(spec['type']) | 1160 output_file_props = output_file_map.get(spec['type']) |
| 1158 if output_file_props and int(spec.get('msvs_auto_output_file', 1)): | 1161 if output_file_props and int(spec.get('msvs_auto_output_file', 1)): |
| 1159 vc_tool, msbuild_tool, out_dir, suffix = output_file_props | 1162 vc_tool, msbuild_tool, out_dir, suffix = output_file_props |
| 1160 out_dir = spec.get('product_dir', out_dir) | 1163 out_dir = spec.get('product_dir', out_dir) |
| 1161 product_extension = spec.get('product_extension') | 1164 product_extension = spec.get('product_extension') |
| 1162 if product_extension: | 1165 if product_extension: |
| 1163 suffix = '.' + product_extension | 1166 suffix = '.' + product_extension |
| 1164 elif msbuild: | 1167 elif msbuild: |
| 1165 suffix = '$(TargetExt)' | 1168 suffix = '$(TargetExt)' |
| (...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2611 target_name = prefix + product_name | 2614 target_name = prefix + product_name |
| 2612 msbuild_attributes['TargetName'] = target_name | 2615 msbuild_attributes['TargetName'] = target_name |
| 2613 | 2616 |
| 2614 # Make sure that 'TargetPath' matches 'Lib.OutputFile' or 'Link.OutputFile' | 2617 # Make sure that 'TargetPath' matches 'Lib.OutputFile' or 'Link.OutputFile' |
| 2615 # (depending on the tool used) to avoid MSB8012 warning. | 2618 # (depending on the tool used) to avoid MSB8012 warning. |
| 2616 msbuild_tool_map = { | 2619 msbuild_tool_map = { |
| 2617 'executable': 'Link', | 2620 'executable': 'Link', |
| 2618 'shared_library': 'Link', | 2621 'shared_library': 'Link', |
| 2619 'loadable_module': 'Link', | 2622 'loadable_module': 'Link', |
| 2620 'static_library': 'Lib', | 2623 'static_library': 'Lib', |
| 2624 'standalone_static_library': 'Lib', |
| 2621 } | 2625 } |
| 2622 msbuild_tool = msbuild_tool_map.get(spec['type']) | 2626 msbuild_tool = msbuild_tool_map.get(spec['type']) |
| 2623 if msbuild_tool: | 2627 if msbuild_tool: |
| 2624 msbuild_settings = config['finalized_msbuild_settings'] | 2628 msbuild_settings = config['finalized_msbuild_settings'] |
| 2625 out_file = msbuild_settings[msbuild_tool].get('OutputFile') | 2629 out_file = msbuild_settings[msbuild_tool].get('OutputFile') |
| 2626 if out_file: | 2630 if out_file: |
| 2627 msbuild_attributes['TargetPath'] = _FixPath(out_file) | 2631 msbuild_attributes['TargetPath'] = _FixPath(out_file) |
| 2628 | 2632 |
| 2629 return msbuild_attributes | 2633 return msbuild_attributes |
| 2630 | 2634 |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3158 action_spec.extend( | 3162 action_spec.extend( |
| 3159 # TODO(jeanluc) 'Document' for all or just if as_sources? | 3163 # TODO(jeanluc) 'Document' for all or just if as_sources? |
| 3160 [['FileType', 'Document'], | 3164 [['FileType', 'Document'], |
| 3161 ['Command', command], | 3165 ['Command', command], |
| 3162 ['Message', description], | 3166 ['Message', description], |
| 3163 ['Outputs', outputs] | 3167 ['Outputs', outputs] |
| 3164 ]) | 3168 ]) |
| 3165 if additional_inputs: | 3169 if additional_inputs: |
| 3166 action_spec.append(['AdditionalInputs', additional_inputs]) | 3170 action_spec.append(['AdditionalInputs', additional_inputs]) |
| 3167 actions_spec.append(action_spec) | 3171 actions_spec.append(action_spec) |
| OLD | NEW |