casbin-async-django-orm-adapter 1.0.0__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 (74) hide show
  1. async_casbin_adapter/__init__.py +0 -0
  2. async_casbin_adapter/adapter.py +100 -0
  3. async_casbin_adapter/apps.py +24 -0
  4. async_casbin_adapter/enforcer.py +81 -0
  5. async_casbin_adapter/migrations/0001_initial.py +37 -0
  6. async_casbin_adapter/migrations/__init__.py +0 -0
  7. async_casbin_adapter/models.py +48 -0
  8. async_casbin_adapter/utils.py +25 -0
  9. casbin_async_django_orm_adapter-1.0.0.dist-info/METADATA +116 -0
  10. casbin_async_django_orm_adapter-1.0.0.dist-info/RECORD +74 -0
  11. casbin_async_django_orm_adapter-1.0.0.dist-info/WHEEL +5 -0
  12. casbin_async_django_orm_adapter-1.0.0.dist-info/licenses/LICENSE +201 -0
  13. casbin_async_django_orm_adapter-1.0.0.dist-info/top_level.txt +3 -0
  14. node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py +45 -0
  15. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py +365 -0
  16. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py +206 -0
  17. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py +1272 -0
  18. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py +1547 -0
  19. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSToolFile.py +59 -0
  20. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py +152 -0
  21. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py +270 -0
  22. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py +574 -0
  23. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py +704 -0
  24. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/common.py +709 -0
  25. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/common_test.py +173 -0
  26. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py +169 -0
  27. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py +113 -0
  28. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py +55 -0
  29. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/__init__.py +0 -0
  30. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py +805 -0
  31. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py +1172 -0
  32. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py +1319 -0
  33. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py +128 -0
  34. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/dump_dependency_json.py +104 -0
  35. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py +462 -0
  36. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py +89 -0
  37. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/gypsh.py +56 -0
  38. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py +2745 -0
  39. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py +3976 -0
  40. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py +44 -0
  41. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py +2965 -0
  42. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py +67 -0
  43. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py +1391 -0
  44. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py +26 -0
  45. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py +3112 -0
  46. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input_test.py +99 -0
  47. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py +767 -0
  48. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py +1260 -0
  49. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py +174 -0
  50. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py +61 -0
  51. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py +373 -0
  52. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py +1939 -0
  53. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation_test.py +54 -0
  54. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py +303 -0
  55. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py +3196 -0
  56. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xml_fix.py +65 -0
  57. node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/__init__.py +15 -0
  58. node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/_elffile.py +108 -0
  59. node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/_manylinux.py +252 -0
  60. node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/_musllinux.py +83 -0
  61. node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/_parser.py +359 -0
  62. node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/_structures.py +61 -0
  63. node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/_tokenizer.py +192 -0
  64. node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/markers.py +252 -0
  65. node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/metadata.py +825 -0
  66. node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/py.typed +0 -0
  67. node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/requirements.py +90 -0
  68. node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/specifiers.py +1030 -0
  69. node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/tags.py +553 -0
  70. node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/utils.py +172 -0
  71. node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/version.py +563 -0
  72. node_modules/npm/node_modules/node-gyp/gyp/test_gyp.py +261 -0
  73. node_modules/semantic-release-pypi/dist/py/set_version.py +32 -0
  74. node_modules/semantic-release-pypi/dist/py/verify_setup.py +24 -0
@@ -0,0 +1,1272 @@
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
3
+ # found in the LICENSE file.
4
+
5
+ r"""Code to validate and convert settings of the Microsoft build tools.
6
+
7
+ This file contains code to validate and convert settings of the Microsoft
8
+ build tools. The function ConvertToMSBuildSettings(), ValidateMSVSSettings(),
9
+ and ValidateMSBuildSettings() are the entry points.
10
+
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.
13
+ The MSBuild schemas were also considered. They are typically found in the
14
+ MSBuild install directory, e.g. c:\Program Files (x86)\MSBuild
15
+ """
16
+
17
+ import re
18
+ import sys
19
+
20
+ # Dictionaries of settings validators. The key is the tool name, the value is
21
+ # a dictionary mapping setting names to validation functions.
22
+ _msvs_validators = {}
23
+ _msbuild_validators = {}
24
+
25
+
26
+ # A dictionary of settings converters. The key is the tool name, the value is
27
+ # a dictionary mapping setting names to conversion functions.
28
+ _msvs_to_msbuild_converters = {}
29
+
30
+
31
+ # Tool name mapping from MSVS to MSBuild.
32
+ _msbuild_name_of_tool = {}
33
+
34
+
35
+ class _Tool:
36
+ """Represents a tool used by MSVS or MSBuild.
37
+
38
+ Attributes:
39
+ msvs_name: The name of the tool in MSVS.
40
+ msbuild_name: The name of the tool in MSBuild.
41
+ """
42
+
43
+ def __init__(self, msvs_name, msbuild_name):
44
+ self.msvs_name = msvs_name
45
+ self.msbuild_name = msbuild_name
46
+
47
+
48
+ def _AddTool(tool):
49
+ """Adds a tool to the four dictionaries used to process settings.
50
+
51
+ This only defines the tool. Each setting also needs to be added.
52
+
53
+ Args:
54
+ tool: The _Tool object to be added.
55
+ """
56
+ _msvs_validators[tool.msvs_name] = {}
57
+ _msbuild_validators[tool.msbuild_name] = {}
58
+ _msvs_to_msbuild_converters[tool.msvs_name] = {}
59
+ _msbuild_name_of_tool[tool.msvs_name] = tool.msbuild_name
60
+
61
+
62
+ def _GetMSBuildToolSettings(msbuild_settings, tool):
63
+ """Returns an MSBuild tool dictionary. Creates it if needed."""
64
+ return msbuild_settings.setdefault(tool.msbuild_name, {})
65
+
66
+
67
+ class _Type:
68
+ """Type of settings (Base class)."""
69
+
70
+ def ValidateMSVS(self, value):
71
+ """Verifies that the value is legal for MSVS.
72
+
73
+ Args:
74
+ value: the value to check for this type.
75
+
76
+ Raises:
77
+ ValueError if value is not valid for MSVS.
78
+ """
79
+
80
+ def ValidateMSBuild(self, value):
81
+ """Verifies that the value is legal for MSBuild.
82
+
83
+ Args:
84
+ value: the value to check for this type.
85
+
86
+ Raises:
87
+ ValueError if value is not valid for MSBuild.
88
+ """
89
+
90
+ def ConvertToMSBuild(self, value):
91
+ """Returns the MSBuild equivalent of the MSVS value given.
92
+
93
+ Args:
94
+ value: the MSVS value to convert.
95
+
96
+ Returns:
97
+ the MSBuild equivalent.
98
+
99
+ Raises:
100
+ ValueError if value is not valid.
101
+ """
102
+ return value
103
+
104
+
105
+ class _String(_Type):
106
+ """A setting that's just a string."""
107
+
108
+ def ValidateMSVS(self, value):
109
+ if not isinstance(value, str):
110
+ raise ValueError("expected string; got %r" % value)
111
+
112
+ def ValidateMSBuild(self, value):
113
+ if not isinstance(value, str):
114
+ raise ValueError("expected string; got %r" % value)
115
+
116
+ def ConvertToMSBuild(self, value):
117
+ # Convert the macros
118
+ return ConvertVCMacrosToMSBuild(value)
119
+
120
+
121
+ class _StringList(_Type):
122
+ """A settings that's a list of strings."""
123
+
124
+ def ValidateMSVS(self, value):
125
+ if not isinstance(value, (list, str)):
126
+ raise ValueError("expected string list; got %r" % value)
127
+
128
+ def ValidateMSBuild(self, value):
129
+ if not isinstance(value, (list, str)):
130
+ raise ValueError("expected string list; got %r" % value)
131
+
132
+ def ConvertToMSBuild(self, value):
133
+ # Convert the macros
134
+ if isinstance(value, list):
135
+ return [ConvertVCMacrosToMSBuild(i) for i in value]
136
+ else:
137
+ return ConvertVCMacrosToMSBuild(value)
138
+
139
+
140
+ class _Boolean(_Type):
141
+ """Boolean settings, can have the values 'false' or 'true'."""
142
+
143
+ def _Validate(self, value):
144
+ if value not in {"true", "false"}:
145
+ raise ValueError("expected bool; got %r" % value)
146
+
147
+ def ValidateMSVS(self, value):
148
+ self._Validate(value)
149
+
150
+ def ValidateMSBuild(self, value):
151
+ self._Validate(value)
152
+
153
+ def ConvertToMSBuild(self, value):
154
+ self._Validate(value)
155
+ return value
156
+
157
+
158
+ class _Integer(_Type):
159
+ """Integer settings."""
160
+
161
+ def __init__(self, msbuild_base=10):
162
+ _Type.__init__(self)
163
+ self._msbuild_base = msbuild_base
164
+
165
+ def ValidateMSVS(self, value):
166
+ # Try to convert, this will raise ValueError if invalid.
167
+ self.ConvertToMSBuild(value)
168
+
169
+ def ValidateMSBuild(self, value):
170
+ # Try to convert, this will raise ValueError if invalid.
171
+ int(value, self._msbuild_base)
172
+
173
+ def ConvertToMSBuild(self, value):
174
+ msbuild_format = ((self._msbuild_base == 10) and "%d") or "0x%04x"
175
+ return msbuild_format % int(value)
176
+
177
+
178
+ class _Enumeration(_Type):
179
+ """Type of settings that is an enumeration.
180
+
181
+ In MSVS, the values are indexes like '0', '1', and '2'.
182
+ MSBuild uses text labels that are more representative, like 'Win32'.
183
+
184
+ Constructor args:
185
+ label_list: an array of MSBuild labels that correspond to the MSVS index.
186
+ In the rare cases where MSVS has skipped an index value, None is
187
+ used in the array to indicate the unused spot.
188
+ new: an array of labels that are new to MSBuild.
189
+ """
190
+
191
+ def __init__(self, label_list, new=None):
192
+ _Type.__init__(self)
193
+ self._label_list = label_list
194
+ self._msbuild_values = {value for value in label_list if value is not None}
195
+ if new is not None:
196
+ self._msbuild_values.update(new)
197
+
198
+ def ValidateMSVS(self, value):
199
+ # Try to convert. It will raise an exception if not valid.
200
+ self.ConvertToMSBuild(value)
201
+
202
+ def ValidateMSBuild(self, value):
203
+ if value not in self._msbuild_values:
204
+ raise ValueError("unrecognized enumerated value %s" % value)
205
+
206
+ def ConvertToMSBuild(self, value):
207
+ index = int(value)
208
+ if index < 0 or index >= len(self._label_list):
209
+ raise ValueError(
210
+ "index value (%d) not in expected range [0, %d)"
211
+ % (index, len(self._label_list))
212
+ )
213
+ label = self._label_list[index]
214
+ if label is None:
215
+ raise ValueError("converted value for %s not specified." % value)
216
+ return label
217
+
218
+
219
+ # Instantiate the various generic types.
220
+ _boolean = _Boolean()
221
+ _integer = _Integer()
222
+ # For now, we don't do any special validation on these types:
223
+ _string = _String()
224
+ _file_name = _String()
225
+ _folder_name = _String()
226
+ _file_list = _StringList()
227
+ _folder_list = _StringList()
228
+ _string_list = _StringList()
229
+ # Some boolean settings went from numerical values to boolean. The
230
+ # mapping is 0: default, 1: false, 2: true.
231
+ _newly_boolean = _Enumeration(["", "false", "true"])
232
+
233
+
234
+ def _Same(tool, name, setting_type):
235
+ """Defines a setting that has the same name in MSVS and MSBuild.
236
+
237
+ Args:
238
+ tool: a dictionary that gives the names of the tool for MSVS and MSBuild.
239
+ name: the name of the setting.
240
+ setting_type: the type of this setting.
241
+ """
242
+ _Renamed(tool, name, name, setting_type)
243
+
244
+
245
+ def _Renamed(tool, msvs_name, msbuild_name, setting_type):
246
+ """Defines a setting for which the name has changed.
247
+
248
+ Args:
249
+ tool: a dictionary that gives the names of the tool for MSVS and MSBuild.
250
+ msvs_name: the name of the MSVS setting.
251
+ msbuild_name: the name of the MSBuild setting.
252
+ setting_type: the type of this setting.
253
+ """
254
+
255
+ def _Translate(value, msbuild_settings):
256
+ msbuild_tool_settings = _GetMSBuildToolSettings(msbuild_settings, tool)
257
+ msbuild_tool_settings[msbuild_name] = setting_type.ConvertToMSBuild(value)
258
+
259
+ _msvs_validators[tool.msvs_name][msvs_name] = setting_type.ValidateMSVS
260
+ _msbuild_validators[tool.msbuild_name][msbuild_name] = setting_type.ValidateMSBuild
261
+ _msvs_to_msbuild_converters[tool.msvs_name][msvs_name] = _Translate
262
+
263
+
264
+ def _Moved(tool, settings_name, msbuild_tool_name, setting_type):
265
+ _MovedAndRenamed(
266
+ tool, settings_name, msbuild_tool_name, settings_name, setting_type
267
+ )
268
+
269
+
270
+ def _MovedAndRenamed(
271
+ tool, msvs_settings_name, msbuild_tool_name, msbuild_settings_name, setting_type
272
+ ):
273
+ """Defines a setting that may have moved to a new section.
274
+
275
+ Args:
276
+ tool: a dictionary that gives the names of the tool for MSVS and MSBuild.
277
+ msvs_settings_name: the MSVS name of the setting.
278
+ msbuild_tool_name: the name of the MSBuild tool to place the setting under.
279
+ msbuild_settings_name: the MSBuild name of the setting.
280
+ setting_type: the type of this setting.
281
+ """
282
+
283
+ def _Translate(value, msbuild_settings):
284
+ tool_settings = msbuild_settings.setdefault(msbuild_tool_name, {})
285
+ tool_settings[msbuild_settings_name] = setting_type.ConvertToMSBuild(value)
286
+
287
+ _msvs_validators[tool.msvs_name][msvs_settings_name] = setting_type.ValidateMSVS
288
+ validator = setting_type.ValidateMSBuild
289
+ _msbuild_validators[msbuild_tool_name][msbuild_settings_name] = validator
290
+ _msvs_to_msbuild_converters[tool.msvs_name][msvs_settings_name] = _Translate
291
+
292
+
293
+ def _MSVSOnly(tool, name, setting_type):
294
+ """Defines a setting that is only found in MSVS.
295
+
296
+ Args:
297
+ tool: a dictionary that gives the names of the tool for MSVS and MSBuild.
298
+ name: the name of the setting.
299
+ setting_type: the type of this setting.
300
+ """
301
+
302
+ def _Translate(unused_value, unused_msbuild_settings):
303
+ # Since this is for MSVS only settings, no translation will happen.
304
+ pass
305
+
306
+ _msvs_validators[tool.msvs_name][name] = setting_type.ValidateMSVS
307
+ _msvs_to_msbuild_converters[tool.msvs_name][name] = _Translate
308
+
309
+
310
+ def _MSBuildOnly(tool, name, setting_type):
311
+ """Defines a setting that is only found in MSBuild.
312
+
313
+ Args:
314
+ tool: a dictionary that gives the names of the tool for MSVS and MSBuild.
315
+ name: the name of the setting.
316
+ setting_type: the type of this setting.
317
+ """
318
+
319
+ def _Translate(value, msbuild_settings):
320
+ # Let msbuild-only properties get translated as-is from msvs_settings.
321
+ tool_settings = msbuild_settings.setdefault(tool.msbuild_name, {})
322
+ tool_settings[name] = value
323
+
324
+ _msbuild_validators[tool.msbuild_name][name] = setting_type.ValidateMSBuild
325
+ _msvs_to_msbuild_converters[tool.msvs_name][name] = _Translate
326
+
327
+
328
+ def _ConvertedToAdditionalOption(tool, msvs_name, flag):
329
+ """Defines a setting that's handled via a command line option in MSBuild.
330
+
331
+ Args:
332
+ tool: a dictionary that gives the names of the tool for MSVS and MSBuild.
333
+ msvs_name: the name of the MSVS setting that if 'true' becomes a flag
334
+ flag: the flag to insert at the end of the AdditionalOptions
335
+ """
336
+
337
+ def _Translate(value, msbuild_settings):
338
+ if value == "true":
339
+ tool_settings = _GetMSBuildToolSettings(msbuild_settings, tool)
340
+ if "AdditionalOptions" in tool_settings:
341
+ new_flags = "{} {}".format(tool_settings["AdditionalOptions"], flag)
342
+ else:
343
+ new_flags = flag
344
+ tool_settings["AdditionalOptions"] = new_flags
345
+
346
+ _msvs_validators[tool.msvs_name][msvs_name] = _boolean.ValidateMSVS
347
+ _msvs_to_msbuild_converters[tool.msvs_name][msvs_name] = _Translate
348
+
349
+
350
+ def _CustomGeneratePreprocessedFile(tool, msvs_name):
351
+ def _Translate(value, msbuild_settings):
352
+ tool_settings = _GetMSBuildToolSettings(msbuild_settings, tool)
353
+ if value == "0":
354
+ tool_settings["PreprocessToFile"] = "false"
355
+ tool_settings["PreprocessSuppressLineNumbers"] = "false"
356
+ elif value == "1": # /P
357
+ tool_settings["PreprocessToFile"] = "true"
358
+ tool_settings["PreprocessSuppressLineNumbers"] = "false"
359
+ elif value == "2": # /EP /P
360
+ tool_settings["PreprocessToFile"] = "true"
361
+ tool_settings["PreprocessSuppressLineNumbers"] = "true"
362
+ else:
363
+ raise ValueError("value must be one of [0, 1, 2]; got %s" % value)
364
+
365
+ # Create a bogus validator that looks for '0', '1', or '2'
366
+ msvs_validator = _Enumeration(["a", "b", "c"]).ValidateMSVS
367
+ _msvs_validators[tool.msvs_name][msvs_name] = msvs_validator
368
+ msbuild_validator = _boolean.ValidateMSBuild
369
+ msbuild_tool_validators = _msbuild_validators[tool.msbuild_name]
370
+ msbuild_tool_validators["PreprocessToFile"] = msbuild_validator
371
+ msbuild_tool_validators["PreprocessSuppressLineNumbers"] = msbuild_validator
372
+ _msvs_to_msbuild_converters[tool.msvs_name][msvs_name] = _Translate
373
+
374
+
375
+ fix_vc_macro_slashes_regex_list = ("IntDir", "OutDir")
376
+ fix_vc_macro_slashes_regex = re.compile(
377
+ r"(\$\((?:%s)\))(?:[\\/]+)" % "|".join(fix_vc_macro_slashes_regex_list)
378
+ )
379
+
380
+ # Regular expression to detect keys that were generated by exclusion lists
381
+ _EXCLUDED_SUFFIX_RE = re.compile("^(.*)_excluded$")
382
+
383
+
384
+ def _ValidateExclusionSetting(setting, settings, error_msg, stderr=sys.stderr):
385
+ """Verify that 'setting' is valid if it is generated from an exclusion list.
386
+
387
+ If the setting appears to be generated from an exclusion list, the root name
388
+ is checked.
389
+
390
+ Args:
391
+ setting: A string that is the setting name to validate
392
+ settings: A dictionary where the keys are valid settings
393
+ error_msg: The message to emit in the event of error
394
+ stderr: The stream receiving the error messages.
395
+ """
396
+ # This may be unrecognized because it's an exclusion list. If the
397
+ # setting name has the _excluded suffix, then check the root name.
398
+ unrecognized = True
399
+ m = re.match(_EXCLUDED_SUFFIX_RE, setting)
400
+ if m:
401
+ root_setting = m.group(1)
402
+ unrecognized = root_setting not in settings
403
+
404
+ if unrecognized:
405
+ # We don't know this setting. Give a warning.
406
+ print(error_msg, file=stderr)
407
+
408
+
409
+ def FixVCMacroSlashes(s):
410
+ """Replace macros which have excessive following slashes.
411
+
412
+ These macros are known to have a built-in trailing slash. Furthermore, many
413
+ scripts hiccup on processing paths with extra slashes in the middle.
414
+
415
+ This list is probably not exhaustive. Add as needed.
416
+ """
417
+ if "$" in s:
418
+ s = fix_vc_macro_slashes_regex.sub(r"\1", s)
419
+ return s
420
+
421
+
422
+ def ConvertVCMacrosToMSBuild(s):
423
+ """Convert the MSVS macros found in the string to the MSBuild equivalent.
424
+
425
+ This list is probably not exhaustive. Add as needed.
426
+ """
427
+ if "$" in s:
428
+ replace_map = {
429
+ "$(ConfigurationName)": "$(Configuration)",
430
+ "$(InputDir)": "%(RelativeDir)",
431
+ "$(InputExt)": "%(Extension)",
432
+ "$(InputFileName)": "%(Filename)%(Extension)",
433
+ "$(InputName)": "%(Filename)",
434
+ "$(InputPath)": "%(Identity)",
435
+ "$(ParentName)": "$(ProjectFileName)",
436
+ "$(PlatformName)": "$(Platform)",
437
+ "$(SafeInputName)": "%(Filename)",
438
+ }
439
+ for old, new in replace_map.items():
440
+ s = s.replace(old, new)
441
+ s = FixVCMacroSlashes(s)
442
+ return s
443
+
444
+
445
+ def ConvertToMSBuildSettings(msvs_settings, stderr=sys.stderr):
446
+ """Converts MSVS settings (VS2008 and earlier) to MSBuild settings (VS2010+).
447
+
448
+ Args:
449
+ msvs_settings: A dictionary. The key is the tool name. The values are
450
+ themselves dictionaries of settings and their values.
451
+ stderr: The stream receiving the error messages.
452
+
453
+ Returns:
454
+ A dictionary of MSBuild settings. The key is either the MSBuild tool name
455
+ or the empty string (for the global settings). The values are themselves
456
+ dictionaries of settings and their values.
457
+ """
458
+ msbuild_settings = {}
459
+ for msvs_tool_name, msvs_tool_settings in msvs_settings.items():
460
+ if msvs_tool_name in _msvs_to_msbuild_converters:
461
+ msvs_tool = _msvs_to_msbuild_converters[msvs_tool_name]
462
+ for msvs_setting, msvs_value in msvs_tool_settings.items():
463
+ if msvs_setting in msvs_tool:
464
+ # Invoke the translation function.
465
+ try:
466
+ msvs_tool[msvs_setting](msvs_value, msbuild_settings)
467
+ except ValueError as e:
468
+ print(
469
+ "Warning: while converting %s/%s to MSBuild, "
470
+ "%s" % (msvs_tool_name, msvs_setting, e),
471
+ file=stderr,
472
+ )
473
+ else:
474
+ _ValidateExclusionSetting(
475
+ msvs_setting,
476
+ msvs_tool,
477
+ (
478
+ "Warning: unrecognized setting %s/%s "
479
+ "while converting to MSBuild."
480
+ % (msvs_tool_name, msvs_setting)
481
+ ),
482
+ stderr,
483
+ )
484
+ else:
485
+ print(
486
+ "Warning: unrecognized tool %s while converting to "
487
+ "MSBuild." % msvs_tool_name,
488
+ file=stderr,
489
+ )
490
+ return msbuild_settings
491
+
492
+
493
+ def ValidateMSVSSettings(settings, stderr=sys.stderr):
494
+ """Validates that the names of the settings are valid for MSVS.
495
+
496
+ Args:
497
+ settings: A dictionary. The key is the tool name. The values are
498
+ themselves dictionaries of settings and their values.
499
+ stderr: The stream receiving the error messages.
500
+ """
501
+ _ValidateSettings(_msvs_validators, settings, stderr)
502
+
503
+
504
+ def ValidateMSBuildSettings(settings, stderr=sys.stderr):
505
+ """Validates that the names of the settings are valid for MSBuild.
506
+
507
+ Args:
508
+ settings: A dictionary. The key is the tool name. The values are
509
+ themselves dictionaries of settings and their values.
510
+ stderr: The stream receiving the error messages.
511
+ """
512
+ _ValidateSettings(_msbuild_validators, settings, stderr)
513
+
514
+
515
+ def _ValidateSettings(validators, settings, stderr):
516
+ """Validates that the settings are valid for MSBuild or MSVS.
517
+
518
+ We currently only validate the names of the settings, not their values.
519
+
520
+ Args:
521
+ validators: A dictionary of tools and their validators.
522
+ settings: A dictionary. The key is the tool name. The values are
523
+ themselves dictionaries of settings and their values.
524
+ stderr: The stream receiving the error messages.
525
+ """
526
+ for tool_name in settings:
527
+ if tool_name in validators:
528
+ tool_validators = validators[tool_name]
529
+ for setting, value in settings[tool_name].items():
530
+ if setting in tool_validators:
531
+ try:
532
+ tool_validators[setting](value)
533
+ except ValueError as e:
534
+ print(
535
+ f"Warning: for {tool_name}/{setting}, {e}",
536
+ file=stderr,
537
+ )
538
+ else:
539
+ _ValidateExclusionSetting(
540
+ setting,
541
+ tool_validators,
542
+ (f"Warning: unrecognized setting {tool_name}/{setting}"),
543
+ stderr,
544
+ )
545
+
546
+ else:
547
+ print("Warning: unrecognized tool %s" % (tool_name), file=stderr)
548
+
549
+
550
+ # MSVS and MBuild names of the tools.
551
+ _compile = _Tool("VCCLCompilerTool", "ClCompile")
552
+ _link = _Tool("VCLinkerTool", "Link")
553
+ _midl = _Tool("VCMIDLTool", "Midl")
554
+ _rc = _Tool("VCResourceCompilerTool", "ResourceCompile")
555
+ _lib = _Tool("VCLibrarianTool", "Lib")
556
+ _manifest = _Tool("VCManifestTool", "Manifest")
557
+ _masm = _Tool("MASM", "MASM")
558
+ _armasm = _Tool("ARMASM", "ARMASM")
559
+
560
+
561
+ _AddTool(_compile)
562
+ _AddTool(_link)
563
+ _AddTool(_midl)
564
+ _AddTool(_rc)
565
+ _AddTool(_lib)
566
+ _AddTool(_manifest)
567
+ _AddTool(_masm)
568
+ _AddTool(_armasm)
569
+ # Add sections only found in the MSBuild settings.
570
+ _msbuild_validators[""] = {}
571
+ _msbuild_validators["ProjectReference"] = {}
572
+ _msbuild_validators["ManifestResourceCompile"] = {}
573
+
574
+ # Descriptions of the compiler options, i.e. VCCLCompilerTool in MSVS and
575
+ # ClCompile in MSBuild.
576
+ # See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\cl.xml" for
577
+ # the schema of the MSBuild ClCompile settings.
578
+
579
+ # Options that have the same name in MSVS and MSBuild
580
+ _Same(_compile, "AdditionalIncludeDirectories", _folder_list) # /I
581
+ _Same(_compile, "AdditionalOptions", _string_list)
582
+ _Same(_compile, "AdditionalUsingDirectories", _folder_list) # /AI
583
+ _Same(_compile, "AssemblerListingLocation", _file_name) # /Fa
584
+ _Same(_compile, "BrowseInformationFile", _file_name)
585
+ _Same(_compile, "BufferSecurityCheck", _boolean) # /GS
586
+ _Same(_compile, "DisableLanguageExtensions", _boolean) # /Za
587
+ _Same(_compile, "DisableSpecificWarnings", _string_list) # /wd
588
+ _Same(_compile, "EnableFiberSafeOptimizations", _boolean) # /GT
589
+ _Same(_compile, "EnablePREfast", _boolean) # /analyze Visible='false'
590
+ _Same(_compile, "ExpandAttributedSource", _boolean) # /Fx
591
+ _Same(_compile, "FloatingPointExceptions", _boolean) # /fp:except
592
+ _Same(_compile, "ForceConformanceInForLoopScope", _boolean) # /Zc:forScope
593
+ _Same(_compile, "ForcedIncludeFiles", _file_list) # /FI
594
+ _Same(_compile, "ForcedUsingFiles", _file_list) # /FU
595
+ _Same(_compile, "GenerateXMLDocumentationFiles", _boolean) # /doc
596
+ _Same(_compile, "IgnoreStandardIncludePath", _boolean) # /X
597
+ _Same(_compile, "MinimalRebuild", _boolean) # /Gm
598
+ _Same(_compile, "OmitDefaultLibName", _boolean) # /Zl
599
+ _Same(_compile, "OmitFramePointers", _boolean) # /Oy
600
+ _Same(_compile, "PreprocessorDefinitions", _string_list) # /D
601
+ _Same(_compile, "ProgramDataBaseFileName", _file_name) # /Fd
602
+ _Same(_compile, "RuntimeTypeInfo", _boolean) # /GR
603
+ _Same(_compile, "ShowIncludes", _boolean) # /showIncludes
604
+ _Same(_compile, "SmallerTypeCheck", _boolean) # /RTCc
605
+ _Same(_compile, "StringPooling", _boolean) # /GF
606
+ _Same(_compile, "SuppressStartupBanner", _boolean) # /nologo
607
+ _Same(_compile, "TreatWChar_tAsBuiltInType", _boolean) # /Zc:wchar_t
608
+ _Same(_compile, "UndefineAllPreprocessorDefinitions", _boolean) # /u
609
+ _Same(_compile, "UndefinePreprocessorDefinitions", _string_list) # /U
610
+ _Same(_compile, "UseFullPaths", _boolean) # /FC
611
+ _Same(_compile, "WholeProgramOptimization", _boolean) # /GL
612
+ _Same(_compile, "XMLDocumentationFileName", _file_name)
613
+ _Same(_compile, "CompileAsWinRT", _boolean) # /ZW
614
+
615
+ _Same(
616
+ _compile,
617
+ "AssemblerOutput",
618
+ _Enumeration(
619
+ [
620
+ "NoListing",
621
+ "AssemblyCode", # /FA
622
+ "All", # /FAcs
623
+ "AssemblyAndMachineCode", # /FAc
624
+ "AssemblyAndSourceCode",
625
+ ]
626
+ ),
627
+ ) # /FAs
628
+ _Same(
629
+ _compile,
630
+ "BasicRuntimeChecks",
631
+ _Enumeration(
632
+ [
633
+ "Default",
634
+ "StackFrameRuntimeCheck", # /RTCs
635
+ "UninitializedLocalUsageCheck", # /RTCu
636
+ "EnableFastChecks",
637
+ ]
638
+ ),
639
+ ) # /RTC1
640
+ _Same(
641
+ _compile, "BrowseInformation", _Enumeration(["false", "true", "true"]) # /FR
642
+ ) # /Fr
643
+ _Same(
644
+ _compile,
645
+ "CallingConvention",
646
+ _Enumeration(["Cdecl", "FastCall", "StdCall", "VectorCall"]), # /Gd # /Gr # /Gz
647
+ ) # /Gv
648
+ _Same(
649
+ _compile,
650
+ "CompileAs",
651
+ _Enumeration(["Default", "CompileAsC", "CompileAsCpp"]), # /TC
652
+ ) # /TP
653
+ _Same(
654
+ _compile,
655
+ "DebugInformationFormat",
656
+ _Enumeration(
657
+ [
658
+ "", # Disabled
659
+ "OldStyle", # /Z7
660
+ None,
661
+ "ProgramDatabase", # /Zi
662
+ "EditAndContinue",
663
+ ]
664
+ ),
665
+ ) # /ZI
666
+ _Same(
667
+ _compile,
668
+ "EnableEnhancedInstructionSet",
669
+ _Enumeration(
670
+ [
671
+ "NotSet",
672
+ "StreamingSIMDExtensions", # /arch:SSE
673
+ "StreamingSIMDExtensions2", # /arch:SSE2
674
+ "AdvancedVectorExtensions", # /arch:AVX (vs2012+)
675
+ "NoExtensions", # /arch:IA32 (vs2012+)
676
+ # This one only exists in the new msbuild format.
677
+ "AdvancedVectorExtensions2", # /arch:AVX2 (vs2013r2+)
678
+ ]
679
+ ),
680
+ )
681
+ _Same(
682
+ _compile,
683
+ "ErrorReporting",
684
+ _Enumeration(
685
+ [
686
+ "None", # /errorReport:none
687
+ "Prompt", # /errorReport:prompt
688
+ "Queue",
689
+ ], # /errorReport:queue
690
+ new=["Send"],
691
+ ),
692
+ ) # /errorReport:send"
693
+ _Same(
694
+ _compile,
695
+ "ExceptionHandling",
696
+ _Enumeration(["false", "Sync", "Async"], new=["SyncCThrow"]), # /EHsc # /EHa
697
+ ) # /EHs
698
+ _Same(
699
+ _compile, "FavorSizeOrSpeed", _Enumeration(["Neither", "Speed", "Size"]) # /Ot
700
+ ) # /Os
701
+ _Same(
702
+ _compile,
703
+ "FloatingPointModel",
704
+ _Enumeration(["Precise", "Strict", "Fast"]), # /fp:precise # /fp:strict
705
+ ) # /fp:fast
706
+ _Same(
707
+ _compile,
708
+ "InlineFunctionExpansion",
709
+ _Enumeration(
710
+ ["Default", "OnlyExplicitInline", "AnySuitable"], # /Ob1 # /Ob2
711
+ new=["Disabled"],
712
+ ),
713
+ ) # /Ob0
714
+ _Same(
715
+ _compile,
716
+ "Optimization",
717
+ _Enumeration(["Disabled", "MinSpace", "MaxSpeed", "Full"]), # /Od # /O1 # /O2
718
+ ) # /Ox
719
+ _Same(
720
+ _compile,
721
+ "RuntimeLibrary",
722
+ _Enumeration(
723
+ [
724
+ "MultiThreaded", # /MT
725
+ "MultiThreadedDebug", # /MTd
726
+ "MultiThreadedDLL", # /MD
727
+ "MultiThreadedDebugDLL",
728
+ ]
729
+ ),
730
+ ) # /MDd
731
+ _Same(
732
+ _compile,
733
+ "StructMemberAlignment",
734
+ _Enumeration(
735
+ [
736
+ "Default",
737
+ "1Byte", # /Zp1
738
+ "2Bytes", # /Zp2
739
+ "4Bytes", # /Zp4
740
+ "8Bytes", # /Zp8
741
+ "16Bytes",
742
+ ]
743
+ ),
744
+ ) # /Zp16
745
+ _Same(
746
+ _compile,
747
+ "WarningLevel",
748
+ _Enumeration(
749
+ [
750
+ "TurnOffAllWarnings", # /W0
751
+ "Level1", # /W1
752
+ "Level2", # /W2
753
+ "Level3", # /W3
754
+ "Level4",
755
+ ], # /W4
756
+ new=["EnableAllWarnings"],
757
+ ),
758
+ ) # /Wall
759
+
760
+ # Options found in MSVS that have been renamed in MSBuild.
761
+ _Renamed(
762
+ _compile, "EnableFunctionLevelLinking", "FunctionLevelLinking", _boolean
763
+ ) # /Gy
764
+ _Renamed(_compile, "EnableIntrinsicFunctions", "IntrinsicFunctions", _boolean) # /Oi
765
+ _Renamed(_compile, "KeepComments", "PreprocessKeepComments", _boolean) # /C
766
+ _Renamed(_compile, "ObjectFile", "ObjectFileName", _file_name) # /Fo
767
+ _Renamed(_compile, "OpenMP", "OpenMPSupport", _boolean) # /openmp
768
+ _Renamed(
769
+ _compile, "PrecompiledHeaderThrough", "PrecompiledHeaderFile", _file_name
770
+ ) # Used with /Yc and /Yu
771
+ _Renamed(
772
+ _compile, "PrecompiledHeaderFile", "PrecompiledHeaderOutputFile", _file_name
773
+ ) # /Fp
774
+ _Renamed(
775
+ _compile,
776
+ "UsePrecompiledHeader",
777
+ "PrecompiledHeader",
778
+ _Enumeration(
779
+ ["NotUsing", "Create", "Use"] # VS recognized '' for this value too. # /Yc
780
+ ),
781
+ ) # /Yu
782
+ _Renamed(_compile, "WarnAsError", "TreatWarningAsError", _boolean) # /WX
783
+
784
+ _ConvertedToAdditionalOption(_compile, "DefaultCharIsUnsigned", "/J")
785
+
786
+ # MSVS options not found in MSBuild.
787
+ _MSVSOnly(_compile, "Detect64BitPortabilityProblems", _boolean)
788
+ _MSVSOnly(_compile, "UseUnicodeResponseFiles", _boolean)
789
+
790
+ # MSBuild options not found in MSVS.
791
+ _MSBuildOnly(_compile, "BuildingInIDE", _boolean)
792
+ _MSBuildOnly(
793
+ _compile, "CompileAsManaged", _Enumeration([], new=["false", "true"])
794
+ ) # /clr
795
+ _MSBuildOnly(_compile, "CreateHotpatchableImage", _boolean) # /hotpatch
796
+ _MSBuildOnly(_compile, "LanguageStandard", _string)
797
+ _MSBuildOnly(_compile, "LanguageStandard_C", _string)
798
+ _MSBuildOnly(_compile, "MultiProcessorCompilation", _boolean) # /MP
799
+ _MSBuildOnly(_compile, "PreprocessOutputPath", _string) # /Fi
800
+ _MSBuildOnly(_compile, "ProcessorNumber", _integer) # the number of processors
801
+ _MSBuildOnly(_compile, "TrackerLogDirectory", _folder_name)
802
+ _MSBuildOnly(_compile, "TreatSpecificWarningsAsErrors", _string_list) # /we
803
+ _MSBuildOnly(_compile, "UseUnicodeForAssemblerListing", _boolean) # /FAu
804
+
805
+ # Defines a setting that needs very customized processing
806
+ _CustomGeneratePreprocessedFile(_compile, "GeneratePreprocessedFile")
807
+
808
+
809
+ # Directives for converting MSVS VCLinkerTool to MSBuild Link.
810
+ # See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\link.xml" for
811
+ # the schema of the MSBuild Link settings.
812
+
813
+ # Options that have the same name in MSVS and MSBuild
814
+ _Same(_link, "AdditionalDependencies", _file_list)
815
+ _Same(_link, "AdditionalLibraryDirectories", _folder_list) # /LIBPATH
816
+ # /MANIFESTDEPENDENCY:
817
+ _Same(_link, "AdditionalManifestDependencies", _file_list)
818
+ _Same(_link, "AdditionalOptions", _string_list)
819
+ _Same(_link, "AddModuleNamesToAssembly", _file_list) # /ASSEMBLYMODULE
820
+ _Same(_link, "AllowIsolation", _boolean) # /ALLOWISOLATION
821
+ _Same(_link, "AssemblyLinkResource", _file_list) # /ASSEMBLYLINKRESOURCE
822
+ _Same(_link, "BaseAddress", _string) # /BASE
823
+ _Same(_link, "CLRUnmanagedCodeCheck", _boolean) # /CLRUNMANAGEDCODECHECK
824
+ _Same(_link, "DelayLoadDLLs", _file_list) # /DELAYLOAD
825
+ _Same(_link, "DelaySign", _boolean) # /DELAYSIGN
826
+ _Same(_link, "EmbedManagedResourceFile", _file_list) # /ASSEMBLYRESOURCE
827
+ _Same(_link, "EnableUAC", _boolean) # /MANIFESTUAC
828
+ _Same(_link, "EntryPointSymbol", _string) # /ENTRY
829
+ _Same(_link, "ForceSymbolReferences", _file_list) # /INCLUDE
830
+ _Same(_link, "FunctionOrder", _file_name) # /ORDER
831
+ _Same(_link, "GenerateDebugInformation", _boolean) # /DEBUG
832
+ _Same(_link, "GenerateMapFile", _boolean) # /MAP
833
+ _Same(_link, "HeapCommitSize", _string)
834
+ _Same(_link, "HeapReserveSize", _string) # /HEAP
835
+ _Same(_link, "IgnoreAllDefaultLibraries", _boolean) # /NODEFAULTLIB
836
+ _Same(_link, "IgnoreEmbeddedIDL", _boolean) # /IGNOREIDL
837
+ _Same(_link, "ImportLibrary", _file_name) # /IMPLIB
838
+ _Same(_link, "KeyContainer", _file_name) # /KEYCONTAINER
839
+ _Same(_link, "KeyFile", _file_name) # /KEYFILE
840
+ _Same(_link, "ManifestFile", _file_name) # /ManifestFile
841
+ _Same(_link, "MapExports", _boolean) # /MAPINFO:EXPORTS
842
+ _Same(_link, "MapFileName", _file_name)
843
+ _Same(_link, "MergedIDLBaseFileName", _file_name) # /IDLOUT
844
+ _Same(_link, "MergeSections", _string) # /MERGE
845
+ _Same(_link, "MidlCommandFile", _file_name) # /MIDL
846
+ _Same(_link, "ModuleDefinitionFile", _file_name) # /DEF
847
+ _Same(_link, "OutputFile", _file_name) # /OUT
848
+ _Same(_link, "PerUserRedirection", _boolean)
849
+ _Same(_link, "Profile", _boolean) # /PROFILE
850
+ _Same(_link, "ProfileGuidedDatabase", _file_name) # /PGD
851
+ _Same(_link, "ProgramDatabaseFile", _file_name) # /PDB
852
+ _Same(_link, "RegisterOutput", _boolean)
853
+ _Same(_link, "SetChecksum", _boolean) # /RELEASE
854
+ _Same(_link, "StackCommitSize", _string)
855
+ _Same(_link, "StackReserveSize", _string) # /STACK
856
+ _Same(_link, "StripPrivateSymbols", _file_name) # /PDBSTRIPPED
857
+ _Same(_link, "SupportUnloadOfDelayLoadedDLL", _boolean) # /DELAY:UNLOAD
858
+ _Same(_link, "SuppressStartupBanner", _boolean) # /NOLOGO
859
+ _Same(_link, "SwapRunFromCD", _boolean) # /SWAPRUN:CD
860
+ _Same(_link, "TurnOffAssemblyGeneration", _boolean) # /NOASSEMBLY
861
+ _Same(_link, "TypeLibraryFile", _file_name) # /TLBOUT
862
+ _Same(_link, "TypeLibraryResourceID", _integer) # /TLBID
863
+ _Same(_link, "UACUIAccess", _boolean) # /uiAccess='true'
864
+ _Same(_link, "Version", _string) # /VERSION
865
+
866
+ _Same(_link, "EnableCOMDATFolding", _newly_boolean) # /OPT:ICF
867
+ _Same(_link, "FixedBaseAddress", _newly_boolean) # /FIXED
868
+ _Same(_link, "LargeAddressAware", _newly_boolean) # /LARGEADDRESSAWARE
869
+ _Same(_link, "OptimizeReferences", _newly_boolean) # /OPT:REF
870
+ _Same(_link, "RandomizedBaseAddress", _newly_boolean) # /DYNAMICBASE
871
+ _Same(_link, "TerminalServerAware", _newly_boolean) # /TSAWARE
872
+
873
+ _subsystem_enumeration = _Enumeration(
874
+ [
875
+ "NotSet",
876
+ "Console", # /SUBSYSTEM:CONSOLE
877
+ "Windows", # /SUBSYSTEM:WINDOWS
878
+ "Native", # /SUBSYSTEM:NATIVE
879
+ "EFI Application", # /SUBSYSTEM:EFI_APPLICATION
880
+ "EFI Boot Service Driver", # /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER
881
+ "EFI ROM", # /SUBSYSTEM:EFI_ROM
882
+ "EFI Runtime", # /SUBSYSTEM:EFI_RUNTIME_DRIVER
883
+ "WindowsCE",
884
+ ], # /SUBSYSTEM:WINDOWSCE
885
+ new=["POSIX"],
886
+ ) # /SUBSYSTEM:POSIX
887
+
888
+ _target_machine_enumeration = _Enumeration(
889
+ [
890
+ "NotSet",
891
+ "MachineX86", # /MACHINE:X86
892
+ None,
893
+ "MachineARM", # /MACHINE:ARM
894
+ "MachineEBC", # /MACHINE:EBC
895
+ "MachineIA64", # /MACHINE:IA64
896
+ None,
897
+ "MachineMIPS", # /MACHINE:MIPS
898
+ "MachineMIPS16", # /MACHINE:MIPS16
899
+ "MachineMIPSFPU", # /MACHINE:MIPSFPU
900
+ "MachineMIPSFPU16", # /MACHINE:MIPSFPU16
901
+ None,
902
+ None,
903
+ None,
904
+ "MachineSH4", # /MACHINE:SH4
905
+ None,
906
+ "MachineTHUMB", # /MACHINE:THUMB
907
+ "MachineX64",
908
+ ]
909
+ ) # /MACHINE:X64
910
+
911
+ _Same(
912
+ _link, "AssemblyDebug", _Enumeration(["", "true", "false"]) # /ASSEMBLYDEBUG
913
+ ) # /ASSEMBLYDEBUG:DISABLE
914
+ _Same(
915
+ _link,
916
+ "CLRImageType",
917
+ _Enumeration(
918
+ [
919
+ "Default",
920
+ "ForceIJWImage", # /CLRIMAGETYPE:IJW
921
+ "ForcePureILImage", # /Switch="CLRIMAGETYPE:PURE
922
+ "ForceSafeILImage",
923
+ ]
924
+ ),
925
+ ) # /Switch="CLRIMAGETYPE:SAFE
926
+ _Same(
927
+ _link,
928
+ "CLRThreadAttribute",
929
+ _Enumeration(
930
+ [
931
+ "DefaultThreadingAttribute", # /CLRTHREADATTRIBUTE:NONE
932
+ "MTAThreadingAttribute", # /CLRTHREADATTRIBUTE:MTA
933
+ "STAThreadingAttribute",
934
+ ]
935
+ ),
936
+ ) # /CLRTHREADATTRIBUTE:STA
937
+ _Same(
938
+ _link,
939
+ "DataExecutionPrevention",
940
+ _Enumeration(["", "false", "true"]), # /NXCOMPAT:NO
941
+ ) # /NXCOMPAT
942
+ _Same(
943
+ _link,
944
+ "Driver",
945
+ _Enumeration(["NotSet", "Driver", "UpOnly", "WDM"]), # /Driver # /DRIVER:UPONLY
946
+ ) # /DRIVER:WDM
947
+ _Same(
948
+ _link,
949
+ "LinkTimeCodeGeneration",
950
+ _Enumeration(
951
+ [
952
+ "Default",
953
+ "UseLinkTimeCodeGeneration", # /LTCG
954
+ "PGInstrument", # /LTCG:PGInstrument
955
+ "PGOptimization", # /LTCG:PGOptimize
956
+ "PGUpdate",
957
+ ]
958
+ ),
959
+ ) # /LTCG:PGUpdate
960
+ _Same(
961
+ _link,
962
+ "ShowProgress",
963
+ _Enumeration(
964
+ ["NotSet", "LinkVerbose", "LinkVerboseLib"], # /VERBOSE # /VERBOSE:Lib
965
+ new=[
966
+ "LinkVerboseICF", # /VERBOSE:ICF
967
+ "LinkVerboseREF", # /VERBOSE:REF
968
+ "LinkVerboseSAFESEH", # /VERBOSE:SAFESEH
969
+ "LinkVerboseCLR",
970
+ ],
971
+ ),
972
+ ) # /VERBOSE:CLR
973
+ _Same(_link, "SubSystem", _subsystem_enumeration)
974
+ _Same(_link, "TargetMachine", _target_machine_enumeration)
975
+ _Same(
976
+ _link,
977
+ "UACExecutionLevel",
978
+ _Enumeration(
979
+ [
980
+ "AsInvoker", # /level='asInvoker'
981
+ "HighestAvailable", # /level='highestAvailable'
982
+ "RequireAdministrator",
983
+ ]
984
+ ),
985
+ ) # /level='requireAdministrator'
986
+ _Same(_link, "MinimumRequiredVersion", _string)
987
+ _Same(_link, "TreatLinkerWarningAsErrors", _boolean) # /WX
988
+
989
+
990
+ # Options found in MSVS that have been renamed in MSBuild.
991
+ _Renamed(
992
+ _link,
993
+ "ErrorReporting",
994
+ "LinkErrorReporting",
995
+ _Enumeration(
996
+ [
997
+ "NoErrorReport", # /ERRORREPORT:NONE
998
+ "PromptImmediately", # /ERRORREPORT:PROMPT
999
+ "QueueForNextLogin",
1000
+ ], # /ERRORREPORT:QUEUE
1001
+ new=["SendErrorReport"],
1002
+ ),
1003
+ ) # /ERRORREPORT:SEND
1004
+ _Renamed(
1005
+ _link, "IgnoreDefaultLibraryNames", "IgnoreSpecificDefaultLibraries", _file_list
1006
+ ) # /NODEFAULTLIB
1007
+ _Renamed(_link, "ResourceOnlyDLL", "NoEntryPoint", _boolean) # /NOENTRY
1008
+ _Renamed(_link, "SwapRunFromNet", "SwapRunFromNET", _boolean) # /SWAPRUN:NET
1009
+
1010
+ _Moved(_link, "GenerateManifest", "", _boolean)
1011
+ _Moved(_link, "IgnoreImportLibrary", "", _boolean)
1012
+ _Moved(_link, "LinkIncremental", "", _newly_boolean)
1013
+ _Moved(_link, "LinkLibraryDependencies", "ProjectReference", _boolean)
1014
+ _Moved(_link, "UseLibraryDependencyInputs", "ProjectReference", _boolean)
1015
+
1016
+ # MSVS options not found in MSBuild.
1017
+ _MSVSOnly(_link, "OptimizeForWindows98", _newly_boolean)
1018
+ _MSVSOnly(_link, "UseUnicodeResponseFiles", _boolean)
1019
+
1020
+ # MSBuild options not found in MSVS.
1021
+ _MSBuildOnly(_link, "BuildingInIDE", _boolean)
1022
+ _MSBuildOnly(_link, "ImageHasSafeExceptionHandlers", _boolean) # /SAFESEH
1023
+ _MSBuildOnly(_link, "LinkDLL", _boolean) # /DLL Visible='false'
1024
+ _MSBuildOnly(_link, "LinkStatus", _boolean) # /LTCG:STATUS
1025
+ _MSBuildOnly(_link, "PreventDllBinding", _boolean) # /ALLOWBIND
1026
+ _MSBuildOnly(_link, "SupportNobindOfDelayLoadedDLL", _boolean) # /DELAY:NOBIND
1027
+ _MSBuildOnly(_link, "TrackerLogDirectory", _folder_name)
1028
+ _MSBuildOnly(_link, "MSDOSStubFileName", _file_name) # /STUB Visible='false'
1029
+ _MSBuildOnly(_link, "SectionAlignment", _integer) # /ALIGN
1030
+ _MSBuildOnly(_link, "SpecifySectionAttributes", _string) # /SECTION
1031
+ _MSBuildOnly(
1032
+ _link,
1033
+ "ForceFileOutput",
1034
+ _Enumeration(
1035
+ [],
1036
+ new=[
1037
+ "Enabled", # /FORCE
1038
+ # /FORCE:MULTIPLE
1039
+ "MultiplyDefinedSymbolOnly",
1040
+ "UndefinedSymbolOnly",
1041
+ ],
1042
+ ),
1043
+ ) # /FORCE:UNRESOLVED
1044
+ _MSBuildOnly(
1045
+ _link,
1046
+ "CreateHotPatchableImage",
1047
+ _Enumeration(
1048
+ [],
1049
+ new=[
1050
+ "Enabled", # /FUNCTIONPADMIN
1051
+ "X86Image", # /FUNCTIONPADMIN:5
1052
+ "X64Image", # /FUNCTIONPADMIN:6
1053
+ "ItaniumImage",
1054
+ ],
1055
+ ),
1056
+ ) # /FUNCTIONPADMIN:16
1057
+ _MSBuildOnly(
1058
+ _link,
1059
+ "CLRSupportLastError",
1060
+ _Enumeration(
1061
+ [],
1062
+ new=[
1063
+ "Enabled", # /CLRSupportLastError
1064
+ "Disabled", # /CLRSupportLastError:NO
1065
+ # /CLRSupportLastError:SYSTEMDLL
1066
+ "SystemDlls",
1067
+ ],
1068
+ ),
1069
+ )
1070
+
1071
+
1072
+ # Directives for converting VCResourceCompilerTool to ResourceCompile.
1073
+ # See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\rc.xml" for
1074
+ # the schema of the MSBuild ResourceCompile settings.
1075
+
1076
+ _Same(_rc, "AdditionalOptions", _string_list)
1077
+ _Same(_rc, "AdditionalIncludeDirectories", _folder_list) # /I
1078
+ _Same(_rc, "Culture", _Integer(msbuild_base=16))
1079
+ _Same(_rc, "IgnoreStandardIncludePath", _boolean) # /X
1080
+ _Same(_rc, "PreprocessorDefinitions", _string_list) # /D
1081
+ _Same(_rc, "ResourceOutputFileName", _string) # /fo
1082
+ _Same(_rc, "ShowProgress", _boolean) # /v
1083
+ # There is no UI in VisualStudio 2008 to set the following properties.
1084
+ # However they are found in CL and other tools. Include them here for
1085
+ # completeness, as they are very likely to have the same usage pattern.
1086
+ _Same(_rc, "SuppressStartupBanner", _boolean) # /nologo
1087
+ _Same(_rc, "UndefinePreprocessorDefinitions", _string_list) # /u
1088
+
1089
+ # MSBuild options not found in MSVS.
1090
+ _MSBuildOnly(_rc, "NullTerminateStrings", _boolean) # /n
1091
+ _MSBuildOnly(_rc, "TrackerLogDirectory", _folder_name)
1092
+
1093
+
1094
+ # Directives for converting VCMIDLTool to Midl.
1095
+ # See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\midl.xml" for
1096
+ # the schema of the MSBuild Midl settings.
1097
+
1098
+ _Same(_midl, "AdditionalIncludeDirectories", _folder_list) # /I
1099
+ _Same(_midl, "AdditionalOptions", _string_list)
1100
+ _Same(_midl, "CPreprocessOptions", _string) # /cpp_opt
1101
+ _Same(_midl, "ErrorCheckAllocations", _boolean) # /error allocation
1102
+ _Same(_midl, "ErrorCheckBounds", _boolean) # /error bounds_check
1103
+ _Same(_midl, "ErrorCheckEnumRange", _boolean) # /error enum
1104
+ _Same(_midl, "ErrorCheckRefPointers", _boolean) # /error ref
1105
+ _Same(_midl, "ErrorCheckStubData", _boolean) # /error stub_data
1106
+ _Same(_midl, "GenerateStublessProxies", _boolean) # /Oicf
1107
+ _Same(_midl, "GenerateTypeLibrary", _boolean)
1108
+ _Same(_midl, "HeaderFileName", _file_name) # /h
1109
+ _Same(_midl, "IgnoreStandardIncludePath", _boolean) # /no_def_idir
1110
+ _Same(_midl, "InterfaceIdentifierFileName", _file_name) # /iid
1111
+ _Same(_midl, "MkTypLibCompatible", _boolean) # /mktyplib203
1112
+ _Same(_midl, "OutputDirectory", _string) # /out
1113
+ _Same(_midl, "PreprocessorDefinitions", _string_list) # /D
1114
+ _Same(_midl, "ProxyFileName", _file_name) # /proxy
1115
+ _Same(_midl, "RedirectOutputAndErrors", _file_name) # /o
1116
+ _Same(_midl, "SuppressStartupBanner", _boolean) # /nologo
1117
+ _Same(_midl, "TypeLibraryName", _file_name) # /tlb
1118
+ _Same(_midl, "UndefinePreprocessorDefinitions", _string_list) # /U
1119
+ _Same(_midl, "WarnAsError", _boolean) # /WX
1120
+
1121
+ _Same(
1122
+ _midl,
1123
+ "DefaultCharType",
1124
+ _Enumeration(["Unsigned", "Signed", "Ascii"]), # /char unsigned # /char signed
1125
+ ) # /char ascii7
1126
+ _Same(
1127
+ _midl,
1128
+ "TargetEnvironment",
1129
+ _Enumeration(
1130
+ [
1131
+ "NotSet",
1132
+ "Win32", # /env win32
1133
+ "Itanium", # /env ia64
1134
+ "X64", # /env x64
1135
+ "ARM64", # /env arm64
1136
+ ]
1137
+ ),
1138
+ )
1139
+ _Same(
1140
+ _midl,
1141
+ "EnableErrorChecks",
1142
+ _Enumeration(["EnableCustom", "None", "All"]), # /error none
1143
+ ) # /error all
1144
+ _Same(
1145
+ _midl,
1146
+ "StructMemberAlignment",
1147
+ _Enumeration(["NotSet", "1", "2", "4", "8"]), # Zp1 # Zp2 # Zp4
1148
+ ) # Zp8
1149
+ _Same(
1150
+ _midl,
1151
+ "WarningLevel",
1152
+ _Enumeration(["0", "1", "2", "3", "4"]), # /W0 # /W1 # /W2 # /W3
1153
+ ) # /W4
1154
+
1155
+ _Renamed(_midl, "DLLDataFileName", "DllDataFileName", _file_name) # /dlldata
1156
+ _Renamed(_midl, "ValidateParameters", "ValidateAllParameters", _boolean) # /robust
1157
+
1158
+ # MSBuild options not found in MSVS.
1159
+ _MSBuildOnly(_midl, "ApplicationConfigurationMode", _boolean) # /app_config
1160
+ _MSBuildOnly(_midl, "ClientStubFile", _file_name) # /cstub
1161
+ _MSBuildOnly(
1162
+ _midl, "GenerateClientFiles", _Enumeration([], new=["Stub", "None"]) # /client stub
1163
+ ) # /client none
1164
+ _MSBuildOnly(
1165
+ _midl, "GenerateServerFiles", _Enumeration([], new=["Stub", "None"]) # /client stub
1166
+ ) # /client none
1167
+ _MSBuildOnly(_midl, "LocaleID", _integer) # /lcid DECIMAL
1168
+ _MSBuildOnly(_midl, "ServerStubFile", _file_name) # /sstub
1169
+ _MSBuildOnly(_midl, "SuppressCompilerWarnings", _boolean) # /no_warn
1170
+ _MSBuildOnly(_midl, "TrackerLogDirectory", _folder_name)
1171
+ _MSBuildOnly(
1172
+ _midl, "TypeLibFormat", _Enumeration([], new=["NewFormat", "OldFormat"]) # /newtlb
1173
+ ) # /oldtlb
1174
+
1175
+
1176
+ # Directives for converting VCLibrarianTool to Lib.
1177
+ # See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\lib.xml" for
1178
+ # the schema of the MSBuild Lib settings.
1179
+
1180
+ _Same(_lib, "AdditionalDependencies", _file_list)
1181
+ _Same(_lib, "AdditionalLibraryDirectories", _folder_list) # /LIBPATH
1182
+ _Same(_lib, "AdditionalOptions", _string_list)
1183
+ _Same(_lib, "ExportNamedFunctions", _string_list) # /EXPORT
1184
+ _Same(_lib, "ForceSymbolReferences", _string) # /INCLUDE
1185
+ _Same(_lib, "IgnoreAllDefaultLibraries", _boolean) # /NODEFAULTLIB
1186
+ _Same(_lib, "IgnoreSpecificDefaultLibraries", _file_list) # /NODEFAULTLIB
1187
+ _Same(_lib, "ModuleDefinitionFile", _file_name) # /DEF
1188
+ _Same(_lib, "OutputFile", _file_name) # /OUT
1189
+ _Same(_lib, "SuppressStartupBanner", _boolean) # /NOLOGO
1190
+ _Same(_lib, "UseUnicodeResponseFiles", _boolean)
1191
+ _Same(_lib, "LinkTimeCodeGeneration", _boolean) # /LTCG
1192
+ _Same(_lib, "TargetMachine", _target_machine_enumeration)
1193
+
1194
+ # TODO(jeanluc) _link defines the same value that gets moved to
1195
+ # ProjectReference. We may want to validate that they are consistent.
1196
+ _Moved(_lib, "LinkLibraryDependencies", "ProjectReference", _boolean)
1197
+
1198
+ _MSBuildOnly(_lib, "DisplayLibrary", _string) # /LIST Visible='false'
1199
+ _MSBuildOnly(
1200
+ _lib,
1201
+ "ErrorReporting",
1202
+ _Enumeration(
1203
+ [],
1204
+ new=[
1205
+ "PromptImmediately", # /ERRORREPORT:PROMPT
1206
+ "QueueForNextLogin", # /ERRORREPORT:QUEUE
1207
+ "SendErrorReport", # /ERRORREPORT:SEND
1208
+ "NoErrorReport",
1209
+ ],
1210
+ ),
1211
+ ) # /ERRORREPORT:NONE
1212
+ _MSBuildOnly(_lib, "MinimumRequiredVersion", _string)
1213
+ _MSBuildOnly(_lib, "Name", _file_name) # /NAME
1214
+ _MSBuildOnly(_lib, "RemoveObjects", _file_list) # /REMOVE
1215
+ _MSBuildOnly(_lib, "SubSystem", _subsystem_enumeration)
1216
+ _MSBuildOnly(_lib, "TrackerLogDirectory", _folder_name)
1217
+ _MSBuildOnly(_lib, "TreatLibWarningAsErrors", _boolean) # /WX
1218
+ _MSBuildOnly(_lib, "Verbose", _boolean)
1219
+
1220
+
1221
+ # Directives for converting VCManifestTool to Mt.
1222
+ # See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\mt.xml" for
1223
+ # the schema of the MSBuild Lib settings.
1224
+
1225
+ # Options that have the same name in MSVS and MSBuild
1226
+ _Same(_manifest, "AdditionalManifestFiles", _file_list) # /manifest
1227
+ _Same(_manifest, "AdditionalOptions", _string_list)
1228
+ _Same(_manifest, "AssemblyIdentity", _string) # /identity:
1229
+ _Same(_manifest, "ComponentFileName", _file_name) # /dll
1230
+ _Same(_manifest, "GenerateCatalogFiles", _boolean) # /makecdfs
1231
+ _Same(_manifest, "InputResourceManifests", _string) # /inputresource
1232
+ _Same(_manifest, "OutputManifestFile", _file_name) # /out
1233
+ _Same(_manifest, "RegistrarScriptFile", _file_name) # /rgs
1234
+ _Same(_manifest, "ReplacementsFile", _file_name) # /replacements
1235
+ _Same(_manifest, "SuppressStartupBanner", _boolean) # /nologo
1236
+ _Same(_manifest, "TypeLibraryFile", _file_name) # /tlb:
1237
+ _Same(_manifest, "UpdateFileHashes", _boolean) # /hashupdate
1238
+ _Same(_manifest, "UpdateFileHashesSearchPath", _file_name)
1239
+ _Same(_manifest, "VerboseOutput", _boolean) # /verbose
1240
+
1241
+ # Options that have moved location.
1242
+ _MovedAndRenamed(
1243
+ _manifest,
1244
+ "ManifestResourceFile",
1245
+ "ManifestResourceCompile",
1246
+ "ResourceOutputFileName",
1247
+ _file_name,
1248
+ )
1249
+ _Moved(_manifest, "EmbedManifest", "", _boolean)
1250
+
1251
+ # MSVS options not found in MSBuild.
1252
+ _MSVSOnly(_manifest, "DependencyInformationFile", _file_name)
1253
+ _MSVSOnly(_manifest, "UseFAT32Workaround", _boolean)
1254
+ _MSVSOnly(_manifest, "UseUnicodeResponseFiles", _boolean)
1255
+
1256
+ # MSBuild options not found in MSVS.
1257
+ _MSBuildOnly(_manifest, "EnableDPIAwareness", _boolean)
1258
+ _MSBuildOnly(_manifest, "GenerateCategoryTags", _boolean) # /category
1259
+ _MSBuildOnly(
1260
+ _manifest, "ManifestFromManagedAssembly", _file_name
1261
+ ) # /managedassemblyname
1262
+ _MSBuildOnly(_manifest, "OutputResourceManifests", _string) # /outputresource
1263
+ _MSBuildOnly(_manifest, "SuppressDependencyElement", _boolean) # /nodependency
1264
+ _MSBuildOnly(_manifest, "TrackerLogDirectory", _folder_name)
1265
+
1266
+
1267
+ # Directives for MASM.
1268
+ # See "$(VCTargetsPath)\BuildCustomizations\masm.xml" for the schema of the
1269
+ # MSBuild MASM settings.
1270
+
1271
+ # Options that have the same name in MSVS and MSBuild.
1272
+ _Same(_masm, "UseSafeExceptionHandlers", _boolean) # /safeseh