[native_toolchain_c] Fix #3327 native_toolchain_c vswhere selection#3328
[native_toolchain_c] Fix #3327 native_toolchain_c vswhere selection#3328Chaos02 wants to merge 2 commits into
Conversation
Package publishing
Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation. |
PR HealthChangelog Entry ✔️
Changes to files need to be accounted for in their respective changelogs. This check can be disabled by tagging the PR with Breaking changes ✔️
This check can be disabled by tagging the PR with API leaks ✔️The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.
This check can be disabled by tagging the PR with |
| '-products', | ||
| '*', | ||
| '-requires', | ||
| 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64', |
There was a problem hiding this comment.
This is only for if the target is Architecture.x64. For Architecture.arm64 it should be Microsoft.VisualStudio.Component.VC.Tools.ARM64. But, VisualStudioResolver doesn't take a target architecture, we're trying to find one visual studio.
So maybe a better fix is to first try 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64', then add all instances with parseVswhere and then do the same with Microsoft.VisualStudio.Component.VC.Tools.ARM64.
We should probably try to run a CI on runs-on: windows-11-arm in .github/workflows/native.yaml to cover the CI. (But we can do that as a separate PR.)
There was a problem hiding this comment.
I agree, given that the actual choosing is done in the caller, we should return all of the possible instances and implement choosing logic for the architecture somewhere here perhaps?
or maybe even here?
I'll suggest something, let me know if it sounds good to you
There was a problem hiding this comment.
Would you rename the x64 (old) resolver to VisualStudioX64 or leave it be and just suffix the newer ones?
https://github.com/Chaos02/native/blob/d4f3cb61eb8062802e48a2b9038868e4b243f363/pkgs/native_toolchain_c/lib/src/native_toolchain/msvc.dart#L317
1c68b2b to
d4f3cb6
Compare
Chaos02
left a comment
There was a problem hiding this comment.
Would you rename the x64 (old) resolver to VisualStudioX64 or leave it be and just suffix the newer ones?
https://github.com/Chaos02/native/blob/d4f3cb61eb8062802e48a2b9038868e4b243f363/pkgs/native_toolchain_c/lib/src/native_toolchain/msvc.dart#L317
| '-products', | ||
| '*', | ||
| '-requires', | ||
| 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64', |
There was a problem hiding this comment.
Would you rename the x64 (old) resolver to VisualStudioX64 or leave it be and just suffix the newer ones?
https://github.com/Chaos02/native/blob/d4f3cb61eb8062802e48a2b9038868e4b243f363/pkgs/native_toolchain_c/lib/src/native_toolchain/msvc.dart#L317
| /// `Microsoft.VisualStudio.Component.VC.Tools.arm64` component. On machines | ||
| /// with multiple VS installations these resolvers may pick different | ||
| /// installs. | ||
| class VisualStudioResolverArm64 extends VisualStudioResolver { |
There was a problem hiding this comment.
extending doesn't seem the right pattern if the x64 and arm64 are next to each other.
Can the VisualStudioResolver get a targetArchitecture param instead?
| /// Resolved via [vswhere] requiring | ||
| /// `Microsoft.VisualStudio.Component.VC.Tools.x86.x64`, which filters out | ||
| /// installs that lack the C++ toolchain (e.g. SSMS) even when their | ||
| /// `installationVersion` would otherwise win `vswhere -latest`. |
There was a problem hiding this comment.
final Tool visualStudioX64? I don't think we export this variable outside the package, so it would not be breaking anything?
And name Visual Studio (x64)? Or does changing the name break things?
Fixes Native_toolchain_c trying to use Microsoft SQL Server Management Studio as a msvc provider
Related Issues
Fixes #3327
PR Checklist
dart tool/ci.dart --alllocally and resolved all issues identified. This ensures the PR is formatted, has no lint errors, and ran all code generators. This applies to the packages part of the toplevelpubspec.yamlworkspace.CHANGELOG.mdfor the relevant packages. (Not needed for small changes such as doc typos).