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

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

Issue 140483003: Quell warnings for exclusion list dictionaries in MSVS generator. (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 11 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/MSVSSettings_test.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 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 """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
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 '$(ParentName)': '$(ProjectFileName)', 396 '$(ParentName)': '$(ProjectFileName)',
397 '$(PlatformName)': '$(Platform)', 397 '$(PlatformName)': '$(Platform)',
398 '$(SafeInputName)': '%(Filename)', 398 '$(SafeInputName)': '%(Filename)',
399 } 399 }
400 for old, new in replace_map.iteritems(): 400 for old, new in replace_map.iteritems():
401 s = s.replace(old, new) 401 s = s.replace(old, new)
402 s = FixVCMacroSlashes(s) 402 s = FixVCMacroSlashes(s)
403 return s 403 return s
404 404
405 405
406 _EXCLUDED_SUFFIX_RE = re.compile('^(.*)_excluded$')
407
408
406 def ConvertToMSBuildSettings(msvs_settings, stderr=sys.stderr): 409 def ConvertToMSBuildSettings(msvs_settings, stderr=sys.stderr):
407 """Converts MSVS settings (VS2008 and earlier) to MSBuild settings (VS2010+). 410 """Converts MSVS settings (VS2008 and earlier) to MSBuild settings (VS2010+).
408 411
409 Args: 412 Args:
410 msvs_settings: A dictionary. The key is the tool name. The values are 413 msvs_settings: A dictionary. The key is the tool name. The values are
411 themselves dictionaries of settings and their values. 414 themselves dictionaries of settings and their values.
412 stderr: The stream receiving the error messages. 415 stderr: The stream receiving the error messages.
413 416
414 Returns: 417 Returns:
415 A dictionary of MSBuild settings. The key is either the MSBuild tool name 418 A dictionary of MSBuild settings. The key is either the MSBuild tool name
416 or the empty string (for the global settings). The values are themselves 419 or the empty string (for the global settings). The values are themselves
417 dictionaries of settings and their values. 420 dictionaries of settings and their values.
418 """ 421 """
419 msbuild_settings = {} 422 msbuild_settings = {}
420 for msvs_tool_name, msvs_tool_settings in msvs_settings.iteritems(): 423 for msvs_tool_name, msvs_tool_settings in msvs_settings.iteritems():
421 if msvs_tool_name in _msvs_to_msbuild_converters: 424 if msvs_tool_name in _msvs_to_msbuild_converters:
422 msvs_tool = _msvs_to_msbuild_converters[msvs_tool_name] 425 msvs_tool = _msvs_to_msbuild_converters[msvs_tool_name]
423 for msvs_setting, msvs_value in msvs_tool_settings.iteritems(): 426 for msvs_setting, msvs_value in msvs_tool_settings.iteritems():
424 if msvs_setting in msvs_tool: 427 if msvs_setting in msvs_tool:
425 # Invoke the translation function. 428 # Invoke the translation function.
426 try: 429 try:
427 msvs_tool[msvs_setting](msvs_value, msbuild_settings) 430 msvs_tool[msvs_setting](msvs_value, msbuild_settings)
428 except ValueError, e: 431 except ValueError, e:
429 print >> stderr, ('Warning: while converting %s/%s to MSBuild, ' 432 print >> stderr, ('Warning: while converting %s/%s to MSBuild, '
430 '%s' % (msvs_tool_name, msvs_setting, e)) 433 '%s' % (msvs_tool_name, msvs_setting, e))
431 else: 434 else:
432 # We don't know this setting. Give a warning. 435 # This may be unrecognized because it's an exclusion list. If the
433 print >> stderr, ('Warning: unrecognized setting %s/%s ' 436 # setting name has the _excluded suffix, then check the root name.
434 'while converting to MSBuild.' % 437 unrecognized = True
435 (msvs_tool_name, msvs_setting)) 438 m = re.match(_EXCLUDED_SUFFIX_RE, msvs_setting)
439 if m:
440 root_msvs_setting = m.group(1)
441 unrecognized = root_msvs_setting not in msvs_tool
442
443 if unrecognized:
444 # We don't know this setting. Give a warning.
445 print >> stderr, ('Warning: unrecognized setting %s/%s '
446 'while converting to MSBuild.' %
447 (msvs_tool_name, msvs_setting))
436 else: 448 else:
437 print >> stderr, ('Warning: unrecognized tool %s while converting to ' 449 print >> stderr, ('Warning: unrecognized tool %s while converting to '
438 'MSBuild.' % msvs_tool_name) 450 'MSBuild.' % msvs_tool_name)
439 return msbuild_settings 451 return msbuild_settings
440 452
441 453
442 def ValidateMSVSSettings(settings, stderr=sys.stderr): 454 def ValidateMSVSSettings(settings, stderr=sys.stderr):
443 """Validates that the names of the settings are valid for MSVS. 455 """Validates that the names of the settings are valid for MSVS.
444 456
445 Args: 457 Args:
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 _MSVSOnly(_manifest, 'UseUnicodeResponseFiles', _boolean) 1054 _MSVSOnly(_manifest, 'UseUnicodeResponseFiles', _boolean)
1043 1055
1044 # MSBuild options not found in MSVS. 1056 # MSBuild options not found in MSVS.
1045 _MSBuildOnly(_manifest, 'EnableDPIAwareness', _boolean) 1057 _MSBuildOnly(_manifest, 'EnableDPIAwareness', _boolean)
1046 _MSBuildOnly(_manifest, 'GenerateCategoryTags', _boolean) # /category 1058 _MSBuildOnly(_manifest, 'GenerateCategoryTags', _boolean) # /category
1047 _MSBuildOnly(_manifest, 'ManifestFromManagedAssembly', 1059 _MSBuildOnly(_manifest, 'ManifestFromManagedAssembly',
1048 _file_name) # /managedassemblyname 1060 _file_name) # /managedassemblyname
1049 _MSBuildOnly(_manifest, 'OutputResourceManifests', _string) # /outputresource 1061 _MSBuildOnly(_manifest, 'OutputResourceManifests', _string) # /outputresource
1050 _MSBuildOnly(_manifest, 'SuppressDependencyElement', _boolean) # /nodependency 1062 _MSBuildOnly(_manifest, 'SuppressDependencyElement', _boolean) # /nodependency
1051 _MSBuildOnly(_manifest, 'TrackerLogDirectory', _folder_name) 1063 _MSBuildOnly(_manifest, 'TrackerLogDirectory', _folder_name)
OLDNEW
« no previous file with comments | « no previous file | pylib/gyp/MSVSSettings_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698