wsba-hockey 1.0.3__py3-none-any.whl → 1.0.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. wsba_hockey/__init__.py +1 -1
  2. wsba_hockey/data_pipelines.py +183 -0
  3. wsba_hockey/evidence/weakside-breakout/node_modules/duckdb/vendor.py +146 -0
  4. wsba_hockey/evidence/weakside-breakout/node_modules/flatted/python/flatted.py +149 -0
  5. wsba_hockey/evidence/weakside-breakout/node_modules/flatted/python/test.py +63 -0
  6. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/gyp_main.py +45 -0
  7. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py +367 -0
  8. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py +206 -0
  9. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py +1270 -0
  10. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py +1547 -0
  11. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSToolFile.py +59 -0
  12. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py +153 -0
  13. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py +271 -0
  14. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py +574 -0
  15. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/__init__.py +690 -0
  16. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/common.py +661 -0
  17. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/common_test.py +78 -0
  18. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py +165 -0
  19. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py +109 -0
  20. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py +55 -0
  21. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/__init__.py +0 -0
  22. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py +808 -0
  23. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py +1173 -0
  24. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py +1321 -0
  25. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py +120 -0
  26. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/dump_dependency_json.py +103 -0
  27. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py +464 -0
  28. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py +89 -0
  29. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/gypsh.py +58 -0
  30. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py +2714 -0
  31. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py +3981 -0
  32. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py +44 -0
  33. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py +2936 -0
  34. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py +55 -0
  35. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py +1394 -0
  36. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py +25 -0
  37. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/input.py +3130 -0
  38. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/input_test.py +98 -0
  39. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py +771 -0
  40. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py +1271 -0
  41. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py +174 -0
  42. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py +61 -0
  43. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py +374 -0
  44. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py +1939 -0
  45. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py +302 -0
  46. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py +3197 -0
  47. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/xml_fix.py +65 -0
  48. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/test_gyp.py +261 -0
  49. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/tools/graphviz.py +102 -0
  50. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/tools/pretty_gyp.py +156 -0
  51. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/tools/pretty_sln.py +181 -0
  52. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/tools/pretty_vcproj.py +339 -0
  53. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/test/fixtures/test-charmap.py +31 -0
  54. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/update-gyp.py +64 -0
  55. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/gyp_main.py +45 -0
  56. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py +367 -0
  57. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py +206 -0
  58. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py +1270 -0
  59. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py +1547 -0
  60. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSToolFile.py +59 -0
  61. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py +153 -0
  62. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py +271 -0
  63. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py +574 -0
  64. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/__init__.py +666 -0
  65. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/common.py +654 -0
  66. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/common_test.py +78 -0
  67. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py +165 -0
  68. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py +109 -0
  69. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py +55 -0
  70. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/__init__.py +0 -0
  71. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py +808 -0
  72. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py +1173 -0
  73. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py +1321 -0
  74. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py +120 -0
  75. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/dump_dependency_json.py +103 -0
  76. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py +464 -0
  77. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py +89 -0
  78. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/gypsh.py +58 -0
  79. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py +2518 -0
  80. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py +3978 -0
  81. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py +44 -0
  82. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py +2936 -0
  83. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py +55 -0
  84. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py +1394 -0
  85. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py +25 -0
  86. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/input.py +3137 -0
  87. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/input_test.py +98 -0
  88. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py +771 -0
  89. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py +1271 -0
  90. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py +174 -0
  91. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py +61 -0
  92. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py +374 -0
  93. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py +1939 -0
  94. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py +302 -0
  95. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py +3197 -0
  96. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/xml_fix.py +65 -0
  97. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/setup.py +42 -0
  98. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/test_gyp.py +260 -0
  99. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/tools/graphviz.py +102 -0
  100. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/tools/pretty_gyp.py +156 -0
  101. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/tools/pretty_sln.py +181 -0
  102. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/tools/pretty_vcproj.py +339 -0
  103. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/test/fixtures/test-charmap.py +31 -0
  104. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/update-gyp.py +46 -0
  105. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/game_stats/app.py +400 -0
  106. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/game_stats/name_fix.py +47 -0
  107. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/heatmaps/app.py +108 -0
  108. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/heatmaps/plot.py +93 -0
  109. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/heatmaps/rink_plot.py +245 -0
  110. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/matchups/app.py +145 -0
  111. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/matchups/plot.py +77 -0
  112. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/matchups/rink_plot.py +245 -0
  113. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/pbp/app.py +389 -0
  114. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/pbp/plot.py +70 -0
  115. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/pbp/rink_plot.py +245 -0
  116. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/skater/app.py +110 -0
  117. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/skater/plot.py +58 -0
  118. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/skater/rink_plot.py +245 -0
  119. wsba_hockey/tools/agg.py +243 -54
  120. wsba_hockey/tools/plotting.py +25 -25
  121. wsba_hockey/tools/scraping.py +154 -263
  122. wsba_hockey/tools/xg_model.py +369 -315
  123. wsba_hockey/workspace.py +22 -117
  124. wsba_hockey/wsba_main.py +499 -167
  125. {wsba_hockey-1.0.3.dist-info → wsba_hockey-1.0.5.dist-info}/METADATA +1 -1
  126. wsba_hockey-1.0.5.dist-info/RECORD +135 -0
  127. {wsba_hockey-1.0.3.dist-info → wsba_hockey-1.0.5.dist-info}/WHEEL +1 -1
  128. wsba_hockey/stats/calculate_viz/shot_impact.py +0 -2
  129. wsba_hockey-1.0.3.dist-info/RECORD +0 -19
  130. {wsba_hockey-1.0.3.dist-info → wsba_hockey-1.0.5.dist-info}/licenses/LICENSE +0 -0
  131. {wsba_hockey-1.0.3.dist-info → wsba_hockey-1.0.5.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,1547 @@
1
+ #!/usr/bin/env python3
2
+
3
+ # Copyright (c) 2012 Google Inc. All rights reserved.
4
+ # Use of this source code is governed by a BSD-style license that can be
5
+ # found in the LICENSE file.
6
+
7
+ """Unit tests for the MSVSSettings.py file."""
8
+
9
+ import unittest
10
+ import gyp.MSVSSettings as MSVSSettings
11
+
12
+ from io import StringIO
13
+
14
+
15
+ class TestSequenceFunctions(unittest.TestCase):
16
+ def setUp(self):
17
+ self.stderr = StringIO()
18
+
19
+ def _ExpectedWarnings(self, expected):
20
+ """Compares recorded lines to expected warnings."""
21
+ self.stderr.seek(0)
22
+ actual = self.stderr.read().split("\n")
23
+ actual = [line for line in actual if line]
24
+ self.assertEqual(sorted(expected), sorted(actual))
25
+
26
+ def testValidateMSVSSettings_tool_names(self):
27
+ """Tests that only MSVS tool names are allowed."""
28
+ MSVSSettings.ValidateMSVSSettings(
29
+ {
30
+ "VCCLCompilerTool": {},
31
+ "VCLinkerTool": {},
32
+ "VCMIDLTool": {},
33
+ "foo": {},
34
+ "VCResourceCompilerTool": {},
35
+ "VCLibrarianTool": {},
36
+ "VCManifestTool": {},
37
+ "ClCompile": {},
38
+ },
39
+ self.stderr,
40
+ )
41
+ self._ExpectedWarnings(
42
+ ["Warning: unrecognized tool foo", "Warning: unrecognized tool ClCompile"]
43
+ )
44
+
45
+ def testValidateMSVSSettings_settings(self):
46
+ """Tests that for invalid MSVS settings."""
47
+ MSVSSettings.ValidateMSVSSettings(
48
+ {
49
+ "VCCLCompilerTool": {
50
+ "AdditionalIncludeDirectories": "folder1;folder2",
51
+ "AdditionalOptions": ["string1", "string2"],
52
+ "AdditionalUsingDirectories": "folder1;folder2",
53
+ "AssemblerListingLocation": "a_file_name",
54
+ "AssemblerOutput": "0",
55
+ "BasicRuntimeChecks": "5",
56
+ "BrowseInformation": "fdkslj",
57
+ "BrowseInformationFile": "a_file_name",
58
+ "BufferSecurityCheck": "true",
59
+ "CallingConvention": "-1",
60
+ "CompileAs": "1",
61
+ "DebugInformationFormat": "2",
62
+ "DefaultCharIsUnsigned": "true",
63
+ "Detect64BitPortabilityProblems": "true",
64
+ "DisableLanguageExtensions": "true",
65
+ "DisableSpecificWarnings": "string1;string2",
66
+ "EnableEnhancedInstructionSet": "1",
67
+ "EnableFiberSafeOptimizations": "true",
68
+ "EnableFunctionLevelLinking": "true",
69
+ "EnableIntrinsicFunctions": "true",
70
+ "EnablePREfast": "true",
71
+ "Enableprefast": "bogus",
72
+ "ErrorReporting": "1",
73
+ "ExceptionHandling": "1",
74
+ "ExpandAttributedSource": "true",
75
+ "FavorSizeOrSpeed": "1",
76
+ "FloatingPointExceptions": "true",
77
+ "FloatingPointModel": "1",
78
+ "ForceConformanceInForLoopScope": "true",
79
+ "ForcedIncludeFiles": "file1;file2",
80
+ "ForcedUsingFiles": "file1;file2",
81
+ "GeneratePreprocessedFile": "1",
82
+ "GenerateXMLDocumentationFiles": "true",
83
+ "IgnoreStandardIncludePath": "true",
84
+ "InlineFunctionExpansion": "1",
85
+ "KeepComments": "true",
86
+ "MinimalRebuild": "true",
87
+ "ObjectFile": "a_file_name",
88
+ "OmitDefaultLibName": "true",
89
+ "OmitFramePointers": "true",
90
+ "OpenMP": "true",
91
+ "Optimization": "1",
92
+ "PrecompiledHeaderFile": "a_file_name",
93
+ "PrecompiledHeaderThrough": "a_file_name",
94
+ "PreprocessorDefinitions": "string1;string2",
95
+ "ProgramDataBaseFileName": "a_file_name",
96
+ "RuntimeLibrary": "1",
97
+ "RuntimeTypeInfo": "true",
98
+ "ShowIncludes": "true",
99
+ "SmallerTypeCheck": "true",
100
+ "StringPooling": "true",
101
+ "StructMemberAlignment": "1",
102
+ "SuppressStartupBanner": "true",
103
+ "TreatWChar_tAsBuiltInType": "true",
104
+ "UndefineAllPreprocessorDefinitions": "true",
105
+ "UndefinePreprocessorDefinitions": "string1;string2",
106
+ "UseFullPaths": "true",
107
+ "UsePrecompiledHeader": "1",
108
+ "UseUnicodeResponseFiles": "true",
109
+ "WarnAsError": "true",
110
+ "WarningLevel": "1",
111
+ "WholeProgramOptimization": "true",
112
+ "XMLDocumentationFileName": "a_file_name",
113
+ "ZZXYZ": "bogus",
114
+ },
115
+ "VCLinkerTool": {
116
+ "AdditionalDependencies": "file1;file2",
117
+ "AdditionalDependencies_excluded": "file3",
118
+ "AdditionalLibraryDirectories": "folder1;folder2",
119
+ "AdditionalManifestDependencies": "file1;file2",
120
+ "AdditionalOptions": "a string1",
121
+ "AddModuleNamesToAssembly": "file1;file2",
122
+ "AllowIsolation": "true",
123
+ "AssemblyDebug": "2",
124
+ "AssemblyLinkResource": "file1;file2",
125
+ "BaseAddress": "a string1",
126
+ "CLRImageType": "2",
127
+ "CLRThreadAttribute": "2",
128
+ "CLRUnmanagedCodeCheck": "true",
129
+ "DataExecutionPrevention": "2",
130
+ "DelayLoadDLLs": "file1;file2",
131
+ "DelaySign": "true",
132
+ "Driver": "2",
133
+ "EmbedManagedResourceFile": "file1;file2",
134
+ "EnableCOMDATFolding": "2",
135
+ "EnableUAC": "true",
136
+ "EntryPointSymbol": "a string1",
137
+ "ErrorReporting": "2",
138
+ "FixedBaseAddress": "2",
139
+ "ForceSymbolReferences": "file1;file2",
140
+ "FunctionOrder": "a_file_name",
141
+ "GenerateDebugInformation": "true",
142
+ "GenerateManifest": "true",
143
+ "GenerateMapFile": "true",
144
+ "HeapCommitSize": "a string1",
145
+ "HeapReserveSize": "a string1",
146
+ "IgnoreAllDefaultLibraries": "true",
147
+ "IgnoreDefaultLibraryNames": "file1;file2",
148
+ "IgnoreEmbeddedIDL": "true",
149
+ "IgnoreImportLibrary": "true",
150
+ "ImportLibrary": "a_file_name",
151
+ "KeyContainer": "a_file_name",
152
+ "KeyFile": "a_file_name",
153
+ "LargeAddressAware": "2",
154
+ "LinkIncremental": "2",
155
+ "LinkLibraryDependencies": "true",
156
+ "LinkTimeCodeGeneration": "2",
157
+ "ManifestFile": "a_file_name",
158
+ "MapExports": "true",
159
+ "MapFileName": "a_file_name",
160
+ "MergedIDLBaseFileName": "a_file_name",
161
+ "MergeSections": "a string1",
162
+ "MidlCommandFile": "a_file_name",
163
+ "ModuleDefinitionFile": "a_file_name",
164
+ "OptimizeForWindows98": "1",
165
+ "OptimizeReferences": "2",
166
+ "OutputFile": "a_file_name",
167
+ "PerUserRedirection": "true",
168
+ "Profile": "true",
169
+ "ProfileGuidedDatabase": "a_file_name",
170
+ "ProgramDatabaseFile": "a_file_name",
171
+ "RandomizedBaseAddress": "2",
172
+ "RegisterOutput": "true",
173
+ "ResourceOnlyDLL": "true",
174
+ "SetChecksum": "true",
175
+ "ShowProgress": "2",
176
+ "StackCommitSize": "a string1",
177
+ "StackReserveSize": "a string1",
178
+ "StripPrivateSymbols": "a_file_name",
179
+ "SubSystem": "2",
180
+ "SupportUnloadOfDelayLoadedDLL": "true",
181
+ "SuppressStartupBanner": "true",
182
+ "SwapRunFromCD": "true",
183
+ "SwapRunFromNet": "true",
184
+ "TargetMachine": "2",
185
+ "TerminalServerAware": "2",
186
+ "TurnOffAssemblyGeneration": "true",
187
+ "TypeLibraryFile": "a_file_name",
188
+ "TypeLibraryResourceID": "33",
189
+ "UACExecutionLevel": "2",
190
+ "UACUIAccess": "true",
191
+ "UseLibraryDependencyInputs": "true",
192
+ "UseUnicodeResponseFiles": "true",
193
+ "Version": "a string1",
194
+ },
195
+ "VCMIDLTool": {
196
+ "AdditionalIncludeDirectories": "folder1;folder2",
197
+ "AdditionalOptions": "a string1",
198
+ "CPreprocessOptions": "a string1",
199
+ "DefaultCharType": "1",
200
+ "DLLDataFileName": "a_file_name",
201
+ "EnableErrorChecks": "1",
202
+ "ErrorCheckAllocations": "true",
203
+ "ErrorCheckBounds": "true",
204
+ "ErrorCheckEnumRange": "true",
205
+ "ErrorCheckRefPointers": "true",
206
+ "ErrorCheckStubData": "true",
207
+ "GenerateStublessProxies": "true",
208
+ "GenerateTypeLibrary": "true",
209
+ "HeaderFileName": "a_file_name",
210
+ "IgnoreStandardIncludePath": "true",
211
+ "InterfaceIdentifierFileName": "a_file_name",
212
+ "MkTypLibCompatible": "true",
213
+ "notgood": "bogus",
214
+ "OutputDirectory": "a string1",
215
+ "PreprocessorDefinitions": "string1;string2",
216
+ "ProxyFileName": "a_file_name",
217
+ "RedirectOutputAndErrors": "a_file_name",
218
+ "StructMemberAlignment": "1",
219
+ "SuppressStartupBanner": "true",
220
+ "TargetEnvironment": "1",
221
+ "TypeLibraryName": "a_file_name",
222
+ "UndefinePreprocessorDefinitions": "string1;string2",
223
+ "ValidateParameters": "true",
224
+ "WarnAsError": "true",
225
+ "WarningLevel": "1",
226
+ },
227
+ "VCResourceCompilerTool": {
228
+ "AdditionalOptions": "a string1",
229
+ "AdditionalIncludeDirectories": "folder1;folder2",
230
+ "Culture": "1003",
231
+ "IgnoreStandardIncludePath": "true",
232
+ "notgood2": "bogus",
233
+ "PreprocessorDefinitions": "string1;string2",
234
+ "ResourceOutputFileName": "a string1",
235
+ "ShowProgress": "true",
236
+ "SuppressStartupBanner": "true",
237
+ "UndefinePreprocessorDefinitions": "string1;string2",
238
+ },
239
+ "VCLibrarianTool": {
240
+ "AdditionalDependencies": "file1;file2",
241
+ "AdditionalLibraryDirectories": "folder1;folder2",
242
+ "AdditionalOptions": "a string1",
243
+ "ExportNamedFunctions": "string1;string2",
244
+ "ForceSymbolReferences": "a string1",
245
+ "IgnoreAllDefaultLibraries": "true",
246
+ "IgnoreSpecificDefaultLibraries": "file1;file2",
247
+ "LinkLibraryDependencies": "true",
248
+ "ModuleDefinitionFile": "a_file_name",
249
+ "OutputFile": "a_file_name",
250
+ "SuppressStartupBanner": "true",
251
+ "UseUnicodeResponseFiles": "true",
252
+ },
253
+ "VCManifestTool": {
254
+ "AdditionalManifestFiles": "file1;file2",
255
+ "AdditionalOptions": "a string1",
256
+ "AssemblyIdentity": "a string1",
257
+ "ComponentFileName": "a_file_name",
258
+ "DependencyInformationFile": "a_file_name",
259
+ "GenerateCatalogFiles": "true",
260
+ "InputResourceManifests": "a string1",
261
+ "ManifestResourceFile": "a_file_name",
262
+ "OutputManifestFile": "a_file_name",
263
+ "RegistrarScriptFile": "a_file_name",
264
+ "ReplacementsFile": "a_file_name",
265
+ "SuppressStartupBanner": "true",
266
+ "TypeLibraryFile": "a_file_name",
267
+ "UpdateFileHashes": "truel",
268
+ "UpdateFileHashesSearchPath": "a_file_name",
269
+ "UseFAT32Workaround": "true",
270
+ "UseUnicodeResponseFiles": "true",
271
+ "VerboseOutput": "true",
272
+ },
273
+ },
274
+ self.stderr,
275
+ )
276
+ self._ExpectedWarnings(
277
+ [
278
+ "Warning: for VCCLCompilerTool/BasicRuntimeChecks, "
279
+ "index value (5) not in expected range [0, 4)",
280
+ "Warning: for VCCLCompilerTool/BrowseInformation, "
281
+ "invalid literal for int() with base 10: 'fdkslj'",
282
+ "Warning: for VCCLCompilerTool/CallingConvention, "
283
+ "index value (-1) not in expected range [0, 4)",
284
+ "Warning: for VCCLCompilerTool/DebugInformationFormat, "
285
+ "converted value for 2 not specified.",
286
+ "Warning: unrecognized setting VCCLCompilerTool/Enableprefast",
287
+ "Warning: unrecognized setting VCCLCompilerTool/ZZXYZ",
288
+ "Warning: for VCLinkerTool/TargetMachine, "
289
+ "converted value for 2 not specified.",
290
+ "Warning: unrecognized setting VCMIDLTool/notgood",
291
+ "Warning: unrecognized setting VCResourceCompilerTool/notgood2",
292
+ "Warning: for VCManifestTool/UpdateFileHashes, "
293
+ "expected bool; got 'truel'"
294
+ "",
295
+ ]
296
+ )
297
+
298
+ def testValidateMSBuildSettings_settings(self):
299
+ """Tests that for invalid MSBuild settings."""
300
+ MSVSSettings.ValidateMSBuildSettings(
301
+ {
302
+ "ClCompile": {
303
+ "AdditionalIncludeDirectories": "folder1;folder2",
304
+ "AdditionalOptions": ["string1", "string2"],
305
+ "AdditionalUsingDirectories": "folder1;folder2",
306
+ "AssemblerListingLocation": "a_file_name",
307
+ "AssemblerOutput": "NoListing",
308
+ "BasicRuntimeChecks": "StackFrameRuntimeCheck",
309
+ "BrowseInformation": "false",
310
+ "BrowseInformationFile": "a_file_name",
311
+ "BufferSecurityCheck": "true",
312
+ "BuildingInIDE": "true",
313
+ "CallingConvention": "Cdecl",
314
+ "CompileAs": "CompileAsC",
315
+ "CompileAsManaged": "true",
316
+ "CreateHotpatchableImage": "true",
317
+ "DebugInformationFormat": "ProgramDatabase",
318
+ "DisableLanguageExtensions": "true",
319
+ "DisableSpecificWarnings": "string1;string2",
320
+ "EnableEnhancedInstructionSet": "StreamingSIMDExtensions",
321
+ "EnableFiberSafeOptimizations": "true",
322
+ "EnablePREfast": "true",
323
+ "Enableprefast": "bogus",
324
+ "ErrorReporting": "Prompt",
325
+ "ExceptionHandling": "SyncCThrow",
326
+ "ExpandAttributedSource": "true",
327
+ "FavorSizeOrSpeed": "Neither",
328
+ "FloatingPointExceptions": "true",
329
+ "FloatingPointModel": "Precise",
330
+ "ForceConformanceInForLoopScope": "true",
331
+ "ForcedIncludeFiles": "file1;file2",
332
+ "ForcedUsingFiles": "file1;file2",
333
+ "FunctionLevelLinking": "false",
334
+ "GenerateXMLDocumentationFiles": "true",
335
+ "IgnoreStandardIncludePath": "true",
336
+ "InlineFunctionExpansion": "OnlyExplicitInline",
337
+ "IntrinsicFunctions": "false",
338
+ "MinimalRebuild": "true",
339
+ "MultiProcessorCompilation": "true",
340
+ "ObjectFileName": "a_file_name",
341
+ "OmitDefaultLibName": "true",
342
+ "OmitFramePointers": "true",
343
+ "OpenMPSupport": "true",
344
+ "Optimization": "Disabled",
345
+ "PrecompiledHeader": "NotUsing",
346
+ "PrecompiledHeaderFile": "a_file_name",
347
+ "PrecompiledHeaderOutputFile": "a_file_name",
348
+ "PreprocessKeepComments": "true",
349
+ "PreprocessorDefinitions": "string1;string2",
350
+ "PreprocessOutputPath": "a string1",
351
+ "PreprocessSuppressLineNumbers": "false",
352
+ "PreprocessToFile": "false",
353
+ "ProcessorNumber": "33",
354
+ "ProgramDataBaseFileName": "a_file_name",
355
+ "RuntimeLibrary": "MultiThreaded",
356
+ "RuntimeTypeInfo": "true",
357
+ "ShowIncludes": "true",
358
+ "SmallerTypeCheck": "true",
359
+ "StringPooling": "true",
360
+ "StructMemberAlignment": "1Byte",
361
+ "SuppressStartupBanner": "true",
362
+ "TrackerLogDirectory": "a_folder",
363
+ "TreatSpecificWarningsAsErrors": "string1;string2",
364
+ "TreatWarningAsError": "true",
365
+ "TreatWChar_tAsBuiltInType": "true",
366
+ "UndefineAllPreprocessorDefinitions": "true",
367
+ "UndefinePreprocessorDefinitions": "string1;string2",
368
+ "UseFullPaths": "true",
369
+ "UseUnicodeForAssemblerListing": "true",
370
+ "WarningLevel": "TurnOffAllWarnings",
371
+ "WholeProgramOptimization": "true",
372
+ "XMLDocumentationFileName": "a_file_name",
373
+ "ZZXYZ": "bogus",
374
+ },
375
+ "Link": {
376
+ "AdditionalDependencies": "file1;file2",
377
+ "AdditionalLibraryDirectories": "folder1;folder2",
378
+ "AdditionalManifestDependencies": "file1;file2",
379
+ "AdditionalOptions": "a string1",
380
+ "AddModuleNamesToAssembly": "file1;file2",
381
+ "AllowIsolation": "true",
382
+ "AssemblyDebug": "",
383
+ "AssemblyLinkResource": "file1;file2",
384
+ "BaseAddress": "a string1",
385
+ "BuildingInIDE": "true",
386
+ "CLRImageType": "ForceIJWImage",
387
+ "CLRSupportLastError": "Enabled",
388
+ "CLRThreadAttribute": "MTAThreadingAttribute",
389
+ "CLRUnmanagedCodeCheck": "true",
390
+ "CreateHotPatchableImage": "X86Image",
391
+ "DataExecutionPrevention": "false",
392
+ "DelayLoadDLLs": "file1;file2",
393
+ "DelaySign": "true",
394
+ "Driver": "NotSet",
395
+ "EmbedManagedResourceFile": "file1;file2",
396
+ "EnableCOMDATFolding": "false",
397
+ "EnableUAC": "true",
398
+ "EntryPointSymbol": "a string1",
399
+ "FixedBaseAddress": "false",
400
+ "ForceFileOutput": "Enabled",
401
+ "ForceSymbolReferences": "file1;file2",
402
+ "FunctionOrder": "a_file_name",
403
+ "GenerateDebugInformation": "true",
404
+ "GenerateMapFile": "true",
405
+ "HeapCommitSize": "a string1",
406
+ "HeapReserveSize": "a string1",
407
+ "IgnoreAllDefaultLibraries": "true",
408
+ "IgnoreEmbeddedIDL": "true",
409
+ "IgnoreSpecificDefaultLibraries": "a_file_list",
410
+ "ImageHasSafeExceptionHandlers": "true",
411
+ "ImportLibrary": "a_file_name",
412
+ "KeyContainer": "a_file_name",
413
+ "KeyFile": "a_file_name",
414
+ "LargeAddressAware": "false",
415
+ "LinkDLL": "true",
416
+ "LinkErrorReporting": "SendErrorReport",
417
+ "LinkStatus": "true",
418
+ "LinkTimeCodeGeneration": "UseLinkTimeCodeGeneration",
419
+ "ManifestFile": "a_file_name",
420
+ "MapExports": "true",
421
+ "MapFileName": "a_file_name",
422
+ "MergedIDLBaseFileName": "a_file_name",
423
+ "MergeSections": "a string1",
424
+ "MidlCommandFile": "a_file_name",
425
+ "MinimumRequiredVersion": "a string1",
426
+ "ModuleDefinitionFile": "a_file_name",
427
+ "MSDOSStubFileName": "a_file_name",
428
+ "NoEntryPoint": "true",
429
+ "OptimizeReferences": "false",
430
+ "OutputFile": "a_file_name",
431
+ "PerUserRedirection": "true",
432
+ "PreventDllBinding": "true",
433
+ "Profile": "true",
434
+ "ProfileGuidedDatabase": "a_file_name",
435
+ "ProgramDatabaseFile": "a_file_name",
436
+ "RandomizedBaseAddress": "false",
437
+ "RegisterOutput": "true",
438
+ "SectionAlignment": "33",
439
+ "SetChecksum": "true",
440
+ "ShowProgress": "LinkVerboseREF",
441
+ "SpecifySectionAttributes": "a string1",
442
+ "StackCommitSize": "a string1",
443
+ "StackReserveSize": "a string1",
444
+ "StripPrivateSymbols": "a_file_name",
445
+ "SubSystem": "Console",
446
+ "SupportNobindOfDelayLoadedDLL": "true",
447
+ "SupportUnloadOfDelayLoadedDLL": "true",
448
+ "SuppressStartupBanner": "true",
449
+ "SwapRunFromCD": "true",
450
+ "SwapRunFromNET": "true",
451
+ "TargetMachine": "MachineX86",
452
+ "TerminalServerAware": "false",
453
+ "TrackerLogDirectory": "a_folder",
454
+ "TreatLinkerWarningAsErrors": "true",
455
+ "TurnOffAssemblyGeneration": "true",
456
+ "TypeLibraryFile": "a_file_name",
457
+ "TypeLibraryResourceID": "33",
458
+ "UACExecutionLevel": "AsInvoker",
459
+ "UACUIAccess": "true",
460
+ "Version": "a string1",
461
+ },
462
+ "ResourceCompile": {
463
+ "AdditionalIncludeDirectories": "folder1;folder2",
464
+ "AdditionalOptions": "a string1",
465
+ "Culture": "0x236",
466
+ "IgnoreStandardIncludePath": "true",
467
+ "NullTerminateStrings": "true",
468
+ "PreprocessorDefinitions": "string1;string2",
469
+ "ResourceOutputFileName": "a string1",
470
+ "ShowProgress": "true",
471
+ "SuppressStartupBanner": "true",
472
+ "TrackerLogDirectory": "a_folder",
473
+ "UndefinePreprocessorDefinitions": "string1;string2",
474
+ },
475
+ "Midl": {
476
+ "AdditionalIncludeDirectories": "folder1;folder2",
477
+ "AdditionalOptions": "a string1",
478
+ "ApplicationConfigurationMode": "true",
479
+ "ClientStubFile": "a_file_name",
480
+ "CPreprocessOptions": "a string1",
481
+ "DefaultCharType": "Signed",
482
+ "DllDataFileName": "a_file_name",
483
+ "EnableErrorChecks": "EnableCustom",
484
+ "ErrorCheckAllocations": "true",
485
+ "ErrorCheckBounds": "true",
486
+ "ErrorCheckEnumRange": "true",
487
+ "ErrorCheckRefPointers": "true",
488
+ "ErrorCheckStubData": "true",
489
+ "GenerateClientFiles": "Stub",
490
+ "GenerateServerFiles": "None",
491
+ "GenerateStublessProxies": "true",
492
+ "GenerateTypeLibrary": "true",
493
+ "HeaderFileName": "a_file_name",
494
+ "IgnoreStandardIncludePath": "true",
495
+ "InterfaceIdentifierFileName": "a_file_name",
496
+ "LocaleID": "33",
497
+ "MkTypLibCompatible": "true",
498
+ "OutputDirectory": "a string1",
499
+ "PreprocessorDefinitions": "string1;string2",
500
+ "ProxyFileName": "a_file_name",
501
+ "RedirectOutputAndErrors": "a_file_name",
502
+ "ServerStubFile": "a_file_name",
503
+ "StructMemberAlignment": "NotSet",
504
+ "SuppressCompilerWarnings": "true",
505
+ "SuppressStartupBanner": "true",
506
+ "TargetEnvironment": "Itanium",
507
+ "TrackerLogDirectory": "a_folder",
508
+ "TypeLibFormat": "NewFormat",
509
+ "TypeLibraryName": "a_file_name",
510
+ "UndefinePreprocessorDefinitions": "string1;string2",
511
+ "ValidateAllParameters": "true",
512
+ "WarnAsError": "true",
513
+ "WarningLevel": "1",
514
+ },
515
+ "Lib": {
516
+ "AdditionalDependencies": "file1;file2",
517
+ "AdditionalLibraryDirectories": "folder1;folder2",
518
+ "AdditionalOptions": "a string1",
519
+ "DisplayLibrary": "a string1",
520
+ "ErrorReporting": "PromptImmediately",
521
+ "ExportNamedFunctions": "string1;string2",
522
+ "ForceSymbolReferences": "a string1",
523
+ "IgnoreAllDefaultLibraries": "true",
524
+ "IgnoreSpecificDefaultLibraries": "file1;file2",
525
+ "LinkTimeCodeGeneration": "true",
526
+ "MinimumRequiredVersion": "a string1",
527
+ "ModuleDefinitionFile": "a_file_name",
528
+ "Name": "a_file_name",
529
+ "OutputFile": "a_file_name",
530
+ "RemoveObjects": "file1;file2",
531
+ "SubSystem": "Console",
532
+ "SuppressStartupBanner": "true",
533
+ "TargetMachine": "MachineX86i",
534
+ "TrackerLogDirectory": "a_folder",
535
+ "TreatLibWarningAsErrors": "true",
536
+ "UseUnicodeResponseFiles": "true",
537
+ "Verbose": "true",
538
+ },
539
+ "Manifest": {
540
+ "AdditionalManifestFiles": "file1;file2",
541
+ "AdditionalOptions": "a string1",
542
+ "AssemblyIdentity": "a string1",
543
+ "ComponentFileName": "a_file_name",
544
+ "EnableDPIAwareness": "fal",
545
+ "GenerateCatalogFiles": "truel",
546
+ "GenerateCategoryTags": "true",
547
+ "InputResourceManifests": "a string1",
548
+ "ManifestFromManagedAssembly": "a_file_name",
549
+ "notgood3": "bogus",
550
+ "OutputManifestFile": "a_file_name",
551
+ "OutputResourceManifests": "a string1",
552
+ "RegistrarScriptFile": "a_file_name",
553
+ "ReplacementsFile": "a_file_name",
554
+ "SuppressDependencyElement": "true",
555
+ "SuppressStartupBanner": "true",
556
+ "TrackerLogDirectory": "a_folder",
557
+ "TypeLibraryFile": "a_file_name",
558
+ "UpdateFileHashes": "true",
559
+ "UpdateFileHashesSearchPath": "a_file_name",
560
+ "VerboseOutput": "true",
561
+ },
562
+ "ProjectReference": {
563
+ "LinkLibraryDependencies": "true",
564
+ "UseLibraryDependencyInputs": "true",
565
+ },
566
+ "ManifestResourceCompile": {"ResourceOutputFileName": "a_file_name"},
567
+ "": {
568
+ "EmbedManifest": "true",
569
+ "GenerateManifest": "true",
570
+ "IgnoreImportLibrary": "true",
571
+ "LinkIncremental": "false",
572
+ },
573
+ },
574
+ self.stderr,
575
+ )
576
+ self._ExpectedWarnings(
577
+ [
578
+ "Warning: unrecognized setting ClCompile/Enableprefast",
579
+ "Warning: unrecognized setting ClCompile/ZZXYZ",
580
+ "Warning: unrecognized setting Manifest/notgood3",
581
+ "Warning: for Manifest/GenerateCatalogFiles, "
582
+ "expected bool; got 'truel'",
583
+ "Warning: for Lib/TargetMachine, unrecognized enumerated value "
584
+ "MachineX86i",
585
+ "Warning: for Manifest/EnableDPIAwareness, expected bool; got 'fal'",
586
+ ]
587
+ )
588
+
589
+ def testConvertToMSBuildSettings_empty(self):
590
+ """Tests an empty conversion."""
591
+ msvs_settings = {}
592
+ expected_msbuild_settings = {}
593
+ actual_msbuild_settings = MSVSSettings.ConvertToMSBuildSettings(
594
+ msvs_settings, self.stderr
595
+ )
596
+ self.assertEqual(expected_msbuild_settings, actual_msbuild_settings)
597
+ self._ExpectedWarnings([])
598
+
599
+ def testConvertToMSBuildSettings_minimal(self):
600
+ """Tests a minimal conversion."""
601
+ msvs_settings = {
602
+ "VCCLCompilerTool": {
603
+ "AdditionalIncludeDirectories": "dir1",
604
+ "AdditionalOptions": "/foo",
605
+ "BasicRuntimeChecks": "0",
606
+ },
607
+ "VCLinkerTool": {
608
+ "LinkTimeCodeGeneration": "1",
609
+ "ErrorReporting": "1",
610
+ "DataExecutionPrevention": "2",
611
+ },
612
+ }
613
+ expected_msbuild_settings = {
614
+ "ClCompile": {
615
+ "AdditionalIncludeDirectories": "dir1",
616
+ "AdditionalOptions": "/foo",
617
+ "BasicRuntimeChecks": "Default",
618
+ },
619
+ "Link": {
620
+ "LinkTimeCodeGeneration": "UseLinkTimeCodeGeneration",
621
+ "LinkErrorReporting": "PromptImmediately",
622
+ "DataExecutionPrevention": "true",
623
+ },
624
+ }
625
+ actual_msbuild_settings = MSVSSettings.ConvertToMSBuildSettings(
626
+ msvs_settings, self.stderr
627
+ )
628
+ self.assertEqual(expected_msbuild_settings, actual_msbuild_settings)
629
+ self._ExpectedWarnings([])
630
+
631
+ def testConvertToMSBuildSettings_warnings(self):
632
+ """Tests conversion that generates warnings."""
633
+ msvs_settings = {
634
+ "VCCLCompilerTool": {
635
+ "AdditionalIncludeDirectories": "1",
636
+ "AdditionalOptions": "2",
637
+ # These are incorrect values:
638
+ "BasicRuntimeChecks": "12",
639
+ "BrowseInformation": "21",
640
+ "UsePrecompiledHeader": "13",
641
+ "GeneratePreprocessedFile": "14",
642
+ },
643
+ "VCLinkerTool": {
644
+ # These are incorrect values:
645
+ "Driver": "10",
646
+ "LinkTimeCodeGeneration": "31",
647
+ "ErrorReporting": "21",
648
+ "FixedBaseAddress": "6",
649
+ },
650
+ "VCResourceCompilerTool": {
651
+ # Custom
652
+ "Culture": "1003"
653
+ },
654
+ }
655
+ expected_msbuild_settings = {
656
+ "ClCompile": {
657
+ "AdditionalIncludeDirectories": "1",
658
+ "AdditionalOptions": "2",
659
+ },
660
+ "Link": {},
661
+ "ResourceCompile": {
662
+ # Custom
663
+ "Culture": "0x03eb"
664
+ },
665
+ }
666
+ actual_msbuild_settings = MSVSSettings.ConvertToMSBuildSettings(
667
+ msvs_settings, self.stderr
668
+ )
669
+ self.assertEqual(expected_msbuild_settings, actual_msbuild_settings)
670
+ self._ExpectedWarnings(
671
+ [
672
+ "Warning: while converting VCCLCompilerTool/BasicRuntimeChecks to "
673
+ "MSBuild, index value (12) not in expected range [0, 4)",
674
+ "Warning: while converting VCCLCompilerTool/BrowseInformation to "
675
+ "MSBuild, index value (21) not in expected range [0, 3)",
676
+ "Warning: while converting VCCLCompilerTool/UsePrecompiledHeader to "
677
+ "MSBuild, index value (13) not in expected range [0, 3)",
678
+ "Warning: while converting "
679
+ "VCCLCompilerTool/GeneratePreprocessedFile to "
680
+ "MSBuild, value must be one of [0, 1, 2]; got 14",
681
+ "Warning: while converting VCLinkerTool/Driver to "
682
+ "MSBuild, index value (10) not in expected range [0, 4)",
683
+ "Warning: while converting VCLinkerTool/LinkTimeCodeGeneration to "
684
+ "MSBuild, index value (31) not in expected range [0, 5)",
685
+ "Warning: while converting VCLinkerTool/ErrorReporting to "
686
+ "MSBuild, index value (21) not in expected range [0, 3)",
687
+ "Warning: while converting VCLinkerTool/FixedBaseAddress to "
688
+ "MSBuild, index value (6) not in expected range [0, 3)",
689
+ ]
690
+ )
691
+
692
+ def testConvertToMSBuildSettings_full_synthetic(self):
693
+ """Tests conversion of all the MSBuild settings."""
694
+ msvs_settings = {
695
+ "VCCLCompilerTool": {
696
+ "AdditionalIncludeDirectories": "folder1;folder2;folder3",
697
+ "AdditionalOptions": "a_string",
698
+ "AdditionalUsingDirectories": "folder1;folder2;folder3",
699
+ "AssemblerListingLocation": "a_file_name",
700
+ "AssemblerOutput": "0",
701
+ "BasicRuntimeChecks": "1",
702
+ "BrowseInformation": "2",
703
+ "BrowseInformationFile": "a_file_name",
704
+ "BufferSecurityCheck": "true",
705
+ "CallingConvention": "0",
706
+ "CompileAs": "1",
707
+ "DebugInformationFormat": "4",
708
+ "DefaultCharIsUnsigned": "true",
709
+ "Detect64BitPortabilityProblems": "true",
710
+ "DisableLanguageExtensions": "true",
711
+ "DisableSpecificWarnings": "d1;d2;d3",
712
+ "EnableEnhancedInstructionSet": "0",
713
+ "EnableFiberSafeOptimizations": "true",
714
+ "EnableFunctionLevelLinking": "true",
715
+ "EnableIntrinsicFunctions": "true",
716
+ "EnablePREfast": "true",
717
+ "ErrorReporting": "1",
718
+ "ExceptionHandling": "2",
719
+ "ExpandAttributedSource": "true",
720
+ "FavorSizeOrSpeed": "0",
721
+ "FloatingPointExceptions": "true",
722
+ "FloatingPointModel": "1",
723
+ "ForceConformanceInForLoopScope": "true",
724
+ "ForcedIncludeFiles": "file1;file2;file3",
725
+ "ForcedUsingFiles": "file1;file2;file3",
726
+ "GeneratePreprocessedFile": "1",
727
+ "GenerateXMLDocumentationFiles": "true",
728
+ "IgnoreStandardIncludePath": "true",
729
+ "InlineFunctionExpansion": "2",
730
+ "KeepComments": "true",
731
+ "MinimalRebuild": "true",
732
+ "ObjectFile": "a_file_name",
733
+ "OmitDefaultLibName": "true",
734
+ "OmitFramePointers": "true",
735
+ "OpenMP": "true",
736
+ "Optimization": "3",
737
+ "PrecompiledHeaderFile": "a_file_name",
738
+ "PrecompiledHeaderThrough": "a_file_name",
739
+ "PreprocessorDefinitions": "d1;d2;d3",
740
+ "ProgramDataBaseFileName": "a_file_name",
741
+ "RuntimeLibrary": "0",
742
+ "RuntimeTypeInfo": "true",
743
+ "ShowIncludes": "true",
744
+ "SmallerTypeCheck": "true",
745
+ "StringPooling": "true",
746
+ "StructMemberAlignment": "1",
747
+ "SuppressStartupBanner": "true",
748
+ "TreatWChar_tAsBuiltInType": "true",
749
+ "UndefineAllPreprocessorDefinitions": "true",
750
+ "UndefinePreprocessorDefinitions": "d1;d2;d3",
751
+ "UseFullPaths": "true",
752
+ "UsePrecompiledHeader": "1",
753
+ "UseUnicodeResponseFiles": "true",
754
+ "WarnAsError": "true",
755
+ "WarningLevel": "2",
756
+ "WholeProgramOptimization": "true",
757
+ "XMLDocumentationFileName": "a_file_name",
758
+ },
759
+ "VCLinkerTool": {
760
+ "AdditionalDependencies": "file1;file2;file3",
761
+ "AdditionalLibraryDirectories": "folder1;folder2;folder3",
762
+ "AdditionalLibraryDirectories_excluded": "folder1;folder2;folder3",
763
+ "AdditionalManifestDependencies": "file1;file2;file3",
764
+ "AdditionalOptions": "a_string",
765
+ "AddModuleNamesToAssembly": "file1;file2;file3",
766
+ "AllowIsolation": "true",
767
+ "AssemblyDebug": "0",
768
+ "AssemblyLinkResource": "file1;file2;file3",
769
+ "BaseAddress": "a_string",
770
+ "CLRImageType": "1",
771
+ "CLRThreadAttribute": "2",
772
+ "CLRUnmanagedCodeCheck": "true",
773
+ "DataExecutionPrevention": "0",
774
+ "DelayLoadDLLs": "file1;file2;file3",
775
+ "DelaySign": "true",
776
+ "Driver": "1",
777
+ "EmbedManagedResourceFile": "file1;file2;file3",
778
+ "EnableCOMDATFolding": "0",
779
+ "EnableUAC": "true",
780
+ "EntryPointSymbol": "a_string",
781
+ "ErrorReporting": "0",
782
+ "FixedBaseAddress": "1",
783
+ "ForceSymbolReferences": "file1;file2;file3",
784
+ "FunctionOrder": "a_file_name",
785
+ "GenerateDebugInformation": "true",
786
+ "GenerateManifest": "true",
787
+ "GenerateMapFile": "true",
788
+ "HeapCommitSize": "a_string",
789
+ "HeapReserveSize": "a_string",
790
+ "IgnoreAllDefaultLibraries": "true",
791
+ "IgnoreDefaultLibraryNames": "file1;file2;file3",
792
+ "IgnoreEmbeddedIDL": "true",
793
+ "IgnoreImportLibrary": "true",
794
+ "ImportLibrary": "a_file_name",
795
+ "KeyContainer": "a_file_name",
796
+ "KeyFile": "a_file_name",
797
+ "LargeAddressAware": "2",
798
+ "LinkIncremental": "1",
799
+ "LinkLibraryDependencies": "true",
800
+ "LinkTimeCodeGeneration": "2",
801
+ "ManifestFile": "a_file_name",
802
+ "MapExports": "true",
803
+ "MapFileName": "a_file_name",
804
+ "MergedIDLBaseFileName": "a_file_name",
805
+ "MergeSections": "a_string",
806
+ "MidlCommandFile": "a_file_name",
807
+ "ModuleDefinitionFile": "a_file_name",
808
+ "OptimizeForWindows98": "1",
809
+ "OptimizeReferences": "0",
810
+ "OutputFile": "a_file_name",
811
+ "PerUserRedirection": "true",
812
+ "Profile": "true",
813
+ "ProfileGuidedDatabase": "a_file_name",
814
+ "ProgramDatabaseFile": "a_file_name",
815
+ "RandomizedBaseAddress": "1",
816
+ "RegisterOutput": "true",
817
+ "ResourceOnlyDLL": "true",
818
+ "SetChecksum": "true",
819
+ "ShowProgress": "0",
820
+ "StackCommitSize": "a_string",
821
+ "StackReserveSize": "a_string",
822
+ "StripPrivateSymbols": "a_file_name",
823
+ "SubSystem": "2",
824
+ "SupportUnloadOfDelayLoadedDLL": "true",
825
+ "SuppressStartupBanner": "true",
826
+ "SwapRunFromCD": "true",
827
+ "SwapRunFromNet": "true",
828
+ "TargetMachine": "3",
829
+ "TerminalServerAware": "2",
830
+ "TurnOffAssemblyGeneration": "true",
831
+ "TypeLibraryFile": "a_file_name",
832
+ "TypeLibraryResourceID": "33",
833
+ "UACExecutionLevel": "1",
834
+ "UACUIAccess": "true",
835
+ "UseLibraryDependencyInputs": "false",
836
+ "UseUnicodeResponseFiles": "true",
837
+ "Version": "a_string",
838
+ },
839
+ "VCResourceCompilerTool": {
840
+ "AdditionalIncludeDirectories": "folder1;folder2;folder3",
841
+ "AdditionalOptions": "a_string",
842
+ "Culture": "1003",
843
+ "IgnoreStandardIncludePath": "true",
844
+ "PreprocessorDefinitions": "d1;d2;d3",
845
+ "ResourceOutputFileName": "a_string",
846
+ "ShowProgress": "true",
847
+ "SuppressStartupBanner": "true",
848
+ "UndefinePreprocessorDefinitions": "d1;d2;d3",
849
+ },
850
+ "VCMIDLTool": {
851
+ "AdditionalIncludeDirectories": "folder1;folder2;folder3",
852
+ "AdditionalOptions": "a_string",
853
+ "CPreprocessOptions": "a_string",
854
+ "DefaultCharType": "0",
855
+ "DLLDataFileName": "a_file_name",
856
+ "EnableErrorChecks": "2",
857
+ "ErrorCheckAllocations": "true",
858
+ "ErrorCheckBounds": "true",
859
+ "ErrorCheckEnumRange": "true",
860
+ "ErrorCheckRefPointers": "true",
861
+ "ErrorCheckStubData": "true",
862
+ "GenerateStublessProxies": "true",
863
+ "GenerateTypeLibrary": "true",
864
+ "HeaderFileName": "a_file_name",
865
+ "IgnoreStandardIncludePath": "true",
866
+ "InterfaceIdentifierFileName": "a_file_name",
867
+ "MkTypLibCompatible": "true",
868
+ "OutputDirectory": "a_string",
869
+ "PreprocessorDefinitions": "d1;d2;d3",
870
+ "ProxyFileName": "a_file_name",
871
+ "RedirectOutputAndErrors": "a_file_name",
872
+ "StructMemberAlignment": "3",
873
+ "SuppressStartupBanner": "true",
874
+ "TargetEnvironment": "1",
875
+ "TypeLibraryName": "a_file_name",
876
+ "UndefinePreprocessorDefinitions": "d1;d2;d3",
877
+ "ValidateParameters": "true",
878
+ "WarnAsError": "true",
879
+ "WarningLevel": "4",
880
+ },
881
+ "VCLibrarianTool": {
882
+ "AdditionalDependencies": "file1;file2;file3",
883
+ "AdditionalLibraryDirectories": "folder1;folder2;folder3",
884
+ "AdditionalLibraryDirectories_excluded": "folder1;folder2;folder3",
885
+ "AdditionalOptions": "a_string",
886
+ "ExportNamedFunctions": "d1;d2;d3",
887
+ "ForceSymbolReferences": "a_string",
888
+ "IgnoreAllDefaultLibraries": "true",
889
+ "IgnoreSpecificDefaultLibraries": "file1;file2;file3",
890
+ "LinkLibraryDependencies": "true",
891
+ "ModuleDefinitionFile": "a_file_name",
892
+ "OutputFile": "a_file_name",
893
+ "SuppressStartupBanner": "true",
894
+ "UseUnicodeResponseFiles": "true",
895
+ },
896
+ "VCManifestTool": {
897
+ "AdditionalManifestFiles": "file1;file2;file3",
898
+ "AdditionalOptions": "a_string",
899
+ "AssemblyIdentity": "a_string",
900
+ "ComponentFileName": "a_file_name",
901
+ "DependencyInformationFile": "a_file_name",
902
+ "EmbedManifest": "true",
903
+ "GenerateCatalogFiles": "true",
904
+ "InputResourceManifests": "a_string",
905
+ "ManifestResourceFile": "my_name",
906
+ "OutputManifestFile": "a_file_name",
907
+ "RegistrarScriptFile": "a_file_name",
908
+ "ReplacementsFile": "a_file_name",
909
+ "SuppressStartupBanner": "true",
910
+ "TypeLibraryFile": "a_file_name",
911
+ "UpdateFileHashes": "true",
912
+ "UpdateFileHashesSearchPath": "a_file_name",
913
+ "UseFAT32Workaround": "true",
914
+ "UseUnicodeResponseFiles": "true",
915
+ "VerboseOutput": "true",
916
+ },
917
+ }
918
+ expected_msbuild_settings = {
919
+ "ClCompile": {
920
+ "AdditionalIncludeDirectories": "folder1;folder2;folder3",
921
+ "AdditionalOptions": "a_string /J",
922
+ "AdditionalUsingDirectories": "folder1;folder2;folder3",
923
+ "AssemblerListingLocation": "a_file_name",
924
+ "AssemblerOutput": "NoListing",
925
+ "BasicRuntimeChecks": "StackFrameRuntimeCheck",
926
+ "BrowseInformation": "true",
927
+ "BrowseInformationFile": "a_file_name",
928
+ "BufferSecurityCheck": "true",
929
+ "CallingConvention": "Cdecl",
930
+ "CompileAs": "CompileAsC",
931
+ "DebugInformationFormat": "EditAndContinue",
932
+ "DisableLanguageExtensions": "true",
933
+ "DisableSpecificWarnings": "d1;d2;d3",
934
+ "EnableEnhancedInstructionSet": "NotSet",
935
+ "EnableFiberSafeOptimizations": "true",
936
+ "EnablePREfast": "true",
937
+ "ErrorReporting": "Prompt",
938
+ "ExceptionHandling": "Async",
939
+ "ExpandAttributedSource": "true",
940
+ "FavorSizeOrSpeed": "Neither",
941
+ "FloatingPointExceptions": "true",
942
+ "FloatingPointModel": "Strict",
943
+ "ForceConformanceInForLoopScope": "true",
944
+ "ForcedIncludeFiles": "file1;file2;file3",
945
+ "ForcedUsingFiles": "file1;file2;file3",
946
+ "FunctionLevelLinking": "true",
947
+ "GenerateXMLDocumentationFiles": "true",
948
+ "IgnoreStandardIncludePath": "true",
949
+ "InlineFunctionExpansion": "AnySuitable",
950
+ "IntrinsicFunctions": "true",
951
+ "MinimalRebuild": "true",
952
+ "ObjectFileName": "a_file_name",
953
+ "OmitDefaultLibName": "true",
954
+ "OmitFramePointers": "true",
955
+ "OpenMPSupport": "true",
956
+ "Optimization": "Full",
957
+ "PrecompiledHeader": "Create",
958
+ "PrecompiledHeaderFile": "a_file_name",
959
+ "PrecompiledHeaderOutputFile": "a_file_name",
960
+ "PreprocessKeepComments": "true",
961
+ "PreprocessorDefinitions": "d1;d2;d3",
962
+ "PreprocessSuppressLineNumbers": "false",
963
+ "PreprocessToFile": "true",
964
+ "ProgramDataBaseFileName": "a_file_name",
965
+ "RuntimeLibrary": "MultiThreaded",
966
+ "RuntimeTypeInfo": "true",
967
+ "ShowIncludes": "true",
968
+ "SmallerTypeCheck": "true",
969
+ "StringPooling": "true",
970
+ "StructMemberAlignment": "1Byte",
971
+ "SuppressStartupBanner": "true",
972
+ "TreatWarningAsError": "true",
973
+ "TreatWChar_tAsBuiltInType": "true",
974
+ "UndefineAllPreprocessorDefinitions": "true",
975
+ "UndefinePreprocessorDefinitions": "d1;d2;d3",
976
+ "UseFullPaths": "true",
977
+ "WarningLevel": "Level2",
978
+ "WholeProgramOptimization": "true",
979
+ "XMLDocumentationFileName": "a_file_name",
980
+ },
981
+ "Link": {
982
+ "AdditionalDependencies": "file1;file2;file3",
983
+ "AdditionalLibraryDirectories": "folder1;folder2;folder3",
984
+ "AdditionalManifestDependencies": "file1;file2;file3",
985
+ "AdditionalOptions": "a_string",
986
+ "AddModuleNamesToAssembly": "file1;file2;file3",
987
+ "AllowIsolation": "true",
988
+ "AssemblyDebug": "",
989
+ "AssemblyLinkResource": "file1;file2;file3",
990
+ "BaseAddress": "a_string",
991
+ "CLRImageType": "ForceIJWImage",
992
+ "CLRThreadAttribute": "STAThreadingAttribute",
993
+ "CLRUnmanagedCodeCheck": "true",
994
+ "DataExecutionPrevention": "",
995
+ "DelayLoadDLLs": "file1;file2;file3",
996
+ "DelaySign": "true",
997
+ "Driver": "Driver",
998
+ "EmbedManagedResourceFile": "file1;file2;file3",
999
+ "EnableCOMDATFolding": "",
1000
+ "EnableUAC": "true",
1001
+ "EntryPointSymbol": "a_string",
1002
+ "FixedBaseAddress": "false",
1003
+ "ForceSymbolReferences": "file1;file2;file3",
1004
+ "FunctionOrder": "a_file_name",
1005
+ "GenerateDebugInformation": "true",
1006
+ "GenerateMapFile": "true",
1007
+ "HeapCommitSize": "a_string",
1008
+ "HeapReserveSize": "a_string",
1009
+ "IgnoreAllDefaultLibraries": "true",
1010
+ "IgnoreEmbeddedIDL": "true",
1011
+ "IgnoreSpecificDefaultLibraries": "file1;file2;file3",
1012
+ "ImportLibrary": "a_file_name",
1013
+ "KeyContainer": "a_file_name",
1014
+ "KeyFile": "a_file_name",
1015
+ "LargeAddressAware": "true",
1016
+ "LinkErrorReporting": "NoErrorReport",
1017
+ "LinkTimeCodeGeneration": "PGInstrument",
1018
+ "ManifestFile": "a_file_name",
1019
+ "MapExports": "true",
1020
+ "MapFileName": "a_file_name",
1021
+ "MergedIDLBaseFileName": "a_file_name",
1022
+ "MergeSections": "a_string",
1023
+ "MidlCommandFile": "a_file_name",
1024
+ "ModuleDefinitionFile": "a_file_name",
1025
+ "NoEntryPoint": "true",
1026
+ "OptimizeReferences": "",
1027
+ "OutputFile": "a_file_name",
1028
+ "PerUserRedirection": "true",
1029
+ "Profile": "true",
1030
+ "ProfileGuidedDatabase": "a_file_name",
1031
+ "ProgramDatabaseFile": "a_file_name",
1032
+ "RandomizedBaseAddress": "false",
1033
+ "RegisterOutput": "true",
1034
+ "SetChecksum": "true",
1035
+ "ShowProgress": "NotSet",
1036
+ "StackCommitSize": "a_string",
1037
+ "StackReserveSize": "a_string",
1038
+ "StripPrivateSymbols": "a_file_name",
1039
+ "SubSystem": "Windows",
1040
+ "SupportUnloadOfDelayLoadedDLL": "true",
1041
+ "SuppressStartupBanner": "true",
1042
+ "SwapRunFromCD": "true",
1043
+ "SwapRunFromNET": "true",
1044
+ "TargetMachine": "MachineARM",
1045
+ "TerminalServerAware": "true",
1046
+ "TurnOffAssemblyGeneration": "true",
1047
+ "TypeLibraryFile": "a_file_name",
1048
+ "TypeLibraryResourceID": "33",
1049
+ "UACExecutionLevel": "HighestAvailable",
1050
+ "UACUIAccess": "true",
1051
+ "Version": "a_string",
1052
+ },
1053
+ "ResourceCompile": {
1054
+ "AdditionalIncludeDirectories": "folder1;folder2;folder3",
1055
+ "AdditionalOptions": "a_string",
1056
+ "Culture": "0x03eb",
1057
+ "IgnoreStandardIncludePath": "true",
1058
+ "PreprocessorDefinitions": "d1;d2;d3",
1059
+ "ResourceOutputFileName": "a_string",
1060
+ "ShowProgress": "true",
1061
+ "SuppressStartupBanner": "true",
1062
+ "UndefinePreprocessorDefinitions": "d1;d2;d3",
1063
+ },
1064
+ "Midl": {
1065
+ "AdditionalIncludeDirectories": "folder1;folder2;folder3",
1066
+ "AdditionalOptions": "a_string",
1067
+ "CPreprocessOptions": "a_string",
1068
+ "DefaultCharType": "Unsigned",
1069
+ "DllDataFileName": "a_file_name",
1070
+ "EnableErrorChecks": "All",
1071
+ "ErrorCheckAllocations": "true",
1072
+ "ErrorCheckBounds": "true",
1073
+ "ErrorCheckEnumRange": "true",
1074
+ "ErrorCheckRefPointers": "true",
1075
+ "ErrorCheckStubData": "true",
1076
+ "GenerateStublessProxies": "true",
1077
+ "GenerateTypeLibrary": "true",
1078
+ "HeaderFileName": "a_file_name",
1079
+ "IgnoreStandardIncludePath": "true",
1080
+ "InterfaceIdentifierFileName": "a_file_name",
1081
+ "MkTypLibCompatible": "true",
1082
+ "OutputDirectory": "a_string",
1083
+ "PreprocessorDefinitions": "d1;d2;d3",
1084
+ "ProxyFileName": "a_file_name",
1085
+ "RedirectOutputAndErrors": "a_file_name",
1086
+ "StructMemberAlignment": "4",
1087
+ "SuppressStartupBanner": "true",
1088
+ "TargetEnvironment": "Win32",
1089
+ "TypeLibraryName": "a_file_name",
1090
+ "UndefinePreprocessorDefinitions": "d1;d2;d3",
1091
+ "ValidateAllParameters": "true",
1092
+ "WarnAsError": "true",
1093
+ "WarningLevel": "4",
1094
+ },
1095
+ "Lib": {
1096
+ "AdditionalDependencies": "file1;file2;file3",
1097
+ "AdditionalLibraryDirectories": "folder1;folder2;folder3",
1098
+ "AdditionalOptions": "a_string",
1099
+ "ExportNamedFunctions": "d1;d2;d3",
1100
+ "ForceSymbolReferences": "a_string",
1101
+ "IgnoreAllDefaultLibraries": "true",
1102
+ "IgnoreSpecificDefaultLibraries": "file1;file2;file3",
1103
+ "ModuleDefinitionFile": "a_file_name",
1104
+ "OutputFile": "a_file_name",
1105
+ "SuppressStartupBanner": "true",
1106
+ "UseUnicodeResponseFiles": "true",
1107
+ },
1108
+ "Manifest": {
1109
+ "AdditionalManifestFiles": "file1;file2;file3",
1110
+ "AdditionalOptions": "a_string",
1111
+ "AssemblyIdentity": "a_string",
1112
+ "ComponentFileName": "a_file_name",
1113
+ "GenerateCatalogFiles": "true",
1114
+ "InputResourceManifests": "a_string",
1115
+ "OutputManifestFile": "a_file_name",
1116
+ "RegistrarScriptFile": "a_file_name",
1117
+ "ReplacementsFile": "a_file_name",
1118
+ "SuppressStartupBanner": "true",
1119
+ "TypeLibraryFile": "a_file_name",
1120
+ "UpdateFileHashes": "true",
1121
+ "UpdateFileHashesSearchPath": "a_file_name",
1122
+ "VerboseOutput": "true",
1123
+ },
1124
+ "ManifestResourceCompile": {"ResourceOutputFileName": "my_name"},
1125
+ "ProjectReference": {
1126
+ "LinkLibraryDependencies": "true",
1127
+ "UseLibraryDependencyInputs": "false",
1128
+ },
1129
+ "": {
1130
+ "EmbedManifest": "true",
1131
+ "GenerateManifest": "true",
1132
+ "IgnoreImportLibrary": "true",
1133
+ "LinkIncremental": "false",
1134
+ },
1135
+ }
1136
+ self.maxDiff = 9999 # on failure display a long diff
1137
+ actual_msbuild_settings = MSVSSettings.ConvertToMSBuildSettings(
1138
+ msvs_settings, self.stderr
1139
+ )
1140
+ self.assertEqual(expected_msbuild_settings, actual_msbuild_settings)
1141
+ self._ExpectedWarnings([])
1142
+
1143
+ def testConvertToMSBuildSettings_actual(self):
1144
+ """Tests the conversion of an actual project.
1145
+
1146
+ A VS2008 project with most of the options defined was created through the
1147
+ VS2008 IDE. It was then converted to VS2010. The tool settings found in
1148
+ the .vcproj and .vcxproj files were converted to the two dictionaries
1149
+ msvs_settings and expected_msbuild_settings.
1150
+
1151
+ Note that for many settings, the VS2010 converter adds macros like
1152
+ %(AdditionalIncludeDirectories) to make sure than inherited values are
1153
+ included. Since the Gyp projects we generate do not use inheritance,
1154
+ we removed these macros. They were:
1155
+ ClCompile:
1156
+ AdditionalIncludeDirectories: ';%(AdditionalIncludeDirectories)'
1157
+ AdditionalOptions: ' %(AdditionalOptions)'
1158
+ AdditionalUsingDirectories: ';%(AdditionalUsingDirectories)'
1159
+ DisableSpecificWarnings: ';%(DisableSpecificWarnings)',
1160
+ ForcedIncludeFiles: ';%(ForcedIncludeFiles)',
1161
+ ForcedUsingFiles: ';%(ForcedUsingFiles)',
1162
+ PreprocessorDefinitions: ';%(PreprocessorDefinitions)',
1163
+ UndefinePreprocessorDefinitions:
1164
+ ';%(UndefinePreprocessorDefinitions)',
1165
+ Link:
1166
+ AdditionalDependencies: ';%(AdditionalDependencies)',
1167
+ AdditionalLibraryDirectories: ';%(AdditionalLibraryDirectories)',
1168
+ AdditionalManifestDependencies:
1169
+ ';%(AdditionalManifestDependencies)',
1170
+ AdditionalOptions: ' %(AdditionalOptions)',
1171
+ AddModuleNamesToAssembly: ';%(AddModuleNamesToAssembly)',
1172
+ AssemblyLinkResource: ';%(AssemblyLinkResource)',
1173
+ DelayLoadDLLs: ';%(DelayLoadDLLs)',
1174
+ EmbedManagedResourceFile: ';%(EmbedManagedResourceFile)',
1175
+ ForceSymbolReferences: ';%(ForceSymbolReferences)',
1176
+ IgnoreSpecificDefaultLibraries:
1177
+ ';%(IgnoreSpecificDefaultLibraries)',
1178
+ ResourceCompile:
1179
+ AdditionalIncludeDirectories: ';%(AdditionalIncludeDirectories)',
1180
+ AdditionalOptions: ' %(AdditionalOptions)',
1181
+ PreprocessorDefinitions: ';%(PreprocessorDefinitions)',
1182
+ Manifest:
1183
+ AdditionalManifestFiles: ';%(AdditionalManifestFiles)',
1184
+ AdditionalOptions: ' %(AdditionalOptions)',
1185
+ InputResourceManifests: ';%(InputResourceManifests)',
1186
+ """
1187
+ msvs_settings = {
1188
+ "VCCLCompilerTool": {
1189
+ "AdditionalIncludeDirectories": "dir1",
1190
+ "AdditionalOptions": "/more",
1191
+ "AdditionalUsingDirectories": "test",
1192
+ "AssemblerListingLocation": "$(IntDir)\\a",
1193
+ "AssemblerOutput": "1",
1194
+ "BasicRuntimeChecks": "3",
1195
+ "BrowseInformation": "1",
1196
+ "BrowseInformationFile": "$(IntDir)\\e",
1197
+ "BufferSecurityCheck": "false",
1198
+ "CallingConvention": "1",
1199
+ "CompileAs": "1",
1200
+ "DebugInformationFormat": "4",
1201
+ "DefaultCharIsUnsigned": "true",
1202
+ "Detect64BitPortabilityProblems": "true",
1203
+ "DisableLanguageExtensions": "true",
1204
+ "DisableSpecificWarnings": "abc",
1205
+ "EnableEnhancedInstructionSet": "1",
1206
+ "EnableFiberSafeOptimizations": "true",
1207
+ "EnableFunctionLevelLinking": "true",
1208
+ "EnableIntrinsicFunctions": "true",
1209
+ "EnablePREfast": "true",
1210
+ "ErrorReporting": "2",
1211
+ "ExceptionHandling": "2",
1212
+ "ExpandAttributedSource": "true",
1213
+ "FavorSizeOrSpeed": "2",
1214
+ "FloatingPointExceptions": "true",
1215
+ "FloatingPointModel": "1",
1216
+ "ForceConformanceInForLoopScope": "false",
1217
+ "ForcedIncludeFiles": "def",
1218
+ "ForcedUsingFiles": "ge",
1219
+ "GeneratePreprocessedFile": "2",
1220
+ "GenerateXMLDocumentationFiles": "true",
1221
+ "IgnoreStandardIncludePath": "true",
1222
+ "InlineFunctionExpansion": "1",
1223
+ "KeepComments": "true",
1224
+ "MinimalRebuild": "true",
1225
+ "ObjectFile": "$(IntDir)\\b",
1226
+ "OmitDefaultLibName": "true",
1227
+ "OmitFramePointers": "true",
1228
+ "OpenMP": "true",
1229
+ "Optimization": "3",
1230
+ "PrecompiledHeaderFile": "$(IntDir)\\$(TargetName).pche",
1231
+ "PrecompiledHeaderThrough": "StdAfx.hd",
1232
+ "PreprocessorDefinitions": "WIN32;_DEBUG;_CONSOLE",
1233
+ "ProgramDataBaseFileName": "$(IntDir)\\vc90b.pdb",
1234
+ "RuntimeLibrary": "3",
1235
+ "RuntimeTypeInfo": "false",
1236
+ "ShowIncludes": "true",
1237
+ "SmallerTypeCheck": "true",
1238
+ "StringPooling": "true",
1239
+ "StructMemberAlignment": "3",
1240
+ "SuppressStartupBanner": "false",
1241
+ "TreatWChar_tAsBuiltInType": "false",
1242
+ "UndefineAllPreprocessorDefinitions": "true",
1243
+ "UndefinePreprocessorDefinitions": "wer",
1244
+ "UseFullPaths": "true",
1245
+ "UsePrecompiledHeader": "0",
1246
+ "UseUnicodeResponseFiles": "false",
1247
+ "WarnAsError": "true",
1248
+ "WarningLevel": "3",
1249
+ "WholeProgramOptimization": "true",
1250
+ "XMLDocumentationFileName": "$(IntDir)\\c",
1251
+ },
1252
+ "VCLinkerTool": {
1253
+ "AdditionalDependencies": "zx",
1254
+ "AdditionalLibraryDirectories": "asd",
1255
+ "AdditionalManifestDependencies": "s2",
1256
+ "AdditionalOptions": "/mor2",
1257
+ "AddModuleNamesToAssembly": "d1",
1258
+ "AllowIsolation": "false",
1259
+ "AssemblyDebug": "1",
1260
+ "AssemblyLinkResource": "d5",
1261
+ "BaseAddress": "23423",
1262
+ "CLRImageType": "3",
1263
+ "CLRThreadAttribute": "1",
1264
+ "CLRUnmanagedCodeCheck": "true",
1265
+ "DataExecutionPrevention": "0",
1266
+ "DelayLoadDLLs": "d4",
1267
+ "DelaySign": "true",
1268
+ "Driver": "2",
1269
+ "EmbedManagedResourceFile": "d2",
1270
+ "EnableCOMDATFolding": "1",
1271
+ "EnableUAC": "false",
1272
+ "EntryPointSymbol": "f5",
1273
+ "ErrorReporting": "2",
1274
+ "FixedBaseAddress": "1",
1275
+ "ForceSymbolReferences": "d3",
1276
+ "FunctionOrder": "fssdfsd",
1277
+ "GenerateDebugInformation": "true",
1278
+ "GenerateManifest": "false",
1279
+ "GenerateMapFile": "true",
1280
+ "HeapCommitSize": "13",
1281
+ "HeapReserveSize": "12",
1282
+ "IgnoreAllDefaultLibraries": "true",
1283
+ "IgnoreDefaultLibraryNames": "flob;flok",
1284
+ "IgnoreEmbeddedIDL": "true",
1285
+ "IgnoreImportLibrary": "true",
1286
+ "ImportLibrary": "f4",
1287
+ "KeyContainer": "f7",
1288
+ "KeyFile": "f6",
1289
+ "LargeAddressAware": "2",
1290
+ "LinkIncremental": "0",
1291
+ "LinkLibraryDependencies": "false",
1292
+ "LinkTimeCodeGeneration": "1",
1293
+ "ManifestFile": "$(IntDir)\\$(TargetFileName).2intermediate.manifest",
1294
+ "MapExports": "true",
1295
+ "MapFileName": "d5",
1296
+ "MergedIDLBaseFileName": "f2",
1297
+ "MergeSections": "f5",
1298
+ "MidlCommandFile": "f1",
1299
+ "ModuleDefinitionFile": "sdsd",
1300
+ "OptimizeForWindows98": "2",
1301
+ "OptimizeReferences": "2",
1302
+ "OutputFile": "$(OutDir)\\$(ProjectName)2.exe",
1303
+ "PerUserRedirection": "true",
1304
+ "Profile": "true",
1305
+ "ProfileGuidedDatabase": "$(TargetDir)$(TargetName).pgdd",
1306
+ "ProgramDatabaseFile": "Flob.pdb",
1307
+ "RandomizedBaseAddress": "1",
1308
+ "RegisterOutput": "true",
1309
+ "ResourceOnlyDLL": "true",
1310
+ "SetChecksum": "false",
1311
+ "ShowProgress": "1",
1312
+ "StackCommitSize": "15",
1313
+ "StackReserveSize": "14",
1314
+ "StripPrivateSymbols": "d3",
1315
+ "SubSystem": "1",
1316
+ "SupportUnloadOfDelayLoadedDLL": "true",
1317
+ "SuppressStartupBanner": "false",
1318
+ "SwapRunFromCD": "true",
1319
+ "SwapRunFromNet": "true",
1320
+ "TargetMachine": "1",
1321
+ "TerminalServerAware": "1",
1322
+ "TurnOffAssemblyGeneration": "true",
1323
+ "TypeLibraryFile": "f3",
1324
+ "TypeLibraryResourceID": "12",
1325
+ "UACExecutionLevel": "2",
1326
+ "UACUIAccess": "true",
1327
+ "UseLibraryDependencyInputs": "true",
1328
+ "UseUnicodeResponseFiles": "false",
1329
+ "Version": "333",
1330
+ },
1331
+ "VCResourceCompilerTool": {
1332
+ "AdditionalIncludeDirectories": "f3",
1333
+ "AdditionalOptions": "/more3",
1334
+ "Culture": "3084",
1335
+ "IgnoreStandardIncludePath": "true",
1336
+ "PreprocessorDefinitions": "_UNICODE;UNICODE2",
1337
+ "ResourceOutputFileName": "$(IntDir)/$(InputName)3.res",
1338
+ "ShowProgress": "true",
1339
+ },
1340
+ "VCManifestTool": {
1341
+ "AdditionalManifestFiles": "sfsdfsd",
1342
+ "AdditionalOptions": "afdsdafsd",
1343
+ "AssemblyIdentity": "sddfdsadfsa",
1344
+ "ComponentFileName": "fsdfds",
1345
+ "DependencyInformationFile": "$(IntDir)\\mt.depdfd",
1346
+ "EmbedManifest": "false",
1347
+ "GenerateCatalogFiles": "true",
1348
+ "InputResourceManifests": "asfsfdafs",
1349
+ "ManifestResourceFile":
1350
+ "$(IntDir)\\$(TargetFileName).embed.manifest.resfdsf",
1351
+ "OutputManifestFile": "$(TargetPath).manifestdfs",
1352
+ "RegistrarScriptFile": "sdfsfd",
1353
+ "ReplacementsFile": "sdffsd",
1354
+ "SuppressStartupBanner": "false",
1355
+ "TypeLibraryFile": "sfsd",
1356
+ "UpdateFileHashes": "true",
1357
+ "UpdateFileHashesSearchPath": "sfsd",
1358
+ "UseFAT32Workaround": "true",
1359
+ "UseUnicodeResponseFiles": "false",
1360
+ "VerboseOutput": "true",
1361
+ },
1362
+ }
1363
+ expected_msbuild_settings = {
1364
+ "ClCompile": {
1365
+ "AdditionalIncludeDirectories": "dir1",
1366
+ "AdditionalOptions": "/more /J",
1367
+ "AdditionalUsingDirectories": "test",
1368
+ "AssemblerListingLocation": "$(IntDir)a",
1369
+ "AssemblerOutput": "AssemblyCode",
1370
+ "BasicRuntimeChecks": "EnableFastChecks",
1371
+ "BrowseInformation": "true",
1372
+ "BrowseInformationFile": "$(IntDir)e",
1373
+ "BufferSecurityCheck": "false",
1374
+ "CallingConvention": "FastCall",
1375
+ "CompileAs": "CompileAsC",
1376
+ "DebugInformationFormat": "EditAndContinue",
1377
+ "DisableLanguageExtensions": "true",
1378
+ "DisableSpecificWarnings": "abc",
1379
+ "EnableEnhancedInstructionSet": "StreamingSIMDExtensions",
1380
+ "EnableFiberSafeOptimizations": "true",
1381
+ "EnablePREfast": "true",
1382
+ "ErrorReporting": "Queue",
1383
+ "ExceptionHandling": "Async",
1384
+ "ExpandAttributedSource": "true",
1385
+ "FavorSizeOrSpeed": "Size",
1386
+ "FloatingPointExceptions": "true",
1387
+ "FloatingPointModel": "Strict",
1388
+ "ForceConformanceInForLoopScope": "false",
1389
+ "ForcedIncludeFiles": "def",
1390
+ "ForcedUsingFiles": "ge",
1391
+ "FunctionLevelLinking": "true",
1392
+ "GenerateXMLDocumentationFiles": "true",
1393
+ "IgnoreStandardIncludePath": "true",
1394
+ "InlineFunctionExpansion": "OnlyExplicitInline",
1395
+ "IntrinsicFunctions": "true",
1396
+ "MinimalRebuild": "true",
1397
+ "ObjectFileName": "$(IntDir)b",
1398
+ "OmitDefaultLibName": "true",
1399
+ "OmitFramePointers": "true",
1400
+ "OpenMPSupport": "true",
1401
+ "Optimization": "Full",
1402
+ "PrecompiledHeader": "NotUsing", # Actual conversion gives ''
1403
+ "PrecompiledHeaderFile": "StdAfx.hd",
1404
+ "PrecompiledHeaderOutputFile": "$(IntDir)$(TargetName).pche",
1405
+ "PreprocessKeepComments": "true",
1406
+ "PreprocessorDefinitions": "WIN32;_DEBUG;_CONSOLE",
1407
+ "PreprocessSuppressLineNumbers": "true",
1408
+ "PreprocessToFile": "true",
1409
+ "ProgramDataBaseFileName": "$(IntDir)vc90b.pdb",
1410
+ "RuntimeLibrary": "MultiThreadedDebugDLL",
1411
+ "RuntimeTypeInfo": "false",
1412
+ "ShowIncludes": "true",
1413
+ "SmallerTypeCheck": "true",
1414
+ "StringPooling": "true",
1415
+ "StructMemberAlignment": "4Bytes",
1416
+ "SuppressStartupBanner": "false",
1417
+ "TreatWarningAsError": "true",
1418
+ "TreatWChar_tAsBuiltInType": "false",
1419
+ "UndefineAllPreprocessorDefinitions": "true",
1420
+ "UndefinePreprocessorDefinitions": "wer",
1421
+ "UseFullPaths": "true",
1422
+ "WarningLevel": "Level3",
1423
+ "WholeProgramOptimization": "true",
1424
+ "XMLDocumentationFileName": "$(IntDir)c",
1425
+ },
1426
+ "Link": {
1427
+ "AdditionalDependencies": "zx",
1428
+ "AdditionalLibraryDirectories": "asd",
1429
+ "AdditionalManifestDependencies": "s2",
1430
+ "AdditionalOptions": "/mor2",
1431
+ "AddModuleNamesToAssembly": "d1",
1432
+ "AllowIsolation": "false",
1433
+ "AssemblyDebug": "true",
1434
+ "AssemblyLinkResource": "d5",
1435
+ "BaseAddress": "23423",
1436
+ "CLRImageType": "ForceSafeILImage",
1437
+ "CLRThreadAttribute": "MTAThreadingAttribute",
1438
+ "CLRUnmanagedCodeCheck": "true",
1439
+ "DataExecutionPrevention": "",
1440
+ "DelayLoadDLLs": "d4",
1441
+ "DelaySign": "true",
1442
+ "Driver": "UpOnly",
1443
+ "EmbedManagedResourceFile": "d2",
1444
+ "EnableCOMDATFolding": "false",
1445
+ "EnableUAC": "false",
1446
+ "EntryPointSymbol": "f5",
1447
+ "FixedBaseAddress": "false",
1448
+ "ForceSymbolReferences": "d3",
1449
+ "FunctionOrder": "fssdfsd",
1450
+ "GenerateDebugInformation": "true",
1451
+ "GenerateMapFile": "true",
1452
+ "HeapCommitSize": "13",
1453
+ "HeapReserveSize": "12",
1454
+ "IgnoreAllDefaultLibraries": "true",
1455
+ "IgnoreEmbeddedIDL": "true",
1456
+ "IgnoreSpecificDefaultLibraries": "flob;flok",
1457
+ "ImportLibrary": "f4",
1458
+ "KeyContainer": "f7",
1459
+ "KeyFile": "f6",
1460
+ "LargeAddressAware": "true",
1461
+ "LinkErrorReporting": "QueueForNextLogin",
1462
+ "LinkTimeCodeGeneration": "UseLinkTimeCodeGeneration",
1463
+ "ManifestFile": "$(IntDir)$(TargetFileName).2intermediate.manifest",
1464
+ "MapExports": "true",
1465
+ "MapFileName": "d5",
1466
+ "MergedIDLBaseFileName": "f2",
1467
+ "MergeSections": "f5",
1468
+ "MidlCommandFile": "f1",
1469
+ "ModuleDefinitionFile": "sdsd",
1470
+ "NoEntryPoint": "true",
1471
+ "OptimizeReferences": "true",
1472
+ "OutputFile": "$(OutDir)$(ProjectName)2.exe",
1473
+ "PerUserRedirection": "true",
1474
+ "Profile": "true",
1475
+ "ProfileGuidedDatabase": "$(TargetDir)$(TargetName).pgdd",
1476
+ "ProgramDatabaseFile": "Flob.pdb",
1477
+ "RandomizedBaseAddress": "false",
1478
+ "RegisterOutput": "true",
1479
+ "SetChecksum": "false",
1480
+ "ShowProgress": "LinkVerbose",
1481
+ "StackCommitSize": "15",
1482
+ "StackReserveSize": "14",
1483
+ "StripPrivateSymbols": "d3",
1484
+ "SubSystem": "Console",
1485
+ "SupportUnloadOfDelayLoadedDLL": "true",
1486
+ "SuppressStartupBanner": "false",
1487
+ "SwapRunFromCD": "true",
1488
+ "SwapRunFromNET": "true",
1489
+ "TargetMachine": "MachineX86",
1490
+ "TerminalServerAware": "false",
1491
+ "TurnOffAssemblyGeneration": "true",
1492
+ "TypeLibraryFile": "f3",
1493
+ "TypeLibraryResourceID": "12",
1494
+ "UACExecutionLevel": "RequireAdministrator",
1495
+ "UACUIAccess": "true",
1496
+ "Version": "333",
1497
+ },
1498
+ "ResourceCompile": {
1499
+ "AdditionalIncludeDirectories": "f3",
1500
+ "AdditionalOptions": "/more3",
1501
+ "Culture": "0x0c0c",
1502
+ "IgnoreStandardIncludePath": "true",
1503
+ "PreprocessorDefinitions": "_UNICODE;UNICODE2",
1504
+ "ResourceOutputFileName": "$(IntDir)%(Filename)3.res",
1505
+ "ShowProgress": "true",
1506
+ },
1507
+ "Manifest": {
1508
+ "AdditionalManifestFiles": "sfsdfsd",
1509
+ "AdditionalOptions": "afdsdafsd",
1510
+ "AssemblyIdentity": "sddfdsadfsa",
1511
+ "ComponentFileName": "fsdfds",
1512
+ "GenerateCatalogFiles": "true",
1513
+ "InputResourceManifests": "asfsfdafs",
1514
+ "OutputManifestFile": "$(TargetPath).manifestdfs",
1515
+ "RegistrarScriptFile": "sdfsfd",
1516
+ "ReplacementsFile": "sdffsd",
1517
+ "SuppressStartupBanner": "false",
1518
+ "TypeLibraryFile": "sfsd",
1519
+ "UpdateFileHashes": "true",
1520
+ "UpdateFileHashesSearchPath": "sfsd",
1521
+ "VerboseOutput": "true",
1522
+ },
1523
+ "ProjectReference": {
1524
+ "LinkLibraryDependencies": "false",
1525
+ "UseLibraryDependencyInputs": "true",
1526
+ },
1527
+ "": {
1528
+ "EmbedManifest": "false",
1529
+ "GenerateManifest": "false",
1530
+ "IgnoreImportLibrary": "true",
1531
+ "LinkIncremental": "",
1532
+ },
1533
+ "ManifestResourceCompile": {
1534
+ "ResourceOutputFileName":
1535
+ "$(IntDir)$(TargetFileName).embed.manifest.resfdsf"
1536
+ },
1537
+ }
1538
+ self.maxDiff = 9999 # on failure display a long diff
1539
+ actual_msbuild_settings = MSVSSettings.ConvertToMSBuildSettings(
1540
+ msvs_settings, self.stderr
1541
+ )
1542
+ self.assertEqual(expected_msbuild_settings, actual_msbuild_settings)
1543
+ self._ExpectedWarnings([])
1544
+
1545
+
1546
+ if __name__ == "__main__":
1547
+ unittest.main()