|
| 1 | +parameters: |
| 2 | + ShouldPGO: false |
| 3 | + |
| 4 | +steps: |
| 5 | +- template: ./checkout.yml |
| 6 | + |
| 7 | +- powershell: | |
| 8 | + $d = (.\PCbuild\build.bat -V) | %{ if($_ -match '\s+(\w+):\s*(.+)\s*$') { @{$Matches[1] = $Matches[2];} }}; |
| 9 | + Write-Host "##vso[task.setvariable variable=VersionText]$($d.PythonVersion)" |
| 10 | + Write-Host "##vso[task.setvariable variable=VersionNumber]$($d.PythonVersionNumber)" |
| 11 | + Write-Host "##vso[task.setvariable variable=VersionHex]$($d.PythonVersionHex)" |
| 12 | + Write-Host "##vso[task.setvariable variable=VersionUnique]$($d.PythonVersionUnique)" |
| 13 | + Write-Host "##vso[build.addbuildtag]$($d.PythonVersion)" |
| 14 | + Write-Host "##vso[build.addbuildtag]$($d.PythonVersion)-$(Name)" |
| 15 | + displayName: 'Extract version numbers' |
| 16 | + |
| 17 | +- ${{ if eq(parameters.ShouldPGO, 'false') }}: |
| 18 | + - powershell: | |
| 19 | + $env:SigningCertificate = $null |
| 20 | + .\PCbuild\build.bat -v -p $(Platform) -c $(Configuration) |
| 21 | + displayName: 'Run build' |
| 22 | + env: |
| 23 | + IncludeUwp: true |
| 24 | + Py_OutDir: '$(Build.BinariesDirectory)\bin' |
| 25 | +
|
| 26 | +- ${{ if eq(parameters.ShouldPGO, 'true') }}: |
| 27 | + - powershell: | |
| 28 | + $env:SigningCertificate = $null |
| 29 | + .\PCbuild\build.bat -v -p $(Platform) --pgo |
| 30 | + displayName: 'Run build with PGO' |
| 31 | + env: |
| 32 | + IncludeUwp: true |
| 33 | + Py_OutDir: '$(Build.BinariesDirectory)\bin' |
| 34 | +
|
| 35 | +- powershell: | |
| 36 | + $kitroot = (gp 'HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots\').KitsRoot10 |
| 37 | + $tool = (gci -r "$kitroot\Bin\*\x64\signtool.exe" | sort FullName -Desc | select -First 1) |
| 38 | + if (-not $tool) { |
| 39 | + throw "SDK is not available" |
| 40 | + } |
| 41 | + Write-Host "##vso[task.prependpath]$($tool.Directory)" |
| 42 | + displayName: 'Add WinSDK tools to path' |
| 43 | + |
| 44 | +- powershell: | |
| 45 | + $env:SigningCertificate = $null |
| 46 | + .\python.bat PC\layout -vv -t "$(Build.BinariesDirectory)\catalog" --catalog "${env:CAT}.cdf" --preset-default |
| 47 | + makecat "${env:CAT}.cdf" |
| 48 | + del "${env:CAT}.cdf" |
| 49 | + if (-not (Test-Path "${env:CAT}.cat")) { |
| 50 | + throw "Failed to build catalog file" |
| 51 | + } |
| 52 | + displayName: 'Generate catalog' |
| 53 | + env: |
| 54 | + CAT: $(Build.BinariesDirectory)\bin\$(Arch)\python |
| 55 | + |
| 56 | +- task: PublishBuildArtifacts@1 |
| 57 | + displayName: 'Publish binaries' |
| 58 | + condition: and(succeeded(), not(and(eq(variables['Configuration'], 'Release'), variables['SigningCertificate']))) |
| 59 | + inputs: |
| 60 | + PathtoPublish: '$(Build.BinariesDirectory)\bin\$(Arch)' |
| 61 | + ArtifactName: bin_$(Name) |
| 62 | + |
| 63 | +- task: PublishBuildArtifacts@1 |
| 64 | + displayName: 'Publish binaries for signing' |
| 65 | + condition: and(succeeded(), and(eq(variables['Configuration'], 'Release'), variables['SigningCertificate'])) |
| 66 | + inputs: |
| 67 | + PathtoPublish: '$(Build.BinariesDirectory)\bin\$(Arch)' |
| 68 | + ArtifactName: unsigned_bin_$(Name) |
| 69 | + |
| 70 | +- task: CopyFiles@2 |
| 71 | + displayName: 'Layout Artifact: symbols' |
| 72 | + inputs: |
| 73 | + sourceFolder: $(Build.BinariesDirectory)\bin\$(Arch) |
| 74 | + targetFolder: $(Build.ArtifactStagingDirectory)\symbols\$(Name) |
| 75 | + flatten: true |
| 76 | + contents: | |
| 77 | + **\*.pdb |
| 78 | +
|
| 79 | +- task: PublishBuildArtifacts@1 |
| 80 | + displayName: 'Publish Artifact: symbols' |
| 81 | + inputs: |
| 82 | + PathToPublish: '$(Build.ArtifactStagingDirectory)\symbols' |
| 83 | + ArtifactName: symbols |
0 commit comments