-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
win: more robust parsing of SDK version #1198
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a question.
lib/Find-VS2017.cs
Outdated
Win10SDKVer = Math.Max(Win10SDKVer, UInt32.Parse(id.Substring(Win10SDKPrefix.Length))); | ||
else if (id == "Microsoft.VisualStudio.Component.Windows81SDK") | ||
else if (id.StartsWith(Win10SDKPrefix)) { | ||
string[] parts = id.ToString().Substring(Win10SDKPrefix.Length).Split('.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Superfluous ToString() call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep.
Gone.
lib/Find-VS2017.cs
Outdated
else if (id == "Microsoft.VisualStudio.Component.Windows81SDK") | ||
else if (id.StartsWith(Win10SDKPrefix)) { | ||
string[] parts = id.Substring(Win10SDKPrefix.Length).Split('.'); | ||
Win10SDKVer = Math.Max(Win10SDKVer, UInt32.Parse(parts[0])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only the Desktop C++ SDK is good, according to https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-community it has .Desktop
appended. What about:
- Win10SDKVer = Math.Max(Win10SDKVer, UInt32.Parse(parts[0]));
+ if (parts.Length == 1 || (parts.Length == 2 && parts[1] == "Desktop"))
+ Win10SDKVer = Math.Max(Win10SDKVer, UInt32.Parse(parts[0]));
+ else
+ continue;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack, with variation
lib/Find-VS2017.cs
Outdated
else if (id == "Microsoft.VisualStudio.Component.Windows81SDK") | ||
else if (id.StartsWith(Win10SDKPrefix)) { | ||
string[] parts = id.Substring(Win10SDKPrefix.Length).Split('.'); | ||
if (parts.Length == 2 && parts[1] != "Desktop") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is already a Microsoft.VisualStudio.Component.Windows10SDK.15063.UWP.Native
that this does not catch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👎 for Microsoft.
Enhanced the guard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
CI: https://ci.nodejs.org/view/All/job/nodegyp-test-pull-request/13/ @refack can you land here or should I? (we should still wait for the 72h) |
@joaocgreis I don't have write here (yet?), after we land we need to ping one of the package owners to package a patch version. |
v0.12 failed, here is another run: https://ci.nodejs.org/job/nodegyp-test-commit/113/ . This one passed. |
PR-URL: nodejs#1198 Fixes: nodejs#1179 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: João Reis <reis@janeasystems.com>
Landed in bad903a |
Post land CI: https://ci.nodejs.org/job/nodegyp-test-pull-request/14/ |
This should go into |
/cc @rvagg @bnoordhuis @joaocgreis @nodejs/node-gyp |
👍 done, v3.6.2, thanks @refack |
No, thank you! |
Fixes: #1179
Personally I prefer #1178, but this is smaller.