This repository was archived by the owner on Aug 15, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 228
Update MSVC toolchain selection for Windows builds #684
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,52 @@ | ||
$VS_DOWNLOAD_LINK = "https://aka.ms/vs/16/release/vs_buildtools.exe" | ||
# https://developercommunity.visualstudio.com/t/install-specific-version-of-vs-component/1142479 | ||
# https://docs.microsoft.com/en-us/visualstudio/releases/2019/history#release-dates-and-build-numbers | ||
|
||
# 16.8.5 BuildTools | ||
$VS_DOWNLOAD_LINK = "https://download.visualstudio.microsoft.com/download/pr/20130c62-1bc8-43d6-b4f0-c20bb7c79113/145a319d79a83376915d8f855605e152ef5f6fa2b2f1d2dca411fb03722eea72/vs_BuildTools.exe" | ||
$COLLECT_DOWNLOAD_LINK = "https://aka.ms/vscollect.exe" | ||
$VS_INSTALL_ARGS = @("--nocache","--quiet","--wait", "--add Microsoft.VisualStudio.Workload.VCTools", | ||
"--add Microsoft.Component.MSBuild", | ||
"--add Microsoft.VisualStudio.Component.Roslyn.Compiler", | ||
"--add Microsoft.VisualStudio.Component.VC.CoreBuildTools", | ||
"--add Microsoft.VisualStudio.Component.TextTemplating", | ||
"--add Microsoft.VisualStudio.Component.VC.CoreIde", | ||
"--add Microsoft.VisualStudio.Component.VC.Redist.14.Latest", | ||
"--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64") | ||
"--add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core", | ||
"--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64", | ||
"--add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Win81") | ||
|
||
curl.exe --retry 3 -kL $VS_DOWNLOAD_LINK --output vs_installer.exe | ||
if ($LASTEXITCODE -ne 0) { | ||
echo "Download of the VS 2019 installer failed" | ||
echo "Download of the VS 2019 Version 16.8.5 installer failed" | ||
exit 1 | ||
} | ||
|
||
if (Test-Path "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe") { | ||
$existingPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -products "Microsoft.VisualStudio.Product.BuildTools" -version "[16, 17)" -property installationPath | ||
if ($existingPath -ne $null) { | ||
echo "Found existing BuildTools installation in $existingPath" | ||
$VS_UNINSTALL_ARGS = @("uninstall", "--installPath", "`"$existingPath`"", "--quiet","--wait") | ||
$process = Start-Process "${PWD}\vs_installer.exe" -ArgumentList $VS_UNINSTALL_ARGS -NoNewWindow -Wait -PassThru | ||
$exitCode = $process.ExitCode | ||
if (($exitCode -ne 0) -and ($exitCode -ne 3010)) { | ||
echo "Original BuildTools uninstall failed with code $exitCode" | ||
exit 1 | ||
} | ||
echo "Original BuildTools uninstalled" | ||
} | ||
} | ||
|
||
$process = Start-Process "${PWD}\vs_installer.exe" -ArgumentList $VS_INSTALL_ARGS -NoNewWindow -Wait -PassThru | ||
Remove-Item -Path vs_installer.exe -Force | ||
$exitCode = $process.ExitCode | ||
if (($exitCode -ne 0) -and ($exitCode -ne 3010)) { | ||
echo "VS 2019 installer exited with code $exitCode, which should be one of [0, 3010]." | ||
echo "VS 2017 installer exited with code $exitCode, which should be one of [0, 3010]." | ||
curl.exe --retry 3 -kL $COLLECT_DOWNLOAD_LINK --output Collect.exe | ||
if ($LASTEXITCODE -ne 0) { | ||
echo "Download of the VS Collect tool failed." | ||
exit 1 | ||
} | ||
Start-Process "${PWD}\Collect.exe" -NoNewWindow -Wait -PassThru | ||
New-Item -Path "C:\w\build-results" -ItemType "directory" -Force | ||
Copy-Item -Path "C:\Users\circleci\AppData\Local\Temp\vslogs.zip" -Destination "C:\w\build-results\" | ||
exit 1 | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
If we don't use VS2017, it'd better to remove them all
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.
Let's do that in a follow-up PR since this is not the only one spot that involves VS 2017.