|
1 |
| -Set-StrictMode -Version 2.0 |
| 1 | +Set-StrictMode -Version 2.0 |
2 | 2 | If ($PSVersiontable.PSVersion.Major -le 2) {$PSScriptRoot = Split-Path -Parent $MyInvocation.MyCommand.Path}
|
3 | 3 | Import-Module $PSScriptRoot\OpenSSHCommonUtils.psm1 -Force
|
4 | 4 |
|
@@ -150,6 +150,7 @@ function Start-OpenSSHBootstrap
|
150 | 150 | [bool] $silent = -not $script:Verbose
|
151 | 151 | Write-BuildMsg -AsInfo -Message "Checking tools and dependencies" -Silent:$silent
|
152 | 152 |
|
| 153 | + $Win10SDKVerChoco = "10.1.17763.1" |
153 | 154 | $machinePath = [Environment]::GetEnvironmentVariable('Path', 'MACHINE')
|
154 | 155 | $newMachineEnvironmentPath = $machinePath
|
155 | 156 |
|
@@ -205,26 +206,36 @@ function Start-OpenSSHBootstrap
|
205 | 206 | }
|
206 | 207 |
|
207 | 208 | $vcVars = "${env:ProgramFiles(x86)}\Microsoft Visual Studio 14.0\Common7\Tools\vsvars32.bat"
|
208 |
| - $sdkPath = "${env:ProgramFiles(x86)}\Windows Kits\8.1\bin\x86\register_app.vbs" |
| 209 | + $sdkVersion = Get-Windows10SDKVersion |
| 210 | + $env:vctargetspath = "${env:ProgramFiles(x86)}\MSBuild\Microsoft.Cpp\v4.0\v140" |
| 211 | + |
| 212 | + if ($sdkVersion -eq $null) |
| 213 | + { |
| 214 | + $packageName = "windows-sdk-10.1" |
| 215 | + Write-BuildMsg -AsInfo -Message "$packageName not present. Installing $packageName ..." |
| 216 | + choco install $packageName --version=$Win10SDKVerChoco -y --force --limitoutput --execution-timeout 120 2>&1 >> $script:BuildLogFile |
| 217 | + } |
| 218 | + |
| 219 | + if (-not (Test-Path $env:vctargetspath)) |
| 220 | + { |
| 221 | + Write-BuildMsg -AsInfo -Message "installing visualcpp-build-tools" |
| 222 | + choco install visualcpp-build-tools --version 14.0.25420.1 -y --force --limitoutput --execution-timeout 120 2>&1 >> $script:BuildLogFile |
| 223 | + } |
| 224 | + |
209 | 225 | #use vs2017 build tool if exists
|
210 | 226 | if($VS2017Path -ne $null)
|
211 | 227 | {
|
212 |
| - If (-not (Test-Path $sdkPath)) |
213 |
| - { |
214 |
| - $packageName = "windows-sdk-8.1" |
215 |
| - Write-BuildMsg -AsInfo -Message "$packageName not present. Installing $packageName ..." |
216 |
| - choco install $packageName -y --force --limitoutput --execution-timeout 10000 2>&1 >> $script:BuildLogFile |
217 |
| - } |
| 228 | + |
218 | 229 |
|
219 | 230 | if(-not (Test-Path $VcVars))
|
220 | 231 | {
|
221 | 232 | Write-BuildMsg -AsError -ErrorAction Stop -Message "VC++ 2015.3 v140 toolset are not installed."
|
222 | 233 | }
|
223 | 234 | }
|
224 |
| - elseIf (($VS2015Path -eq $null) -or (-not (Test-Path $VcVars)) -or (-not (Test-Path $sdkPath))) { |
| 235 | + elseIf (($VS2015Path -eq $null) -or (-not (Test-Path $VcVars))) { |
225 | 236 | $packageName = "vcbuildtools"
|
226 | 237 | Write-BuildMsg -AsInfo -Message "$packageName not present. Installing $packageName ..."
|
227 |
| - choco install $packageName -ia "/InstallSelectableItems VisualCppBuildTools_ATLMFC_SDK;VisualCppBuildTools_NETFX_SDK;Win81SDK_CppBuildSKUV1" -y --force --limitoutput --execution-timeout 10000 2>&1 >> $script:BuildLogFile |
| 238 | + choco install $packageName -ia "/InstallSelectableItems VisualCppBuildTools_ATLMFC_SDK;VisualCppBuildTools_NETFX_SDK" -y --force --limitoutput --execution-timeout 120 2>&1 >> $script:BuildLogFile |
228 | 239 | $errorCode = $LASTEXITCODE
|
229 | 240 | if ($errorCode -eq 3010)
|
230 | 241 | {
|
@@ -272,7 +283,7 @@ function Start-OpenSSHBootstrap
|
272 | 283 | {
|
273 | 284 | $packageName = "windows-sdk-10.1"
|
274 | 285 | Write-BuildMsg -AsInfo -Message "$packageName not present. Installing $packageName ..."
|
275 |
| - choco install $packageName --force --limitoutput --execution-timeout 10000 2>&1 >> $script:BuildLogFile |
| 286 | + choco install $packageName --version=$Win10SDKVerChoco --force --limitoutput --execution-timeout 120 2>&1 >> $script:BuildLogFile |
276 | 287 | }
|
277 | 288 | }
|
278 | 289 |
|
@@ -577,6 +588,7 @@ function Start-OpenSSHBuild
|
577 | 588 | }
|
578 | 589 |
|
579 | 590 | Write-BuildMsg -AsInfo -Message "Starting Open SSH build; Build Log: $($script:BuildLogFile)."
|
| 591 | + Write-BuildMsg -AsInfo -Message "$msbuildCmd $cmdMsg" |
580 | 592 |
|
581 | 593 | & "$msbuildCmd" $cmdMsg
|
582 | 594 | $errorCode = $LASTEXITCODE
|
@@ -622,20 +634,17 @@ function Get-VS2015BuildToolPath
|
622 | 634 | }
|
623 | 635 |
|
624 | 636 | function Get-Windows10SDKVersion
|
625 |
| -{ |
| 637 | +{ |
| 638 | + #Temporary fix - Onecore builds are failing with latest windows 10 SDK (10.0.18362.0) |
| 639 | + $requiredSDKVersion = [version]"10.0.17763.0" |
626 | 640 | ## Search for latest windows sdk available on the machine
|
627 |
| - $windowsSDKPath = Join-Path ${env:ProgramFiles(x86)} "Windows Kits\10\Lib" |
628 |
| - $minSDKVersion = [version]"10.0.14393.0" |
629 |
| - $versionsAvailable = @() |
630 |
| - #Temporary fix - Onecore builds are failing with latest widows 10 SDK (10.0.18362.0) |
631 |
| - $maxSDKVersion = [version]"10.0.17763.0" |
632 |
| - $versionsAvailable = Get-ChildItem $windowsSDKPath | ? {$_.Name.StartsWith("10.")} | % {$version = [version]$_.Name; if(($version.CompareTo($minSDKVersion) -ge 0) -and ($version.CompareTo($maxSDKVersion) -le 0)) {$version}} |
633 |
| - if(0 -eq $versionsAvailable.count) |
634 |
| - { |
635 |
| - return $null |
| 641 | + $windowsSDKPath = Join-Path ${env:ProgramFiles(x86)} "Windows Kits\10\bin\$requiredSDKVersion\x86\register_app.vbs" |
| 642 | + if (test-path $windowsSDKPath) { |
| 643 | + return $requiredSDKVersion |
| 644 | + } |
| 645 | + else { |
| 646 | + return $null |
636 | 647 | }
|
637 |
| - $versionsAvailable = $versionsAvailable | Sort-Object -Descending |
638 |
| - return $versionsAvailable[0] |
639 | 648 | }
|
640 | 649 |
|
641 | 650 | function Get-BuildLogFile
|
|
0 commit comments