Skip to content

migrate dependencies to vcpkg #777

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: latestw_all
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 38 additions & 1 deletion .azdo/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@ stages:
Write-Host "sending " + $vstsCommandString
Write-Host "##$vstsCommandString"
displayName: Install PowerShell Core


- pwsh: |-
git clone https://github.com/microsoft/vcpkg
cd vcpkg
& ./bootstrap-vcpkg.bat
& ./vcpkg.exe integrate install
displayName: Install vcpkg

- pwsh: |
Import-Module -Name "$(Build.SourcesDirectory)/contrib/win32/openssh/AzDOBuildTools" -Force
Invoke-AzDOBuild
Expand All @@ -42,6 +49,10 @@ stages:
Get-ChildItem -Path $BuildOutx86Path
$BuildOutx64Path = Join-Path -Path $BuildOutPath -ChildPath 'x64/Release'
Get-ChildItem -Path $BuildOutx64Path
$BuildOutArm64Path = Join-Path -Path $BuildOutPath -ChildPath 'arm64/Release'
Get-ChildItem -Path $BuildOutArm64Path
$BuildOutArmPath = Join-Path -Path $BuildOutPath -ChildPath 'arm/Release'
Get-ChildItem -Path $BuildOutArmPath
displayName: Capture build results

- pwsh: |
Expand All @@ -57,6 +68,10 @@ stages:
Copy-BuildResults -BuildResultsPath $BuildDestx86Path -NativeHostArch x86 -Configuration Release
$BuildDestX64Path = Join-Path -Path $BuildDestPath -ChildPath 'x64/Release'
Copy-BuildResults -BuildResultsPath $BuildDestx64Path -NativeHostArch x64 -Configuration Release
$BuildDestArm64Path = Join-Path -Path $BuildDestPath -ChildPath 'arm64/Release'
Copy-BuildResults -BuildResultsPath $BuildDestArm64Path -NativeHostArch arm64 -Configuration Release
$BuildDestArmPath = Join-Path -Path $BuildDestPath -ChildPath 'arm/Release'
Copy-BuildResults -BuildResultsPath $BuildDestArmPath -NativeHostArch arm -Configuration Release
#
# Upload build artifacts
Write-Verbose -Verbose -Message "Uploading build artifacts"
Expand All @@ -68,6 +83,8 @@ stages:
$UnitTestDestPath = "$(Build.SourcesDirectory)/UnitTests"
Copy-UnitTests -UnitTestsSrcDir $BuildOutPath -UnitTestsDestDir $UnitTestDestPath -NativeHostArch x86 -Configuration Release
Copy-UnitTests -UnitTestsSrcDir $BuildOutPath -UnitTestsDestDir $UnitTestDestPath -NativeHostArch x64 -Configuration Release
Copy-UnitTests -UnitTestsSrcDir $BuildOutPath -UnitTestsDestDir $UnitTestDestPath -NativeHostArch arm64 -Configuration Release
Copy-UnitTests -UnitTestsSrcDir $BuildOutPath -UnitTestsDestDir $UnitTestDestPath -NativeHostArch arm -Configuration Release
#
# Upload unit test artifacts
Write-Verbose -Verbose -Message "Uploading unit test artifacts"
Expand All @@ -81,6 +98,26 @@ stages:
Write-Host "##vso[artifact.upload containerfolder=$artifactName;artifactname=$artifactName;]$configFilePath"
displayName: Upload Win32-OpenSSH build artifacts

- pwsh: |
$logFileNames = @("OpenSSHReleasex64.log", "OpenSSHReleasex86.log", "OpenSSHReleaseARM64.log", "OpenSSHReleaseARM.log")
$uniqueLines = [System.Collections.Generic.HashSet[string]]::new()
forEach ($logFile in $logFileNames) {
$logFilePath = "$(Build.SourcesDirectory)/contrib/win32/openssh/$logFile"
$logLines = Get-Content $logFilePath
$buildSucceededIndex = $logLines.IndexOf("Build succeeded.")
$linesToCheck = $logLines[($buildSucceededIndex + 1)..$logLines.Length]
forEach ($line in $linesToCheck) {
if ($line -match "warning C") {
$uniqueLines.Add($line) | Out-Null
}
}
}
forEach ($uniqueLine in $uniqueLines) {
Write-Output $uniqueLine
Write-Host "##vso[task.logissue type=warning]$uniqueLine"
}
displayName: Surface Warnings from Build Logs

- stage: Test
displayName: Test Win32-OpenSSH
dependsOn: Build
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ tags
/contrib/win32/openssh/LibreSSL
/contrib/win32/openssh/ZLib
/contrib/win32/openssh/libfido2
/contrib/win32/openssh/vcpkg_installed
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

Expand Down
32 changes: 17 additions & 15 deletions contrib/win32/openssh/AzDOBuildTools/AzDOBuildTools.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ function Invoke-AzDOBuild
{
Start-OpenSSHBuild -Configuration Release -NativeHostArch x64 -Verbose
Start-OpenSSHBuild -Configuration Release -NativeHostArch x86 -Verbose
Start-OpenSSHBuild -Configuration Release -NativeHostArch arm64 -Verbose
Start-OpenSSHBuild -Configuration Release -NativeHostArch arm -Verbose
Write-BuildMessage -Message "OpenSSH binaries build success!" -Category Information
}

Expand All @@ -47,7 +49,7 @@ function Invoke-AzDOBuild
function Install-OpenSSH
{
[CmdletBinding()]
param (
param (
[Parameter(Mandatory=$true)]
[string]$SourceDir,

Expand All @@ -62,7 +64,7 @@ function Install-OpenSSH

Copy-Item -Path "$SourceDir/*" -Destination $OpenSSHDir -Recurse -Force -Verbose

Push-Location $OpenSSHDir
Push-Location $OpenSSHDir

try
{
Expand All @@ -81,8 +83,8 @@ function Install-OpenSSH
{
[Environment]::SetEnvironmentVariable('Path', $newMachineEnvironmentPath, 'MACHINE')
}
Start-Service -Name sshd

Start-Service -Name sshd
Start-Service -Name ssh-agent
}
finally
Expand All @@ -100,7 +102,7 @@ function Install-OpenSSH
function UnInstall-OpenSSH
{
[CmdletBinding()]
param (
param (
[string]$OpenSSHDir = "$env:SystemDrive\OpenSSH"
)

Expand All @@ -117,15 +119,15 @@ function UnInstall-OpenSSH
Stop-Service ssh-agent -Force
}
& "$OpenSSHDir\uninstall-sshd.ps1"

$machinePath = [Environment]::GetEnvironmentVariable('Path', 'MACHINE')
$newMachineEnvironmentPath = $machinePath
if ($machinePath.ToLower().Contains($OpenSSHDir.ToLower()))
{
{
$newMachineEnvironmentPath = $newMachineEnvironmentPath.Replace("$OpenSSHDir;", '')
$env:Path = $env:Path.Replace("$OpenSSHDir;", '')
}

if ($newMachineEnvironmentPath -ne $machinePath)
{
[Environment]::SetEnvironmentVariable('Path', $newMachineEnvironmentPath, 'MACHINE')
Expand All @@ -136,7 +138,7 @@ function UnInstall-OpenSSH
Pop-Location
}

Remove-Item -Path $OpenSSHDir -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path $OpenSSHDir -Recurse -Force -ErrorAction SilentlyContinue
}

#
Expand Down Expand Up @@ -181,7 +183,7 @@ function Invoke-OpenSSHTests
}

$xml = [xml](Get-Content $OpenSSHTestInfo["SetupTestResultsFile"] | out-string)
if ([int]$xml.'test-results'.failures -gt 0)
if ([int]$xml.'test-results'.failures -gt 0)
{
$errorMessage = "$($xml.'test-results'.failures) Setup Tests in regress\pesterTests failed. Detail test log is at $($OpenSSHTestInfo["SetupTestResultsFile"])."
Write-BuildMessage -Message $errorMessage -Category Error
Expand Down Expand Up @@ -306,7 +308,7 @@ function Invoke-OpenSSHTests
else
{
$xml = [xml](Get-Content $OpenSSHTestInfo["UninstallTestResultsFile"] | out-string)
if ([int]$xml.'test-results'.failures -gt 0)
if ([int]$xml.'test-results'.failures -gt 0)
{
$errorMessage = "$($xml.'test-results'.failures) uninstall tests in regress\pesterTests failed. Detail test log is at $($OpenSSHTestInfo["UninstallTestResultsFile"])."
Write-BuildMessage -Message $errorMessage -Category Error
Expand All @@ -318,7 +320,7 @@ function Invoke-OpenSSHTests
$OpenSSHTestInfo | Export-Clixml -Path "$repoRoot/OpenSSHTestInfo.xml" -Depth 10

# Writing out warning when the $Error.Count is non-zero. Tests Should clean $Error after success.
if ($Error.Count -gt 0)
if ($Error.Count -gt 0)
{
Write-BuildMessage -Message "Tests Should always clean $Error variable after success." -Category Warning
}
Expand All @@ -339,7 +341,7 @@ function Invoke-OpenSSHTests
Collect OpenSSH pester test results into one directory
#>
function Copy-OpenSSHTestResults
{
{
param (
[Parameter(Mandatory=$true)]
[string] $ResultsPath
Expand All @@ -352,7 +354,7 @@ function Copy-OpenSSHTestResults

Write-Verbose -Verbose "Creating test results directory for artifacts upload: $ResultsPath"
$null = New-Item -Path $ResultsPath -ItemType Directory -Force

if (! (Test-Path -Path $ResultsPath))
{
Write-BuildMessage -Message "Unable to write to test results path for test artifacts upload: $ResultsPath" -Category Error
Expand Down Expand Up @@ -498,7 +500,7 @@ function Copy-UnitTests
function Install-UnitTests
{
[CmdletBinding()]
param (
param (
[Parameter(Mandatory=$true)]
[string]$SourceDir,

Expand Down
8 changes: 5 additions & 3 deletions contrib/win32/openssh/OpenSSHBuildHelper.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -365,18 +365,20 @@ function Start-OpenSSHPackage
}

#copy libcrypto dll
$libreSSLPath = Join-Path $PSScriptRoot "LibreSSL"
$libreSSLPath = Join-Path $PSScriptRoot "vcpkg_installed"
if (-not $NoOpenSSL.IsPresent)
{
if($OneCore)
{
# TO-DO: update path - this may be the same as below or use another custom triplet?
Copy-Item -Path $(Join-Path $libreSSLPath "bin\onecore\$NativeHostArch\libcrypto.dll") -Destination $packageDir -Force -ErrorAction Stop
Copy-Item -Path $(Join-Path $libreSSLPath "bin\onecore\$NativeHostArch\libcrypto.pdb") -Destination $symbolsDir -Force -ErrorAction Stop
}
else
{
Copy-Item -Path $(Join-Path $libreSSLPath "bin\desktop\$NativeHostArch\libcrypto.dll") -Destination $packageDir -Force -ErrorAction Stop
Copy-Item -Path $(Join-Path $libreSSLPath "bin\desktop\$NativeHostArch\libcrypto.pdb") -Destination $symbolsDir -Force -ErrorAction Stop
$subPath = $NativeHostArch + "-custom\" + $NativeHostArch + "-custom\bin\"
Copy-Item -Path $(Join-Path $libreSSLPath "$subPath\libcrypto.dll") -Destination $packageDir -Force -ErrorAction Stop
Copy-Item -Path $(Join-Path $libreSSLPath "$subPath\libcrypto.pdb") -Destination $symbolsDir -Force -ErrorAction Stop
}
}

Expand Down
Loading