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

Side by Side Diff: pylib/gyp/MSVSSettings.py

Issue 10831183: Fixes an issue where OutputDirectory and IntermediateDirectory were being (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: Created 8 years, 4 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 | « no previous file | pylib/gyp/generator/msvs.py » ('j') | 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 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. 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 """Code to validate and convert settings of the Microsoft build tools. 5 """Code to validate and convert settings of the Microsoft build tools.
6 6
7 This file contains code to validate and convert settings of the Microsoft 7 This file contains code to validate and convert settings of the Microsoft
8 build tools. The function ConvertToMSBuildSettings(), ValidateMSVSSettings(), 8 build tools. The function ConvertToMSBuildSettings(), ValidateMSVSSettings(),
9 and ValidateMSBuildSettings() are the entry points. 9 and ValidateMSBuildSettings() are the entry points.
10 10
11 This file was created by comparing the projects created by Visual Studio 2008 11 This file was created by comparing the projects created by Visual Studio 2008
12 and Visual Studio 2010 for all available settings through the user interface. 12 and Visual Studio 2010 for all available settings through the user interface.
13 The MSBuild schemas were also considered. They are typically found in the 13 The MSBuild schemas were also considered. They are typically found in the
14 MSBuild install directory, e.g. c:\Program Files (x86)\MSBuild 14 MSBuild install directory, e.g. c:\Program Files (x86)\MSBuild
15 """ 15 """
16 16
17 import sys 17 import sys
18 18 import re
19 19
20 # Dictionaries of settings validators. The key is the tool name, the value is 20 # Dictionaries of settings validators. The key is the tool name, the value is
21 # a dictionary mapping setting names to validation functions. 21 # a dictionary mapping setting names to validation functions.
22 _msvs_validators = {} 22 _msvs_validators = {}
23 _msbuild_validators = {} 23 _msbuild_validators = {}
24 24
25 25
26 # A dictionary of settings converters. The key is the tool name, the value is 26 # A dictionary of settings converters. The key is the tool name, the value is
27 # a dictionary mapping setting names to conversion functions. 27 # a dictionary mapping setting names to conversion functions.
28 _msvs_to_msbuild_converters = {} 28 _msvs_to_msbuild_converters = {}
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 # Create a bogus validator that looks for '0', '1', or '2' 355 # Create a bogus validator that looks for '0', '1', or '2'
356 msvs_validator = _Enumeration(['a', 'b', 'c']).ValidateMSVS 356 msvs_validator = _Enumeration(['a', 'b', 'c']).ValidateMSVS
357 _msvs_validators[tool.msvs_name][msvs_name] = msvs_validator 357 _msvs_validators[tool.msvs_name][msvs_name] = msvs_validator
358 msbuild_validator = _boolean.ValidateMSBuild 358 msbuild_validator = _boolean.ValidateMSBuild
359 msbuild_tool_validators = _msbuild_validators[tool.msbuild_name] 359 msbuild_tool_validators = _msbuild_validators[tool.msbuild_name]
360 msbuild_tool_validators['PreprocessToFile'] = msbuild_validator 360 msbuild_tool_validators['PreprocessToFile'] = msbuild_validator
361 msbuild_tool_validators['PreprocessSuppressLineNumbers'] = msbuild_validator 361 msbuild_tool_validators['PreprocessSuppressLineNumbers'] = msbuild_validator
362 _msvs_to_msbuild_converters[tool.msvs_name][msvs_name] = _Translate 362 _msvs_to_msbuild_converters[tool.msvs_name][msvs_name] = _Translate
363 363
364 364
365 fix_vc_macro_slashes_regex_list = ('IntDir', 'OutDir')
366 fix_vc_macro_slashes_regex = re.compile(
367 r'(\$\((?:%s)\))(?:[\\/]+)' % "|".join(fix_vc_macro_slashes_regex_list)
368 )
369
370 def FixVCMacroSlashes(s):
371 """Replace macros which have excessive following slashes.
372
373 These macros are known to have a built-in trailing slash. Furthermore, many
374 scripts hiccup on processing paths with extra slashes in the middle.
375
376 This list is probably not exhaustive. Add as needed.
377 """
378 if '$' in s:
379 s = fix_vc_macro_slashes_regex.sub(r'\1', s)
380 return s
381
382
365 def ConvertVCMacrosToMSBuild(s): 383 def ConvertVCMacrosToMSBuild(s):
366 """Convert the the MSVS macros found in the string to the MSBuild equivalent. 384 """Convert the the MSVS macros found in the string to the MSBuild equivalent.
367 385
368 This list is probably not exhaustive. Add as needed. 386 This list is probably not exhaustive. Add as needed.
369 """ 387 """
370 if '$' in s: 388 if '$' in s:
371 replace_map = { 389 replace_map = {
372 '$(ConfigurationName)': '$(Configuration)', 390 '$(ConfigurationName)': '$(Configuration)',
373 '$(InputDir)': '%(RootDir)%(Directory)', 391 '$(InputDir)': '%(RootDir)%(Directory)',
374 '$(InputExt)': '%(Extension)', 392 '$(InputExt)': '%(Extension)',
375 '$(InputFileName)': '%(Filename)%(Extension)', 393 '$(InputFileName)': '%(Filename)%(Extension)',
376 '$(InputName)': '%(Filename)', 394 '$(InputName)': '%(Filename)',
377 '$(InputPath)': '%(FullPath)', 395 '$(InputPath)': '%(FullPath)',
378 '$(ParentName)': '$(ProjectFileName)', 396 '$(ParentName)': '$(ProjectFileName)',
379 '$(PlatformName)': '$(Platform)', 397 '$(PlatformName)': '$(Platform)',
380 '$(SafeInputName)': '%(Filename)', 398 '$(SafeInputName)': '%(Filename)',
381
382 '$(IntDir)\\': '$(IntDir)',
383 '$(OutDir)\\': '$(OutDir)',
384 '$(IntDir)/': '$(IntDir)',
385 '$(OutDir)/': '$(OutDir)',
386 } 399 }
387 for old, new in replace_map.iteritems(): 400 for old, new in replace_map.iteritems():
388 s = s.replace(old, new) 401 s = s.replace(old, new)
402 s = FixVCMacroSlashes(s)
389 return s 403 return s
390 404
391 405
392 def ConvertToMSBuildSettings(msvs_settings, stderr=sys.stderr): 406 def ConvertToMSBuildSettings(msvs_settings, stderr=sys.stderr):
393 """Converts MSVS settings (VS2008 and earlier) to MSBuild settings (VS2010+). 407 """Converts MSVS settings (VS2008 and earlier) to MSBuild settings (VS2010+).
394 408
395 Args: 409 Args:
396 msvs_settings: A dictionary. The key is the tool name. The values are 410 msvs_settings: A dictionary. The key is the tool name. The values are
397 themselves dictionaries of settings and their values. 411 themselves dictionaries of settings and their values.
398 stderr: The stream receiving the error messages. 412 stderr: The stream receiving the error messages.
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 _MSVSOnly(_manifest, 'UseUnicodeResponseFiles', _boolean) 1037 _MSVSOnly(_manifest, 'UseUnicodeResponseFiles', _boolean)
1024 1038
1025 # MSBuild options not found in MSVS. 1039 # MSBuild options not found in MSVS.
1026 _MSBuildOnly(_manifest, 'EnableDPIAwareness', _boolean) 1040 _MSBuildOnly(_manifest, 'EnableDPIAwareness', _boolean)
1027 _MSBuildOnly(_manifest, 'GenerateCategoryTags', _boolean) # /category 1041 _MSBuildOnly(_manifest, 'GenerateCategoryTags', _boolean) # /category
1028 _MSBuildOnly(_manifest, 'ManifestFromManagedAssembly', 1042 _MSBuildOnly(_manifest, 'ManifestFromManagedAssembly',
1029 _file_name) # /managedassemblyname 1043 _file_name) # /managedassemblyname
1030 _MSBuildOnly(_manifest, 'OutputResourceManifests', _string) # /outputresource 1044 _MSBuildOnly(_manifest, 'OutputResourceManifests', _string) # /outputresource
1031 _MSBuildOnly(_manifest, 'SuppressDependencyElement', _boolean) # /nodependency 1045 _MSBuildOnly(_manifest, 'SuppressDependencyElement', _boolean) # /nodependency
1032 _MSBuildOnly(_manifest, 'TrackerLogDirectory', _folder_name) 1046 _MSBuildOnly(_manifest, 'TrackerLogDirectory', _folder_name)
OLDNEW
« no previous file with comments | « no previous file | pylib/gyp/generator/msvs.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698