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