@@ -24,7 +24,7 @@ parameters:
2424 type : object
2525 default :
2626 - target : " wsl;libwsl;wslg;wslservice;wslhost;wslrelay;wslinstaller;wslinstall;initramfs;wslserviceproxystub;wslsettings;wslinstallerproxystub;testplugin"
27- pattern : " wsl.exe,libwsl.dll,wslg.exe,wslservice.exe,wslhost.exe,wslrelay.exe,wslinstaller.exe,wslinstall.dll,wslserviceproxystub.dll,wslsettings.dll,wslsettings.exe,wslinstallerproxystub.dll,wsldevicehost.dll,WSLDVCPlugin.dll,testplugin.dll,wsldeps.dll"
27+ pattern : " wsl.exe,libwsl.dll,wslg.exe,wslservice.exe,wslhost.exe,wslrelay.exe,wslinstaller.exe,wslinstall.dll,wslserviceproxystub.dll,wslsettings/wslsettings .dll,wslsettings/ wslsettings.exe,wslinstallerproxystub.dll,wsldevicehost.dll,WSLDVCPlugin.dll,testplugin.dll,wsldeps.dll"
2828 - target : " msixgluepackage"
2929 pattern : " gluepackage.msix"
3030 - target : " msipackage"
@@ -120,6 +120,11 @@ stages:
120120 ob_sdl_codeSignValidation_excludes : -|**testbin\**
121121 Codeql.PublishDatabaseLog : true
122122 Codeql.SourceRoot : src
123+ packageStagingDir : ' $(Build.SourcesDirectory)\packageStagingDir'
124+ ${{ if eq(parameters.isRelease, 'true') }} :
125+ packageInputDirArg : ' -DPACKAGE_INPUT_DIR=$(packageStagingDir)'
126+ ${{ else }} :
127+ packageInputDirArg : ' '
123128
124129 steps :
125130
@@ -166,7 +171,7 @@ stages:
166171 displayName : " CMake ${{ platform }}"
167172 inputs :
168173 workingDirectory : " ."
169- cmakeArgs : . --fresh -A ${{ platform }} -DCMAKE_BUILD_TYPE=Release -DCMAKE_SYSTEM_VERSION=10.0.26100.0 -DPACKAGE_VERSION=$(version.WSL_PACKAGE_VERSION) -DWSL_NUGET_PACKAGE_VERSION=$(version.WSL_NUGET_PACKAGE_VERSION) -DSKIP_PACKAGE_SIGNING=${{ parameters.isRelease }} -DOFFICIAL_BUILD=${{ parameters.isRelease }} -DPIPELINE_BUILD_ID=$(Build.BuildId) -DVSO_ORG=${{ parameters.vsoOrg }} -DVSO_PROJECT=${{ parameters.vsoProject }} -DWSL_BUILD_WSL_SETTINGS=true
174+ cmakeArgs : . --fresh -A ${{ platform }} -DCMAKE_BUILD_TYPE=Release -DCMAKE_SYSTEM_VERSION=10.0.26100.0 -DPACKAGE_VERSION=$(version.WSL_PACKAGE_VERSION) -DWSL_NUGET_PACKAGE_VERSION=$(version.WSL_NUGET_PACKAGE_VERSION) -DSKIP_PACKAGE_SIGNING=${{ parameters.isRelease }} -DOFFICIAL_BUILD=${{ parameters.isRelease }} -DPIPELINE_BUILD_ID=$(Build.BuildId) -DVSO_ORG=${{ parameters.vsoOrg }} -DVSO_PROJECT=${{ parameters.vsoProject }} -DWSL_BUILD_WSL_SETTINGS=true $(packageInputDirArg)\${{ platform }}
170175
171176 # This additional Restore NuGet package task is added as a workaround for WSL Settings to have its packages restored properly.
172177 # Without this, building wsl settings may encounter the following error:
@@ -196,7 +201,7 @@ stages:
196201 AuthSignCertName : ${{ parameters.esrp.AuthSignCertName }}
197202 AppRegistrationClientId : ${{ parameters.esrp.AppRegistrationClientId }}
198203 AppRegistrationTenantId : ${{ parameters.esrp.AppRegistrationTenantId }}
199- FolderPath : " bin\\ ${{ platform }}"
204+ FolderPath : " bin\\ ${{ platform }}\\ Release "
200205 Pattern : " ${{ target.pattern }}"
201206 UseMSIAuthentication : true
202207 EsrpClientId : ${{ parameters.esrp.EsrpClientId }}
@@ -224,20 +229,27 @@ stages:
224229 }
225230 ]
226231
227- # Replace the intermediate wslsettings binaries file with the signed versions so that any future steps building wslsettings will use the signed versions
228- - task : PowerShell@2
229- displayName : ' Replace wslsettings binaries in intermediate folder with signed versions'
230- condition : and(succeeded(), eq('${{ parameters.isRelease }}', true))
231- inputs :
232- targetType : inline
233- script : |
234- $arch = '${{ platform }}'
235- $wslsettingsbinpath = "bin\$arch\release\wslsettings"
236- $wslsettingsobjpath = "src\windows\wslsettings\obj\$arch\release"
237- # Update the timestamp of wslsettings.exe so that it doesn't get rebuilt
238- (Get-Item $wslsettingsbinpath\wslsettings.exe).LastWriteTime = Get-Date
239- Copy-Item $wslsettingsbinpath\wslsettings.dll $wslsettingsobjpath\wslsettings.dll -Force
240- Copy-Item $wslsettingsbinpath\wslsettings.exe $wslsettingsobjpath\apphost.exe -Force
232+ - task : PowerShell@2
233+ displayName : " Copy signed ${{ target.target }} to staging (${{ platform }})"
234+ condition : and(succeeded(), eq('${{ parameters.isRelease }}', true))
235+ inputs :
236+ targetType : inline
237+ script : |
238+ $arch = '${{ platform }}'
239+ $pattern = '${{ target.pattern }}'
240+ $inputDir = "bin\$arch\Release"
241+ $outputDir = "$(packageStagingDir)\$arch"
242+ New-Item -ItemType Directory -Path "$outputDir\wslsettings" -Force
243+ foreach ($file in $pattern.Split(',')) {
244+ $sourcePath = Join-Path $inputDir $file
245+ if (Test-Path $sourcePath) {
246+ $destPath = Join-Path $outputDir $file
247+ Write-Host "Copying signed file: $sourcePath -> $destPath"
248+ Copy-Item -Path $sourcePath -Destination $destPath -Force
249+ } else {
250+ Write-Warning "File not found: $sourcePath"
251+ }
252+ }
241253
242254 - script : cmake --build . --config Release -- -m
243255 displayName : " Build installer msix and tests (${{ platform }})"
@@ -411,3 +423,4 @@ stages:
411423
412424 - task : CodeQL3000Finalize@0
413425 condition : ${{ and(parameters.isNightly, eq(variables['Build.SourceBranch'], 'refs/heads/main'))}}
426+
0 commit comments