|
| 1 | +From 853e4643b6737224a5aa0720a4108461a0230991 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Raymond Zhao < [email protected]> |
| 3 | +Date: Thu, 30 Mar 2023 05:23:36 -0700 |
| 4 | +Subject: [PATCH] feat(msvs): add SpectreMitigation attribute (#190) |
| 5 | + |
| 6 | +Backports https://github.com/nodejs/gyp-next/commit/853e4643b6737224a5aa0720a4108461a0230991 |
| 7 | + |
| 8 | +diff --git a/gyp/pylib/gyp/easy_xml_test.py b/gyp/pylib/gyp/easy_xml_test.py |
| 9 | +index 342f693..c5808b8 100755 |
| 10 | +--- a/gyp/pylib/gyp/easy_xml_test.py |
| 11 | ++++ b/gyp/pylib/gyp/easy_xml_test.py |
| 12 | +@@ -76,6 +76,7 @@ def test_EasyXml_complex(self): |
| 13 | + '\'Debug|Win32\'" Label="Configuration">' |
| 14 | + "<ConfigurationType>Application</ConfigurationType>" |
| 15 | + "<CharacterSet>Unicode</CharacterSet>" |
| 16 | ++ "<SpectreMitigation>SpectreLoadCF</SpectreMitigation>" |
| 17 | + "</PropertyGroup>" |
| 18 | + "</Project>" |
| 19 | + ) |
| 20 | +@@ -99,6 +100,7 @@ def test_EasyXml_complex(self): |
| 21 | + }, |
| 22 | + ["ConfigurationType", "Application"], |
| 23 | + ["CharacterSet", "Unicode"], |
| 24 | ++ ["SpectreMitigation", "SpectreLoadCF"] |
| 25 | + ], |
| 26 | + ] |
| 27 | + ) |
| 28 | +diff --git a/gyp/pylib/gyp/generator/msvs.py b/gyp/pylib/gyp/generator/msvs.py |
| 29 | +index 72269bd..85c354f 100644 |
| 30 | +--- a/gyp/pylib/gyp/generator/msvs.py |
| 31 | ++++ b/gyp/pylib/gyp/generator/msvs.py |
| 32 | +@@ -3006,6 +3006,10 @@ def _GetMSBuildConfigurationDetails(spec, build_file): |
| 33 | + character_set = msbuild_attributes.get("CharacterSet") |
| 34 | + config_type = msbuild_attributes.get("ConfigurationType") |
| 35 | + _AddConditionalProperty(properties, condition, "ConfigurationType", config_type) |
| 36 | ++ spectre_mitigation = msbuild_attributes.get('SpectreMitigation') |
| 37 | ++ if spectre_mitigation: |
| 38 | ++ _AddConditionalProperty(properties, condition, "SpectreMitigation", |
| 39 | ++ spectre_mitigation) |
| 40 | + if config_type == "Driver": |
| 41 | + _AddConditionalProperty(properties, condition, "DriverType", "WDM") |
| 42 | + _AddConditionalProperty( |
| 43 | +@@ -3094,6 +3098,8 @@ def _ConvertMSVSBuildAttributes(spec, config, build_file): |
| 44 | + msbuild_attributes[a] = _ConvertMSVSCharacterSet(msvs_attributes[a]) |
| 45 | + elif a == "ConfigurationType": |
| 46 | + msbuild_attributes[a] = _ConvertMSVSConfigurationType(msvs_attributes[a]) |
| 47 | ++ elif a == "SpectreMitigation": |
| 48 | ++ msbuild_attributes[a] = msvs_attributes[a] |
| 49 | + else: |
| 50 | + print("Warning: Do not know how to convert MSVS attribute " + a) |
| 51 | + return msbuild_attributes |
0 commit comments