From dbb17afcb23544cb9da192e62130eae6cd8b9ca0 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Mon, 1 Jul 2024 11:36:04 -0700 Subject: [PATCH] Skip build steps that do not have exe packages (#23945) --- .pipelines/templates/windows-package-build.yml | 13 +++++++++++-- tools/packaging/packaging.psm1 | 18 ++++++++++++++---- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/.pipelines/templates/windows-package-build.yml b/.pipelines/templates/windows-package-build.yml index 102c9e47df..da2579d75a 100644 --- a/.pipelines/templates/windows-package-build.yml +++ b/.pipelines/templates/windows-package-build.yml @@ -205,7 +205,7 @@ jobs: Write-Verbose -Verbose "exePath: $exePath" $enginePath = Join-Path -Path '$(System.ArtifactsDirectory)\unsignedEngine' -ChildPath engine.exe - Expand-ExePackageEngine -ExePath $exePath -EnginePath $enginePath + Expand-ExePackageEngine -ExePath $exePath -EnginePath $enginePath -ProductTargetArchitecture $runtime displayName: 'Make exe and expand package' - task: onebranch.pipeline.signing@1 @@ -217,14 +217,23 @@ jobs: search_root: '$(Pipeline.Workspace)' - pwsh: | + $runtime = '$(Runtime)' + Write-Verbose -Verbose "runtime = '$(Runtime)'" $repoRoot = "$env:REPOROOT" Import-Module "$repoRoot\build.psm1" Import-Module "$repoRoot\tools\packaging" + $noExeRuntimes = @('fxdependent', 'fxdependentWinDesktop', 'minsize') + + if ($runtime -in $noExeRuntimes) { + Write-Verbose -Verbose "No EXE generated for $runtime" + return + } + $exePath = '$(exePath)' $enginePath = Join-Path -Path '$(System.ArtifactsDirectory)\unsignedEngine' -ChildPath engine.exe $enginePath | Get-AuthenticodeSignature | out-string | Write-Verbose -verbose - Compress-ExePackageEngine -ExePath $exePath -EnginePath $enginePath + Compress-ExePackageEngine -ExePath $exePath -EnginePath $enginePath -ProductTargetArchitecture $runtime displayName: Compress signed exe package - task: onebranch.pipeline.signing@1 diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index 6c9506ce83..32f6fbf601 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -3598,7 +3598,12 @@ function Expand-ExePackageEngine { # Location to put the expanded engine. [Parameter(Mandatory = $true)] [string] - $EnginePath + $EnginePath, + + [Parameter(Mandatory = $true)] + [ValidateSet("x86", "x64", "arm64")] + [ValidateNotNullOrEmpty()] + [string] $ProductTargetArchitecture ) <# @@ -3606,7 +3611,7 @@ function Expand-ExePackageEngine { insignia -ib TestInstaller.exe -o engine.exe #> - $wixPaths = Get-WixPath + $wixPaths = Get-WixPath -IsProductArchitectureArm ($ProductTargetArchitecture -eq "arm64") $resolvedExePath = (Resolve-Path -Path $ExePath).ProviderPath $resolvedEnginePath = [System.IO.Path]::GetFullPath($EnginePath) @@ -3628,7 +3633,12 @@ function Compress-ExePackageEngine { # Location of the signed engine [Parameter(Mandatory = $true)] [string] - $EnginePath + $EnginePath, + + [Parameter(Mandatory = $true)] + [ValidateSet("x86", "x64", "arm64")] + [ValidateNotNullOrEmpty()] + [string] $ProductTargetArchitecture ) @@ -3637,7 +3647,7 @@ function Compress-ExePackageEngine { insignia -ab engine.exe TestInstaller.exe -o TestInstaller.exe #> - $wixPaths = Get-WixPath + $wixPaths = Get-WixPath -IsProductArchitectureArm ($ProductTargetArchitecture -eq "arm64") $resolvedEnginePath = (Resolve-Path -Path $EnginePath).ProviderPath $resolvedExePath = (Resolve-Path -Path $ExePath).ProviderPath