mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-28 08:14:24 +02:00
merge vs2019 and telemetry build script changes (#545)
This commit is contained in:
parent
d476258f99
commit
991465e079
@ -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.
|
||||
@ -223,38 +229,39 @@ function Start-OpenSSHBootstrap
|
||||
$env:vctargetspath = "${env:ProgramFiles(x86)}\MSBuild\Microsoft.Cpp\v4.0\v140"
|
||||
if (-not (Test-Path $env:vctargetspath))
|
||||
{
|
||||
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
|
||||
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)
|
||||
if ($VS2019Path -or $VS2017Path)
|
||||
{
|
||||
$env:vctargetspath = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\VC\VCTargets"
|
||||
$VSPathYear = "2017"
|
||||
if ($VS2019Path)
|
||||
{
|
||||
$VSPathYear = "2019"
|
||||
}
|
||||
$env:vctargetspath = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\${VSPathYear}\BuildTools\Common7\IDE\VC\VCTargets"
|
||||
}
|
||||
}
|
||||
|
||||
$sdkPath = "${env:ProgramFiles(x86)}\Windows Kits\8.1\bin\x86\register_app.vbs"
|
||||
|
||||
if ($VS2019Path -or $VS2017Path)
|
||||
#use vs2017 build tool if exists
|
||||
if($VS2019Path -or $VS2017Path)
|
||||
{
|
||||
# Use VS2019 or VS2017 build tools if installed.
|
||||
if (-not (Test-Path $sdkPath))
|
||||
{
|
||||
$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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user