Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(641)

Side by Side Diff: pylib/gyp/generator/msvs.py

Issue 9430057: Revert r1228. (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pylib/gyp/MSVSNew.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 guid = default_config.get('msvs_guid') 826 guid = default_config.get('msvs_guid')
827 if guid: 827 if guid:
828 if VALID_MSVS_GUID_CHARS.match(guid) is None: 828 if VALID_MSVS_GUID_CHARS.match(guid) is None:
829 raise ValueError('Invalid MSVS guid: "%s". Must match regex: "%s".' % 829 raise ValueError('Invalid MSVS guid: "%s". Must match regex: "%s".' %
830 (guid, VALID_MSVS_GUID_CHARS.pattern)) 830 (guid, VALID_MSVS_GUID_CHARS.pattern))
831 guid = '{%s}' % guid 831 guid = '{%s}' % guid
832 guid = guid or MSVSNew.MakeGuid(proj_path) 832 guid = guid or MSVSNew.MakeGuid(proj_path)
833 return guid 833 return guid
834 834
835 835
836 def _GetMsbuildToolsetOfProject(proj_path, spec):
837 """Get the platform toolset for the project.
838
839 Arguments:
840 proj_path: Path of the vcproj or vcxproj file to generate.
841 spec: The target dictionary containing the properties of the target.
842 Returns:
843 the platform toolset string or None.
844 """
845 # Pluck out the default configuration.
846 default_config = _GetDefaultConfiguration(spec)
847 return default_config.get('msbuild_toolset')
848
849
850 def _GenerateProject(project, options, version, generator_flags): 836 def _GenerateProject(project, options, version, generator_flags):
851 """Generates a vcproj file. 837 """Generates a vcproj file.
852 838
853 Arguments: 839 Arguments:
854 project: the MSVSProject object. 840 project: the MSVSProject object.
855 options: global generator options. 841 options: global generator options.
856 version: the MSVSVersion object. 842 version: the MSVSVersion object.
857 generator_flags: dict of generator-specific flags. 843 generator_flags: dict of generator-specific flags.
858 """ 844 """
859 default_config = _GetDefaultConfiguration(project.spec) 845 default_config = _GetDefaultConfiguration(project.spec)
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
1645 build_file = gyp.common.BuildFile(qualified_target) 1631 build_file = gyp.common.BuildFile(qualified_target)
1646 # Create object for this project. 1632 # Create object for this project.
1647 obj = MSVSNew.MSVSProject( 1633 obj = MSVSNew.MSVSProject(
1648 _FixPath(proj_path), 1634 _FixPath(proj_path),
1649 name=spec['target_name'], 1635 name=spec['target_name'],
1650 guid=guid, 1636 guid=guid,
1651 spec=spec, 1637 spec=spec,
1652 build_file=build_file, 1638 build_file=build_file,
1653 config_platform_overrides=overrides, 1639 config_platform_overrides=overrides,
1654 fixpath_prefix=fixpath_prefix) 1640 fixpath_prefix=fixpath_prefix)
1655 # Set project toolset if any (MS build only)
1656 if msvs_version.UsesVcxproj():
1657 obj.set_msbuild_toolset(_GetMsbuildToolsetOfProject(proj_path, spec))
1658 projects[qualified_target] = obj 1641 projects[qualified_target] = obj
1659 # Set all the dependencies 1642 # Set all the dependencies
1660 for project in projects.values(): 1643 for project in projects.values():
1661 deps = project.spec.get('dependencies', []) 1644 deps = project.spec.get('dependencies', [])
1662 deps = [projects[d] for d in deps] 1645 deps = [projects[d] for d in deps]
1663 project.set_dependencies(deps) 1646 project.set_dependencies(deps)
1664 return projects 1647 return projects
1665 1648
1666 1649
1667 def CalculateVariables(default_variables, params): 1650 def CalculateVariables(default_variables, params):
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
2411 condition = _GetConfigurationCondition(name, settings) 2394 condition = _GetConfigurationCondition(name, settings)
2412 character_set = msbuild_attributes.get('CharacterSet') 2395 character_set = msbuild_attributes.get('CharacterSet')
2413 _AddConditionalProperty(properties, condition, 'ConfigurationType', 2396 _AddConditionalProperty(properties, condition, 'ConfigurationType',
2414 msbuild_attributes['ConfigurationType']) 2397 msbuild_attributes['ConfigurationType'])
2415 if character_set: 2398 if character_set:
2416 _AddConditionalProperty(properties, condition, 'CharacterSet', 2399 _AddConditionalProperty(properties, condition, 'CharacterSet',
2417 character_set) 2400 character_set)
2418 return _GetMSBuildPropertyGroup(spec, 'Configuration', properties) 2401 return _GetMSBuildPropertyGroup(spec, 'Configuration', properties)
2419 2402
2420 2403
2421 def _GetMSBuildLocalProperties(msbuild_toolset):
2422 # Currently the only local property we support is PlatformToolset
2423 properties = {}
2424 if msbuild_toolset:
2425 properties = [
2426 ['PropertyGroup', {'Label': 'Locals'},
2427 ['PlatformToolset', msbuild_toolset],
2428 ]
2429 ]
2430 return properties
2431
2432
2433 def _GetMSBuildPropertySheets(configurations): 2404 def _GetMSBuildPropertySheets(configurations):
2434 user_props = r'$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props' 2405 user_props = r'$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props'
2435 return [ 2406 return [
2436 ['ImportGroup', 2407 ['ImportGroup',
2437 {'Label': 'PropertySheets'}, 2408 {'Label': 'PropertySheets'},
2438 ['Import', 2409 ['Import',
2439 {'Project': user_props, 2410 {'Project': user_props,
2440 'Condition': "exists('%s')" % user_props, 2411 'Condition': "exists('%s')" % user_props,
2441 'Label': 'LocalAppDataPlatform' 2412 'Label': 'LocalAppDataPlatform'
2442 } 2413 }
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
2856 'Project', 2827 'Project',
2857 {'xmlns': 'http://schemas.microsoft.com/developer/msbuild/2003', 2828 {'xmlns': 'http://schemas.microsoft.com/developer/msbuild/2003',
2858 'ToolsVersion': version.ProjectVersion(), 2829 'ToolsVersion': version.ProjectVersion(),
2859 'DefaultTargets': 'Build' 2830 'DefaultTargets': 'Build'
2860 }] 2831 }]
2861 2832
2862 content += _GetMSBuildProjectConfigurations(configurations) 2833 content += _GetMSBuildProjectConfigurations(configurations)
2863 content += _GetMSBuildGlobalProperties(spec, project.guid, project_file_name) 2834 content += _GetMSBuildGlobalProperties(spec, project.guid, project_file_name)
2864 content += import_default_section 2835 content += import_default_section
2865 content += _GetMSBuildConfigurationDetails(spec, project.build_file) 2836 content += _GetMSBuildConfigurationDetails(spec, project.build_file)
2866 content += _GetMSBuildLocalProperties(project.msbuild_toolset)
2867 content += import_cpp_props_section 2837 content += import_cpp_props_section
2868 content += _GetMSBuildExtensions(props_files_of_rules) 2838 content += _GetMSBuildExtensions(props_files_of_rules)
2869 content += _GetMSBuildPropertySheets(configurations) 2839 content += _GetMSBuildPropertySheets(configurations)
2870 content += macro_section 2840 content += macro_section
2871 content += _GetMSBuildConfigurationGlobalProperties(spec, configurations, 2841 content += _GetMSBuildConfigurationGlobalProperties(spec, configurations,
2872 project.build_file) 2842 project.build_file)
2873 content += _GetMSBuildToolSettingsSections(spec, configurations) 2843 content += _GetMSBuildToolSettingsSections(spec, configurations)
2874 content += _GetMSBuildSources( 2844 content += _GetMSBuildSources(
2875 spec, sources, exclusions, extension_to_rule_name, actions_spec, 2845 spec, sources, exclusions, extension_to_rule_name, actions_spec,
2876 sources_handled_by_action, list_excluded) 2846 sources_handled_by_action, list_excluded)
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
2956 action_spec.extend( 2926 action_spec.extend(
2957 # TODO(jeanluc) 'Document' for all or just if as_sources? 2927 # TODO(jeanluc) 'Document' for all or just if as_sources?
2958 [['FileType', 'Document'], 2928 [['FileType', 'Document'],
2959 ['Command', command], 2929 ['Command', command],
2960 ['Message', description], 2930 ['Message', description],
2961 ['Outputs', outputs] 2931 ['Outputs', outputs]
2962 ]) 2932 ])
2963 if additional_inputs: 2933 if additional_inputs:
2964 action_spec.append(['AdditionalInputs', additional_inputs]) 2934 action_spec.append(['AdditionalInputs', additional_inputs])
2965 actions_spec.append(action_spec) 2935 actions_spec.append(action_spec)
OLDNEW
« no previous file with comments | « pylib/gyp/MSVSNew.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698