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 2087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2098 element = extension_to_rule_name[ext] | 2098 element = extension_to_rule_name[ext] |
2099 elif ext in ['.cc', '.cpp', '.c', '.cxx']: | 2099 elif ext in ['.cc', '.cpp', '.c', '.cxx']: |
2100 group = 'compile' | 2100 group = 'compile' |
2101 element = 'ClCompile' | 2101 element = 'ClCompile' |
2102 elif ext in ['.h', '.hxx']: | 2102 elif ext in ['.h', '.hxx']: |
2103 group = 'include' | 2103 group = 'include' |
2104 element = 'ClInclude' | 2104 element = 'ClInclude' |
2105 elif ext == '.rc': | 2105 elif ext == '.rc': |
2106 group = 'resource' | 2106 group = 'resource' |
2107 element = 'ResourceCompile' | 2107 element = 'ResourceCompile' |
| 2108 elif ext == '.asm': |
| 2109 group = 'masm' |
| 2110 element = 'MASM' |
2108 elif ext == '.idl': | 2111 elif ext == '.idl': |
2109 group = 'midl' | 2112 group = 'midl' |
2110 element = 'Midl' | 2113 element = 'Midl' |
2111 elif source in rule_dependencies: | 2114 elif source in rule_dependencies: |
2112 group = 'rule_dependency' | 2115 group = 'rule_dependency' |
2113 element = 'CustomBuild' | 2116 element = 'CustomBuild' |
2114 else: | 2117 else: |
2115 group = 'none' | 2118 group = 'none' |
2116 element = 'None' | 2119 element = 'None' |
2117 return (group, element) | 2120 return (group, element) |
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3076 if '$' not in source: | 3079 if '$' not in source: |
3077 full_path = os.path.join(root_dir, source) | 3080 full_path = os.path.join(root_dir, source) |
3078 if not os.path.exists(full_path): | 3081 if not os.path.exists(full_path): |
3079 missing_sources.append(full_path) | 3082 missing_sources.append(full_path) |
3080 return missing_sources | 3083 return missing_sources |
3081 | 3084 |
3082 | 3085 |
3083 def _GetMSBuildSources(spec, sources, exclusions, rule_dependencies, | 3086 def _GetMSBuildSources(spec, sources, exclusions, rule_dependencies, |
3084 extension_to_rule_name, actions_spec, | 3087 extension_to_rule_name, actions_spec, |
3085 sources_handled_by_action, list_excluded): | 3088 sources_handled_by_action, list_excluded): |
3086 groups = ['none', 'midl', 'include', 'compile', 'resource', 'rule', | 3089 groups = ['none', 'masm', 'midl', 'include', 'compile', 'resource', 'rule', |
3087 'rule_dependency'] | 3090 'rule_dependency'] |
3088 grouped_sources = {} | 3091 grouped_sources = {} |
3089 for g in groups: | 3092 for g in groups: |
3090 grouped_sources[g] = [] | 3093 grouped_sources[g] = [] |
3091 | 3094 |
3092 _AddSources2(spec, sources, exclusions, grouped_sources, | 3095 _AddSources2(spec, sources, exclusions, grouped_sources, |
3093 rule_dependencies, extension_to_rule_name, | 3096 rule_dependencies, extension_to_rule_name, |
3094 sources_handled_by_action, list_excluded) | 3097 sources_handled_by_action, list_excluded) |
3095 sources = [] | 3098 sources = [] |
3096 for g in groups: | 3099 for g in groups: |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3241 _FinalizeMSBuildSettings(spec, configuration) | 3244 _FinalizeMSBuildSettings(spec, configuration) |
3242 | 3245 |
3243 # Add attributes to root element | 3246 # Add attributes to root element |
3244 | 3247 |
3245 import_default_section = [ | 3248 import_default_section = [ |
3246 ['Import', {'Project': r'$(VCTargetsPath)\Microsoft.Cpp.Default.props'}]] | 3249 ['Import', {'Project': r'$(VCTargetsPath)\Microsoft.Cpp.Default.props'}]] |
3247 import_cpp_props_section = [ | 3250 import_cpp_props_section = [ |
3248 ['Import', {'Project': r'$(VCTargetsPath)\Microsoft.Cpp.props'}]] | 3251 ['Import', {'Project': r'$(VCTargetsPath)\Microsoft.Cpp.props'}]] |
3249 import_cpp_targets_section = [ | 3252 import_cpp_targets_section = [ |
3250 ['Import', {'Project': r'$(VCTargetsPath)\Microsoft.Cpp.targets'}]] | 3253 ['Import', {'Project': r'$(VCTargetsPath)\Microsoft.Cpp.targets'}]] |
| 3254 import_masm_props_section = [ |
| 3255 ['Import', |
| 3256 {'Project': r'$(VCTargetsPath)\BuildCustomizations\masm.props'}]] |
| 3257 import_masm_targets_section = [ |
| 3258 ['Import', |
| 3259 {'Project': r'$(VCTargetsPath)\BuildCustomizations\masm.targets'}]] |
3251 macro_section = [['PropertyGroup', {'Label': 'UserMacros'}]] | 3260 macro_section = [['PropertyGroup', {'Label': 'UserMacros'}]] |
3252 | 3261 |
3253 content = [ | 3262 content = [ |
3254 'Project', | 3263 'Project', |
3255 {'xmlns': 'http://schemas.microsoft.com/developer/msbuild/2003', | 3264 {'xmlns': 'http://schemas.microsoft.com/developer/msbuild/2003', |
3256 'ToolsVersion': version.ProjectVersion(), | 3265 'ToolsVersion': version.ProjectVersion(), |
3257 'DefaultTargets': 'Build' | 3266 'DefaultTargets': 'Build' |
3258 }] | 3267 }] |
3259 | 3268 |
3260 content += _GetMSBuildProjectConfigurations(configurations) | 3269 content += _GetMSBuildProjectConfigurations(configurations) |
3261 content += _GetMSBuildGlobalProperties(spec, project.guid, project_file_name) | 3270 content += _GetMSBuildGlobalProperties(spec, project.guid, project_file_name) |
3262 content += import_default_section | 3271 content += import_default_section |
3263 content += _GetMSBuildConfigurationDetails(spec, project.build_file) | 3272 content += _GetMSBuildConfigurationDetails(spec, project.build_file) |
3264 if spec.get('msvs_enable_winphone'): | 3273 if spec.get('msvs_enable_winphone'): |
3265 content += _GetMSBuildLocalProperties('v120_wp81') | 3274 content += _GetMSBuildLocalProperties('v120_wp81') |
3266 else: | 3275 else: |
3267 content += _GetMSBuildLocalProperties(project.msbuild_toolset) | 3276 content += _GetMSBuildLocalProperties(project.msbuild_toolset) |
3268 content += import_cpp_props_section | 3277 content += import_cpp_props_section |
| 3278 content += import_masm_props_section |
3269 content += _GetMSBuildExtensions(props_files_of_rules) | 3279 content += _GetMSBuildExtensions(props_files_of_rules) |
3270 content += _GetMSBuildPropertySheets(configurations) | 3280 content += _GetMSBuildPropertySheets(configurations) |
3271 content += macro_section | 3281 content += macro_section |
3272 content += _GetMSBuildConfigurationGlobalProperties(spec, configurations, | 3282 content += _GetMSBuildConfigurationGlobalProperties(spec, configurations, |
3273 project.build_file) | 3283 project.build_file) |
3274 content += _GetMSBuildToolSettingsSections(spec, configurations) | 3284 content += _GetMSBuildToolSettingsSections(spec, configurations) |
3275 content += _GetMSBuildSources( | 3285 content += _GetMSBuildSources( |
3276 spec, sources, exclusions, rule_dependencies, extension_to_rule_name, | 3286 spec, sources, exclusions, rule_dependencies, extension_to_rule_name, |
3277 actions_spec, sources_handled_by_action, list_excluded) | 3287 actions_spec, sources_handled_by_action, list_excluded) |
3278 content += _GetMSBuildProjectReferences(project) | 3288 content += _GetMSBuildProjectReferences(project) |
3279 content += import_cpp_targets_section | 3289 content += import_cpp_targets_section |
| 3290 content += import_masm_targets_section |
3280 content += _GetMSBuildExtensionTargets(targets_files_of_rules) | 3291 content += _GetMSBuildExtensionTargets(targets_files_of_rules) |
3281 | 3292 |
3282 if spec.get('msvs_external_builder'): | 3293 if spec.get('msvs_external_builder'): |
3283 content += _GetMSBuildExternalBuilderTargets(spec) | 3294 content += _GetMSBuildExternalBuilderTargets(spec) |
3284 | 3295 |
3285 # TODO(jeanluc) File a bug to get rid of runas. We had in MSVS: | 3296 # TODO(jeanluc) File a bug to get rid of runas. We had in MSVS: |
3286 # has_run_as = _WriteMSVSUserFile(project.path, version, spec) | 3297 # has_run_as = _WriteMSVSUserFile(project.path, version, spec) |
3287 | 3298 |
3288 easy_xml.WriteXmlIfChanged(content, project.path, pretty=True, win32=True) | 3299 easy_xml.WriteXmlIfChanged(content, project.path, pretty=True, win32=True) |
3289 | 3300 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3405 action_spec.extend( | 3416 action_spec.extend( |
3406 # TODO(jeanluc) 'Document' for all or just if as_sources? | 3417 # TODO(jeanluc) 'Document' for all or just if as_sources? |
3407 [['FileType', 'Document'], | 3418 [['FileType', 'Document'], |
3408 ['Command', command], | 3419 ['Command', command], |
3409 ['Message', description], | 3420 ['Message', description], |
3410 ['Outputs', outputs] | 3421 ['Outputs', outputs] |
3411 ]) | 3422 ]) |
3412 if additional_inputs: | 3423 if additional_inputs: |
3413 action_spec.append(['AdditionalInputs', additional_inputs]) | 3424 action_spec.append(['AdditionalInputs', additional_inputs]) |
3414 actions_spec.append(action_spec) | 3425 actions_spec.append(action_spec) |
OLD | NEW |