Skip to content

Commit 8147d6b

Browse files
authored
fix: bump node-gyp dependency to v9.4.0 (microsoft#189308)
1 parent 9d3e44c commit 8147d6b

File tree

6 files changed

+384
-132
lines changed

6 files changed

+384
-132
lines changed

build/azure-pipelines/win32/product-build-win32.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,12 @@ steps:
9494
$ErrorActionPreference = "Stop"
9595
# TODO: Should be replaced with upstream URL once https://github.com/nodejs/node-gyp/pull/2825
9696
# gets merged.
97-
exec { git clone https://github.com/rzhao271/node-gyp.git . } "Cloning rzhao271/node-gyp failed"
98-
exec { git checkout 102b347da0c92c29f9c67df22e864e70249cf086 } "Checking out 102b347 failed"
99-
exec { npm install } "Building rzhao271/node-gyp failed"
97+
exec { git config --global user.email "[email protected]" } "git config user.email failed"
98+
exec { git config --global user.name "VSCode" } "git config user.name failed"
99+
exec { git clone https://github.com/nodejs/node-gyp.git . } "Cloning nodejs/node-gyp failed"
100+
exec { git checkout v9.4.0 } "Checking out v9.4.0 failed"
101+
exec { git am --3way --whitespace=fix ../../build/npm/gyp/patches/gyp_spectre_mitigation_support.patch } "Apply spectre patch failed"
102+
exec { npm install } "Building node-gyp failed"
100103
displayName: Install custom node-gyp
101104
workingDirectory: .build/node-gyp
102105
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))

build/filters.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ module.exports.indentationFilter = [
8080
'!test/unit/assert.js',
8181
'!resources/linux/snap/electron-launch',
8282
'!build/ext.js',
83+
'!build/npm/gyp/patches/gyp_spectre_mitigation_support.patch',
8384

8485
// except specific folders
8586
'!test/automation/out/**',

build/npm/gyp/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"license": "MIT",
66
"devDependencies": {
7-
"node-gyp": "^8.4.1"
7+
"node-gyp": "^9.4.0"
88
},
99
"scripts": {}
1010
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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

Comments
 (0)