merge vs2019 and telemetry build script changes (#545)

This commit is contained in:
Tess Gauthier 2021-12-08 19:27:49 -05:00 committed by GitHub
parent d476258f99
commit 991465e079
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,4 @@
Set-StrictMode -Version 2.0
Set-StrictMode -Version 2.0
If ($PSVersiontable.PSVersion.Major -le 2) {$PSScriptRoot = Split-Path -Parent $MyInvocation.MyCommand.Path}
Import-Module $PSScriptRoot\OpenSSHCommonUtils.psm1 -Force
@ -214,6 +214,12 @@ function Start-OpenSSHBootstrap
$packageName = "windows-sdk-10.1"
Write-BuildMsg -AsInfo -Message "$packageName not present. Installing $packageName ..."
choco install $packageName --version=$Win10SDKVerChoco -y --force --limitoutput --execution-timeout 120 2>&1 >> $script:BuildLogFile
# check that sdk was properly installed
$sdkVersion = Get-Windows10SDKVersion
if($sdkVersion -eq $null)
{
Write-BuildMsg -AsError -ErrorAction Stop -Message "$packageName installation failed with error code $LASTEXITCODE."
}
}
# Using the Win 10 SDK, the x86/x64 builds with VS2015 need vctargetspath to be set.
@ -225,36 +231,37 @@ function Start-OpenSSHBootstrap
{
Write-BuildMsg -AsInfo -Message "installing visualcpp-build-tools"
choco install visualcpp-build-tools --version 14.0.25420.1 -y --force --limitoutput --execution-timeout 120 2>&1 >> $script:BuildLogFile
# check that build-tools were properly installed
if(-not (Test-Path $env:vctargetspath))
{
Write-BuildMsg -AsError -ErrorAction Stop -Message "$packageName installation failed with error code $LASTEXITCODE."
}
}
}
else
{
# msbuildtools have a different path for visual studio versions older than 2017
# for visual studio versions newer than 2017, logic needs to be expanded to update the year in the path accordingly
if ($VS2017Path -ne $null)
{
$env:vctargetspath = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\VC\VCTargets"
}
}
$sdkPath = "${env:ProgramFiles(x86)}\Windows Kits\8.1\bin\x86\register_app.vbs"
if ($VS2019Path -or $VS2017Path)
{
# Use VS2019 or VS2017 build tools if installed.
if (-not (Test-Path $sdkPath))
$VSPathYear = "2017"
if ($VS2019Path)
{
$packageName = "windows-sdk-8.1"
Write-BuildMsg -AsInfo -Message "$packageName not present. Installing $packageName ..."
choco install $packageName -y --force --limitoutput --execution-timeout 10000 2>&1 >> $script:BuildLogFile
$VSPathYear = "2019"
}
$env:vctargetspath = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\${VSPathYear}\BuildTools\Common7\IDE\VC\VCTargets"
}
}
#use vs2017 build tool if exists
if($VS2019Path -or $VS2017Path)
{
if(-not (Test-Path $VcVars))
{
Write-BuildMsg -AsError -ErrorAction Stop -Message "VC++ 2015.3 v140 toolset are not installed."
}
}
elseif (!$VS2015Path -or (-not (Test-Path $VcVars)) -or (-not (Test-Path $sdkPath))) {
elseif (!$VS2015Path -or (-not (Test-Path $VcVars))) {
$packageName = "vcbuildtools"
Write-BuildMsg -AsInfo -Message "$packageName not present. Installing $packageName ..."
choco install $packageName -ia "/InstallSelectableItems VisualCppBuildTools_ATLMFC_SDK;VisualCppBuildTools_NETFX_SDK" -y --force --limitoutput --execution-timeout 120 2>&1 >> $script:BuildLogFile
@ -291,7 +298,7 @@ function Start-OpenSSHBootstrap
Write-BuildMsg -AsVerbose -Message 'VC++ 2015 Build Tools already present.'
}
if($NativeHostArch.ToLower().Startswith('arm') -and ($VS2019Path -or $VS2017Path))
if($NativeHostArch.ToLower().Startswith('arm') -and !$VS2019Path -and !$VS2017Path)
{
#TODO: Install VS2019 or VS2017 build tools
Write-BuildMsg -AsError -ErrorAction Stop -Message "The required msbuild 15.0 is not installed on the machine."
@ -305,6 +312,11 @@ function Start-OpenSSHBootstrap
$packageName = "windows-sdk-10.1"
Write-BuildMsg -AsInfo -Message "$packageName not present. Installing $packageName ..."
choco install $packageName --version=$Win10SDKVerChoco --force --limitoutput --execution-timeout 120 2>&1 >> $script:BuildLogFile
$win10sdk = Get-Windows10SDKVersion
if($win10sdk -eq $null)
{
Write-BuildMsg -AsError -ErrorAction Stop -Message "$packageName installation failed with error code $LASTEXITCODE."
}
}
}
@ -654,7 +666,6 @@ function Get-VS2019BuildToolPath
{
return $null
}
return $toolAvailable[0].FullName
}
@ -672,7 +683,6 @@ function Get-VS2017BuildToolPath
{
return $null
}
return $toolAvailable[0].FullName
}
@ -689,7 +699,6 @@ function Get-VS2015BuildToolPath
{
return $null
}
return $toolAvailable[0].FullName
}