|
| 1 | +parameters: |
| 2 | +- name: triplet |
| 3 | + type: string |
| 4 | +- name: artifactSuffix |
| 5 | + type: string |
| 6 | + |
| 7 | +steps: |
| 8 | +- pwsh: | |
| 9 | + # Compare LibreSSL versions in vcpkg.json and add-resource-file.patch |
| 10 | + $vcpkgObj = Get-Content "$(Build.SourcesDirectory)/contrib/win32/openssh/vcpkg.json" | ConvertFrom-Json |
| 11 | + $libresslVersionJson = $vcpkgObj | Select-Object -ExpandProperty overrides | Where-Object { $_.name -eq 'libressl' } | Select-Object -ExpandProperty version |
| 12 | +
|
| 13 | + # resource file version needs to be trimmed (e.g. 4.0.0.0 to 4.0.0) |
| 14 | + $patchContent = Get-Content "$(Build.SourcesDirectory)/contrib/win32/openssh/vcpkg_overlay_ports/libressl/add-version-file.patch" |
| 15 | + $libresslVersionPatch = ($patchContent -join "`n" | Select-String -Pattern '"FileVersion",\s*"(\d+\.\d+\.\d+\.\d+)"' -AllMatches).Matches | ForEach-Object { $_.Groups[1].Value } |
| 16 | + $libresslVersionPatchParts = $libresslVersionPatch -split '\.' |
| 17 | + $libresslVersionPatchShort = ($libresslVersionPatchParts[0..2] -join '.') |
| 18 | +
|
| 19 | + if ($libresslVersionJson -ne $libresslVersionPatchShort) { |
| 20 | + Write-Error "LibreSSL version mismatch: vcpkg.json has $libresslVersionJson, patch file has $libresslVersionPatch" |
| 21 | + exit 1 |
| 22 | + } else { |
| 23 | + Write-Verbose -Verbose "LibreSSL versions match: $libresslVersionJson" |
| 24 | + } |
| 25 | + displayName: 'Verify version info' |
| 26 | + |
| 27 | +- pwsh: | |
| 28 | + $ErrorActionPreference = 'Stop' |
| 29 | + git clone https://github.com/microsoft/vcpkg |
| 30 | + cd vcpkg |
| 31 | + & ./bootstrap-vcpkg.bat |
| 32 | + & ./vcpkg.exe integrate install |
| 33 | + displayName: Install and bootstrap vcpkg |
| 34 | + |
| 35 | +- pwsh: | |
| 36 | + $triplet = '${{ parameters.triplet }}' |
| 37 | + Write-Verbose -Verbose "Installing vcpkg dependencies for triplet: $triplet" |
| 38 | + |
| 39 | + Push-Location "$(Build.SourcesDirectory)/contrib/win32/openssh" |
| 40 | + try { |
| 41 | + & "$(Build.SourcesDirectory)/vcpkg/vcpkg.exe" install --triplet $triplet --overlay-triplets=.\vcpkg_triplets --overlay-ports=.\vcpkg_overlay_ports |
| 42 | + if ($LASTEXITCODE -ne 0) { |
| 43 | + throw "vcpkg install failed with exit code $LASTEXITCODE" |
| 44 | + } |
| 45 | + } finally { |
| 46 | + Pop-Location |
| 47 | + } |
| 48 | + displayName: Install vcpkg dependencies (${{ parameters.triplet }}) |
| 49 | + |
| 50 | +- pwsh: | |
| 51 | + $artifactSuffix = '${{ parameters.artifactSuffix }}' |
| 52 | + $vcpkgInstalledPath = "$(Build.SourcesDirectory)/contrib/win32/openssh/vcpkg_installed" |
| 53 | + |
| 54 | + if (Test-Path -Path $vcpkgInstalledPath) { |
| 55 | + Write-Verbose -Verbose "vcpkg_installed directory contents:" |
| 56 | + Get-ChildItem -Path $vcpkgInstalledPath -Recurse -Depth 2 | Select-Object -First 50 |
| 57 | + |
| 58 | + # Upload vcpkg dependencies artifact |
| 59 | + Write-Verbose -Verbose -Message "Uploading vcpkg dependencies artifact" |
| 60 | + $artifactName = "vcpkg-dependencies-$artifactSuffix" |
| 61 | + Write-Host "##vso[artifact.upload containerfolder=$artifactName;artifactname=$artifactName;]$vcpkgInstalledPath" |
| 62 | + } else { |
| 63 | + Write-Error "vcpkg_installed directory not found at: $vcpkgInstalledPath" |
| 64 | + exit 1 |
| 65 | + } |
| 66 | + displayName: Upload vcpkg dependencies (${{ parameters.artifactSuffix }}) |
0 commit comments