Skip to content

Commit e5367c8

Browse files
authored
Setup Validation Stage for Installer in the Foundation PR build (#4516)
1 parent 9e53458 commit e5367c8

6 files changed

+466
-0
lines changed

build/AzurePipelinesTemplates/WindowsAppSDK-Build-Stage.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ parameters:
1111

1212
stages:
1313
- stage: Build
14+
dependsOn: []
1415
jobs:
1516
- job: VerifyCopyrightHeaders
1617
dependsOn: []
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# This Installer Stage is purely for validation
2+
# The actual installer is built with the Aggregator build
3+
stages:
4+
- stage: InstallerValidation
5+
jobs:
6+
- job: BuildInstaller
7+
dependsOn: []
8+
pool:
9+
type: windows
10+
isCustom: true
11+
name: 'ProjectReunionESPool-2022' # This stage is purely for validation
12+
strategy:
13+
maxParallel: 10
14+
matrix:
15+
Release_x86:
16+
buildPlatform: 'x86'
17+
buildConfiguration: 'Release'
18+
Release_x64:
19+
buildPlatform: 'x64'
20+
buildConfiguration: 'Release'
21+
Release_arm64:
22+
buildPlatform: 'arm64'
23+
buildConfiguration: 'Release'
24+
variables:
25+
ob_outputDirectory: '$(REPOROOT)\out'
26+
ob_artifactSuffix: '_$(buildConfiguration)_$(buildPlatform)'
27+
ob_artifactBaseName: "Installer$(ob_artifactSuffix)"
28+
steps:
29+
- template: WindowsAppSDK-BuildInstaller-Steps.yml@self
Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
steps:
2+
###
3+
# This step downloads the WindowsAppSDK NuGet package from last successful build of the Aggregator's Nightly build
4+
# for use in building the installers
5+
- task: DownloadPipelineArtifact@2
6+
displayName: 'Download WindowsAppSDK'
7+
inputs:
8+
artifactName: 'WindowsAppSDK_Nuget_And_MSIX'
9+
targetPath: '$(System.ArtifactsDirectory)'
10+
source: 'specific'
11+
project: $(System.TeamProjectId)
12+
pipeline: 118002
13+
runVersion: 'latestFromBranch'
14+
runBranch: "refs/heads/main"
15+
16+
###
17+
# Install the internal licensing support for release-signed packages. This can always be present in
18+
# pipeline builds. The installer code will automatically degrade / skip licenses in non-release builds
19+
20+
# Future: this stage only requires a the app licensing internal package, but is downloading all transport packages
21+
# used for aggregation consider refactoring for efficiency.
22+
- task: PowerShell@2
23+
name: ConvertVersionDetailsToPackageConfig
24+
displayName: "Convert VersionDetails To PackageConfig"
25+
inputs:
26+
filePath: '$(Build.SourcesDirectory)\build\Scripts\ConvertVersionDetailsToPackageConfig.ps1'
27+
arguments: -versionDetailsPath '$(Build.SourcesDirectory)\eng\Version.Details.xml' -packageConfigPath '$(Build.SourcesDirectory)\build\packages.config'
28+
29+
- task: 333b11bd-d341-40d9-afcf-b32d5ce6f23b@2
30+
displayName: RestoreNuGetPackages
31+
inputs:
32+
restoreSolution: $(Build.SourcesDirectory)/build/packages.config
33+
feedsToUse: config
34+
nugetConfigPath: $(Build.SourcesDirectory)/nuget.config
35+
restoreDirectory: packages
36+
37+
- task: powershell@2
38+
displayName: 'Create test pfx to sign MSIX test packages (DevCheck)'
39+
inputs:
40+
targetType: filePath
41+
filePath: eng\common\DevCheck.ps1
42+
arguments: -NoInteractive -Offline -Verbose -CertPassword 'BuildPipeline' -CheckTestPfx -Clean
43+
workingDirectory: '$(Build.SourcesDirectory)'
44+
45+
- task: powershell@2
46+
displayName: 'Install test certificate for MSIX test packages (DevCheck)'
47+
inputs:
48+
targetType: filePath
49+
filePath: eng\common\DevCheck.ps1
50+
arguments: -NoInteractive -Offline -Verbose -CheckTestCert
51+
workingDirectory: '$(Build.SourcesDirectory)'
52+
53+
# Copy license files into the InstallerInput directory. License files should be named consistently with the
54+
# package naming used in the installer. See build\Scripts\ExtractMSIXFromNuget.ps1 for specifics.
55+
# e.g.
56+
# main_license.xml, singleton_license.xml, etc.
57+
- task: CopyFiles@2
58+
displayName: 'Copy licenses to target folder'
59+
inputs:
60+
SourceFolder: '$(Build.SourcesDirectory)\build\packages\$(AppLicensingInternalPackageName).$(AppLicensingInternalPackageVersion)\licenses'
61+
Contents: |
62+
*.xml
63+
TargetFolder: '$(Build.SourcesDirectory)\InstallerInput'
64+
flattenFolders: false
65+
66+
# Copy license installation header into the correct installer source location.
67+
- task: CopyFiles@2
68+
displayName: 'Extract files needed for Nuget package'
69+
inputs:
70+
SourceFolder: '$(Build.SourcesDirectory)\build\packages\$(AppLicensingInternalPackageName).$(AppLicensingInternalPackageVersion)\src'
71+
Contents: |
72+
*.h
73+
TargetFolder: '$(Build.SourcesDirectory)\installer\dev'
74+
flattenFolders: false
75+
overWrite: true
76+
77+
###
78+
# Copy MSIX packages from build artifacts into the installer content location and create
79+
# header to include contents into package.
80+
81+
- task: PowerShell@2
82+
displayName: ExtractMSIXPackagesFromNuget
83+
inputs:
84+
filePath: '$(Build.SourcesDirectory)\build\scripts\ExtractMSIXFromNuget.ps1'
85+
arguments: >
86+
-Source '$(System.ArtifactsDirectory)'
87+
-Dest '$(Build.SourcesDirectory)\InstallerInput'
88+
89+
- task: PowerShell@2
90+
displayName: CreateInstallerOverrideHeader
91+
inputs:
92+
filePath: '$(Build.SourcesDirectory)\build\Scripts\CreateInstallerOverrideHeader.ps1'
93+
arguments: >
94+
-SourceFolder '$(Build.SourcesDirectory)\InstallerInput'
95+
-DestinationFolder '$(Build.SourcesDirectory)\InstallerInput'
96+
97+
# NuGetCommand@2
98+
- task: 333b11bd-d341-40d9-afcf-b32d5ce6f23b@2
99+
displayName: 'Restore Windows App Runtime Install Nuget'
100+
inputs:
101+
command: 'restore'
102+
restoreSolution: installer\WindowsAppRuntimeInstall.sln
103+
feedsToUse: config
104+
nugetConfigPath: $(Build.SourcesDirectory)\nuget.config
105+
106+
- task: CopyFiles@2
107+
displayName: 'Copy installer override header'
108+
inputs:
109+
SourceFolder: '$(Build.SourcesDirectory)\InstallerInput'
110+
Contents: |
111+
windowsappruntime_definitions_override.h
112+
TargetFolder: installer\dev
113+
flattenFolders: false
114+
115+
- task: NuGetAuthenticate@1
116+
displayName: "NuGet authenticate to restore Microsoft.Telemetry.Inbox.Native"
117+
inputs:
118+
nuGetServiceConnections: "TelemetryInternal"
119+
120+
# NuGetCommand@2
121+
- task: 333b11bd-d341-40d9-afcf-b32d5ce6f23b@2
122+
displayName: "NuGet restore Microsoft.Telemetry.Inbox.Native package"
123+
inputs:
124+
command: "custom"
125+
arguments:
126+
'restore $(Build.SourcesDirectory)\installer\dev\telemetry\packages.config -ConfigFile $(Build.SourcesDirectory)\nuget.config -PackagesDirectory $(Build.SourcesDirectory)\packages'
127+
128+
# Overwrite wil\Traceloggingconfig.h content in public nuget with that of MicrosoftTelemetry.h from internal nuget
129+
# This step enables telemetry in the Installer
130+
- task: powershell@2
131+
name: OverwriteWILTraceLoggingWithMicrosoftInternalContent
132+
inputs:
133+
targetType: "inline"
134+
script: |
135+
$srcPath = Get-Childitem -Path '$(Build.SourcesDirectory)\packages\' -File 'MicrosoftTelemetry.h' -Recurse
136+
if ($srcPath -ne $null)
137+
{
138+
$destinationPaths = Get-Childitem -Path '$(Build.SourcesDirectory)\packages\' -File 'Traceloggingconfig.h' -Recurse
139+
if ($destinationPaths -ne $null)
140+
{
141+
foreach ($destPath in $destinationPaths)
142+
{
143+
Copy-Item -Force $srcPath.FullName $destPath.FullName
144+
}
145+
}
146+
else
147+
{
148+
Write-Host Did not find the destination wil/traceloggingconfig.h under $(Build.SourcesDirectory)\packages\
149+
Get-Childitem -Path '$(Build.SourcesDirectory)\packages\' -Recurse
150+
}
151+
}
152+
else
153+
{
154+
Write-Host Did not find the source MicrosoftTelemetry.h under $(Build.SourcesDirectory)\packages\
155+
Get-Childitem -Path '$(Build.SourcesDirectory)\packages\' -Recurse
156+
}
157+
158+
# Extract Microsoft.WindowsAppSDK Nuget package artifact published by BuildWindowsAppSDKPackages job of Aggregate stage,
159+
# that runs before the current CreateInstaller stage in the same build pipeline, to the installer's packages folder.
160+
# And copy WindowsAppSDK-VersionInfo.h from the extracted nuget package to installer's project folder
161+
- task: powershell@2
162+
name: ExtractWinAppSDKNugetPackage
163+
inputs:
164+
targetType: "inline"
165+
script: |
166+
$srcWinAppSDKNupkgPath = Get-Childitem -Path '$(System.ArtifactsDirectory)\NugetPackages' -File '*Microsoft.WindowsAppSDK*'
167+
Copy-Item -Force $srcWinAppSDKNupkgPath.FullName '$(Build.SourcesDirectory)\packages\'
168+
$destWinAppSDKNupkgPath = Get-Childitem -Path '$(Build.SourcesDirectory)\packages\' -File '*Microsoft.WindowsAppSDK*'
169+
$winAppSDKZip = $destWinAppSDKNupkgPath.FullName -replace '.nupkg','.zip'
170+
Rename-Item -Path $destWinAppSDKNupkgPath.FullName -NewName $winAppSDKZip
171+
Expand-Archive $winAppSDKZip -DestinationPath ($destWinAppSDKNupkgPath.Directory.FullName + '\' + $destWinAppSDKNupkgPath.BaseName)
172+
Copy-Item -Force ($destWinAppSDKNupkgPath.Directory.FullName + '\' + $destWinAppSDKNupkgPath.BaseName + "\include\WindowsAppSDK-VersionInfo.h") '$(Build.SourcesDirectory)\installer\dev\'
173+
174+
- task: WinUndockNativeCompiler@1
175+
displayName: 'Setup native compiler version override'
176+
inputs:
177+
microsoftDropReadPat: $(System.AccessToken)
178+
compilerPackageName: $(compilerOverridePackageName)
179+
compilerPackageVersion: $(compilerOverridePackageVersion)
180+
slnDirectory: $(Build.SourcesDirectory)\installer\dev
181+
182+
- task: VSBuild@1
183+
displayName: 'Build Windows App Runtime Install'
184+
inputs:
185+
solution: installer\dev\WindowsAppRuntimeInstall.vcxproj
186+
platform: '$(buildPlatform)'
187+
configuration: '$(buildConfiguration)'
188+
189+
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
190+
displayName: 'Component Governance Detection'
191+
inputs:
192+
scanType: 'Register'
193+
failOnAlert: true
194+
195+
- task: CopyFiles@2
196+
displayName: 'Publish Installer'
197+
inputs:
198+
SourceFolder: 'BuildOutput'
199+
TargetFolder: '$(ob_outputDirectory)\Installer'
200+
201+
- task: powershell@2
202+
displayName: 'Remove test certificate for MSIX test packages (DevCheck)'
203+
inputs:
204+
targetType: filePath
205+
filePath: eng\common\DevCheck.ps1
206+
arguments: -NoInteractive -Offline -Verbose -RemoveTestCert -RemoveTestPfx
207+
workingDirectory: '$(Build.SourcesDirectory)'
208+
209+
- task: PublishBuildArtifacts@1
210+
inputs:
211+
PathtoPublish: '$(ob_outputDirectory)'
212+
artifactName: '$(ob_artifactBaseName)'

build/ProjectReunion-BuildFoundation.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ variables:
1616
- template: ..\eng\common\AzurePipelinesTemplates\WindowsAppSDK-GlobalVariables.yml
1717

1818
stages:
19+
- template: AzurePipelinesTemplates\WindowsAppSDK-BuildInstaller-Stage.yml@self
20+
1921
- template: AzurePipelinesTemplates\WindowsAppSDK-Build-Stage.yml@self
2022
parameters:
2123
SignOutput: False
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
param
2+
(
3+
[String]$SourceFolder,
4+
[String]$DestinationFolder
5+
)
6+
7+
$overrideHeaderName = "windowsappruntime_definitions_override.h"
8+
9+
# Mapping of filenames to identifiers
10+
$packageMapping = @(
11+
[pscustomobject]@{
12+
Package='framework_x86.msix';
13+
Identifier='MSIX_FRAMEWORK_X86_PATH'
14+
}
15+
[pscustomobject]@{
16+
Package='framework_x64.msix';
17+
Identifier='MSIX_FRAMEWORK_X64_PATH'
18+
}
19+
[pscustomobject]@{
20+
Package='framework_arm64.msix';
21+
Identifier='MSIX_FRAMEWORK_ARM64_PATH'
22+
}
23+
[pscustomobject]@{
24+
Package='main_x86.msix';
25+
Identifier='MSIX_MAIN_X86_PATH'
26+
}
27+
[pscustomobject]@{
28+
Package='main_x64.msix';
29+
Identifier='MSIX_MAIN_X64_PATH'
30+
}
31+
[pscustomobject]@{
32+
Package='main_arm64.msix';
33+
Identifier='MSIX_MAIN_ARM64_PATH'
34+
}
35+
[pscustomobject]@{
36+
Package='main_license.xml';
37+
Identifier='MSIX_MAIN_LICENSE_PATH'
38+
}
39+
[pscustomobject]@{
40+
Package='singleton_x86.msix';
41+
Identifier='MSIX_SINGLETON_X86_PATH'
42+
}
43+
[pscustomobject]@{
44+
Package='singleton_x64.msix';
45+
Identifier='MSIX_SINGLETON_X64_PATH'
46+
}
47+
[pscustomobject]@{
48+
Package='singleton_arm64.msix';
49+
Identifier='MSIX_SINGLETON_ARM64_PATH'
50+
}
51+
[pscustomobject]@{
52+
Package='singleton_license.xml';
53+
Identifier='MSIX_SINGLETON_LICENSE_PATH'
54+
}
55+
[pscustomobject]@{
56+
Package='ddlm_x86.msix';
57+
Identifier='MSIX_DDLM_X86_PATH'
58+
}
59+
[pscustomobject]@{
60+
Package='ddlm_x64.msix';
61+
Identifier='MSIX_DDLM_X64_PATH'
62+
}
63+
[pscustomobject]@{
64+
Package='ddlm_arm64.msix';
65+
Identifier='MSIX_DDLM_ARM64_PATH'
66+
}
67+
)
68+
69+
70+
function Remove-ItemIfExists ($Item)
71+
{
72+
if (Test-Path $Item)
73+
{
74+
Write-Host("Removing " + $Item)
75+
Remove-Item $Item -Recurse -Force
76+
}
77+
}
78+
79+
function Add-Text ($Text)
80+
{
81+
Add-Content $Destination $Text
82+
}
83+
84+
function Add-RedefineIfExists
85+
{
86+
param(
87+
[pscustomobject]$Object
88+
)
89+
process {
90+
$Package = $Object.Package
91+
$Identifier = $Object.Identifier
92+
$Path = Join-Path $SourceFolder -ChildPath $Package
93+
if ((Test-Path $Path -PathType Leaf) -and $Identifier)
94+
{
95+
$FullPath = $Path | Resolve-Path
96+
$FullPath = $FullPath -replace '\\', '\\'
97+
Add-Text "#undef $Identifier"
98+
Add-Text "#define $Identifier `"$FullPath`"`n"
99+
Write-Host "Added override for $Identifier"
100+
}
101+
}
102+
}
103+
104+
$Destination = Join-Path $DestinationFolder -ChildPath $overrideHeaderName
105+
Write-Host("Destination File: " + $Destination)
106+
Remove-ItemIfExists ($Destination)
107+
New-Item $Destination | Out-Null
108+
109+
Add-Text "#pragma once`n"
110+
111+
# Iterate over known identifiers and add entries for all that exist in the source
112+
foreach($entry in $packageMapping)
113+
{
114+
Add-RedefineIfExists $entry
115+
}
116+
117+
$header = Get-Content $Destination
118+
Write-Host "$Destination content"
119+
$header

0 commit comments

Comments
 (0)