Setup Validation Stage for Installer in the Foundation PR build (#4516)
This commit is contained in:
Родитель
9e534580af
Коммит
e5367c82c2
|
@ -11,6 +11,7 @@ parameters:
|
|||
|
||||
stages:
|
||||
- stage: Build
|
||||
dependsOn: []
|
||||
jobs:
|
||||
- job: VerifyCopyrightHeaders
|
||||
dependsOn: []
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
# This Installer Stage is purely for validation
|
||||
# The actual installer is built with the Aggregator build
|
||||
stages:
|
||||
- stage: InstallerValidation
|
||||
jobs:
|
||||
- job: BuildInstaller
|
||||
dependsOn: []
|
||||
pool:
|
||||
type: windows
|
||||
isCustom: true
|
||||
name: 'ProjectReunionESPool-2022' # This stage is purely for validation
|
||||
strategy:
|
||||
maxParallel: 10
|
||||
matrix:
|
||||
Release_x86:
|
||||
buildPlatform: 'x86'
|
||||
buildConfiguration: 'Release'
|
||||
Release_x64:
|
||||
buildPlatform: 'x64'
|
||||
buildConfiguration: 'Release'
|
||||
Release_arm64:
|
||||
buildPlatform: 'arm64'
|
||||
buildConfiguration: 'Release'
|
||||
variables:
|
||||
ob_outputDirectory: '$(REPOROOT)\out'
|
||||
ob_artifactSuffix: '_$(buildConfiguration)_$(buildPlatform)'
|
||||
ob_artifactBaseName: "Installer$(ob_artifactSuffix)"
|
||||
steps:
|
||||
- template: WindowsAppSDK-BuildInstaller-Steps.yml@self
|
|
@ -0,0 +1,212 @@
|
|||
steps:
|
||||
###
|
||||
# This step downloads the WindowsAppSDK NuGet package from last successful build of the Aggregator's Nightly build
|
||||
# for use in building the installers
|
||||
- task: DownloadPipelineArtifact@2
|
||||
displayName: 'Download WindowsAppSDK'
|
||||
inputs:
|
||||
artifactName: 'WindowsAppSDK_Nuget_And_MSIX'
|
||||
targetPath: '$(System.ArtifactsDirectory)'
|
||||
source: 'specific'
|
||||
project: $(System.TeamProjectId)
|
||||
pipeline: 118002
|
||||
runVersion: 'latestFromBranch'
|
||||
runBranch: "refs/heads/main"
|
||||
|
||||
###
|
||||
# Install the internal licensing support for release-signed packages. This can always be present in
|
||||
# pipeline builds. The installer code will automatically degrade / skip licenses in non-release builds
|
||||
|
||||
# Future: this stage only requires a the app licensing internal package, but is downloading all transport packages
|
||||
# used for aggregation consider refactoring for efficiency.
|
||||
- task: PowerShell@2
|
||||
name: ConvertVersionDetailsToPackageConfig
|
||||
displayName: "Convert VersionDetails To PackageConfig"
|
||||
inputs:
|
||||
filePath: '$(Build.SourcesDirectory)\build\Scripts\ConvertVersionDetailsToPackageConfig.ps1'
|
||||
arguments: -versionDetailsPath '$(Build.SourcesDirectory)\eng\Version.Details.xml' -packageConfigPath '$(Build.SourcesDirectory)\build\packages.config'
|
||||
|
||||
- task: 333b11bd-d341-40d9-afcf-b32d5ce6f23b@2
|
||||
displayName: RestoreNuGetPackages
|
||||
inputs:
|
||||
restoreSolution: $(Build.SourcesDirectory)/build/packages.config
|
||||
feedsToUse: config
|
||||
nugetConfigPath: $(Build.SourcesDirectory)/nuget.config
|
||||
restoreDirectory: packages
|
||||
|
||||
- task: powershell@2
|
||||
displayName: 'Create test pfx to sign MSIX test packages (DevCheck)'
|
||||
inputs:
|
||||
targetType: filePath
|
||||
filePath: eng\common\DevCheck.ps1
|
||||
arguments: -NoInteractive -Offline -Verbose -CertPassword 'BuildPipeline' -CheckTestPfx -Clean
|
||||
workingDirectory: '$(Build.SourcesDirectory)'
|
||||
|
||||
- task: powershell@2
|
||||
displayName: 'Install test certificate for MSIX test packages (DevCheck)'
|
||||
inputs:
|
||||
targetType: filePath
|
||||
filePath: eng\common\DevCheck.ps1
|
||||
arguments: -NoInteractive -Offline -Verbose -CheckTestCert
|
||||
workingDirectory: '$(Build.SourcesDirectory)'
|
||||
|
||||
# Copy license files into the InstallerInput directory. License files should be named consistently with the
|
||||
# package naming used in the installer. See build\Scripts\ExtractMSIXFromNuget.ps1 for specifics.
|
||||
# e.g.
|
||||
# main_license.xml, singleton_license.xml, etc.
|
||||
- task: CopyFiles@2
|
||||
displayName: 'Copy licenses to target folder'
|
||||
inputs:
|
||||
SourceFolder: '$(Build.SourcesDirectory)\build\packages\$(AppLicensingInternalPackageName).$(AppLicensingInternalPackageVersion)\licenses'
|
||||
Contents: |
|
||||
*.xml
|
||||
TargetFolder: '$(Build.SourcesDirectory)\InstallerInput'
|
||||
flattenFolders: false
|
||||
|
||||
# Copy license installation header into the correct installer source location.
|
||||
- task: CopyFiles@2
|
||||
displayName: 'Extract files needed for Nuget package'
|
||||
inputs:
|
||||
SourceFolder: '$(Build.SourcesDirectory)\build\packages\$(AppLicensingInternalPackageName).$(AppLicensingInternalPackageVersion)\src'
|
||||
Contents: |
|
||||
*.h
|
||||
TargetFolder: '$(Build.SourcesDirectory)\installer\dev'
|
||||
flattenFolders: false
|
||||
overWrite: true
|
||||
|
||||
###
|
||||
# Copy MSIX packages from build artifacts into the installer content location and create
|
||||
# header to include contents into package.
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: ExtractMSIXPackagesFromNuget
|
||||
inputs:
|
||||
filePath: '$(Build.SourcesDirectory)\build\scripts\ExtractMSIXFromNuget.ps1'
|
||||
arguments: >
|
||||
-Source '$(System.ArtifactsDirectory)'
|
||||
-Dest '$(Build.SourcesDirectory)\InstallerInput'
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: CreateInstallerOverrideHeader
|
||||
inputs:
|
||||
filePath: '$(Build.SourcesDirectory)\build\Scripts\CreateInstallerOverrideHeader.ps1'
|
||||
arguments: >
|
||||
-SourceFolder '$(Build.SourcesDirectory)\InstallerInput'
|
||||
-DestinationFolder '$(Build.SourcesDirectory)\InstallerInput'
|
||||
|
||||
# NuGetCommand@2
|
||||
- task: 333b11bd-d341-40d9-afcf-b32d5ce6f23b@2
|
||||
displayName: 'Restore Windows App Runtime Install Nuget'
|
||||
inputs:
|
||||
command: 'restore'
|
||||
restoreSolution: installer\WindowsAppRuntimeInstall.sln
|
||||
feedsToUse: config
|
||||
nugetConfigPath: $(Build.SourcesDirectory)\nuget.config
|
||||
|
||||
- task: CopyFiles@2
|
||||
displayName: 'Copy installer override header'
|
||||
inputs:
|
||||
SourceFolder: '$(Build.SourcesDirectory)\InstallerInput'
|
||||
Contents: |
|
||||
windowsappruntime_definitions_override.h
|
||||
TargetFolder: installer\dev
|
||||
flattenFolders: false
|
||||
|
||||
- task: NuGetAuthenticate@1
|
||||
displayName: "NuGet authenticate to restore Microsoft.Telemetry.Inbox.Native"
|
||||
inputs:
|
||||
nuGetServiceConnections: "TelemetryInternal"
|
||||
|
||||
# NuGetCommand@2
|
||||
- task: 333b11bd-d341-40d9-afcf-b32d5ce6f23b@2
|
||||
displayName: "NuGet restore Microsoft.Telemetry.Inbox.Native package"
|
||||
inputs:
|
||||
command: "custom"
|
||||
arguments:
|
||||
'restore $(Build.SourcesDirectory)\installer\dev\telemetry\packages.config -ConfigFile $(Build.SourcesDirectory)\nuget.config -PackagesDirectory $(Build.SourcesDirectory)\packages'
|
||||
|
||||
# Overwrite wil\Traceloggingconfig.h content in public nuget with that of MicrosoftTelemetry.h from internal nuget
|
||||
# This step enables telemetry in the Installer
|
||||
- task: powershell@2
|
||||
name: OverwriteWILTraceLoggingWithMicrosoftInternalContent
|
||||
inputs:
|
||||
targetType: "inline"
|
||||
script: |
|
||||
$srcPath = Get-Childitem -Path '$(Build.SourcesDirectory)\packages\' -File 'MicrosoftTelemetry.h' -Recurse
|
||||
if ($srcPath -ne $null)
|
||||
{
|
||||
$destinationPaths = Get-Childitem -Path '$(Build.SourcesDirectory)\packages\' -File 'Traceloggingconfig.h' -Recurse
|
||||
if ($destinationPaths -ne $null)
|
||||
{
|
||||
foreach ($destPath in $destinationPaths)
|
||||
{
|
||||
Copy-Item -Force $srcPath.FullName $destPath.FullName
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Host Did not find the destination wil/traceloggingconfig.h under $(Build.SourcesDirectory)\packages\
|
||||
Get-Childitem -Path '$(Build.SourcesDirectory)\packages\' -Recurse
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Host Did not find the source MicrosoftTelemetry.h under $(Build.SourcesDirectory)\packages\
|
||||
Get-Childitem -Path '$(Build.SourcesDirectory)\packages\' -Recurse
|
||||
}
|
||||
|
||||
# Extract Microsoft.WindowsAppSDK Nuget package artifact published by BuildWindowsAppSDKPackages job of Aggregate stage,
|
||||
# that runs before the current CreateInstaller stage in the same build pipeline, to the installer's packages folder.
|
||||
# And copy WindowsAppSDK-VersionInfo.h from the extracted nuget package to installer's project folder
|
||||
- task: powershell@2
|
||||
name: ExtractWinAppSDKNugetPackage
|
||||
inputs:
|
||||
targetType: "inline"
|
||||
script: |
|
||||
$srcWinAppSDKNupkgPath = Get-Childitem -Path '$(System.ArtifactsDirectory)\NugetPackages' -File '*Microsoft.WindowsAppSDK*'
|
||||
Copy-Item -Force $srcWinAppSDKNupkgPath.FullName '$(Build.SourcesDirectory)\packages\'
|
||||
$destWinAppSDKNupkgPath = Get-Childitem -Path '$(Build.SourcesDirectory)\packages\' -File '*Microsoft.WindowsAppSDK*'
|
||||
$winAppSDKZip = $destWinAppSDKNupkgPath.FullName -replace '.nupkg','.zip'
|
||||
Rename-Item -Path $destWinAppSDKNupkgPath.FullName -NewName $winAppSDKZip
|
||||
Expand-Archive $winAppSDKZip -DestinationPath ($destWinAppSDKNupkgPath.Directory.FullName + '\' + $destWinAppSDKNupkgPath.BaseName)
|
||||
Copy-Item -Force ($destWinAppSDKNupkgPath.Directory.FullName + '\' + $destWinAppSDKNupkgPath.BaseName + "\include\WindowsAppSDK-VersionInfo.h") '$(Build.SourcesDirectory)\installer\dev\'
|
||||
|
||||
- task: WinUndockNativeCompiler@1
|
||||
displayName: 'Setup native compiler version override'
|
||||
inputs:
|
||||
microsoftDropReadPat: $(System.AccessToken)
|
||||
compilerPackageName: $(compilerOverridePackageName)
|
||||
compilerPackageVersion: $(compilerOverridePackageVersion)
|
||||
slnDirectory: $(Build.SourcesDirectory)\installer\dev
|
||||
|
||||
- task: VSBuild@1
|
||||
displayName: 'Build Windows App Runtime Install'
|
||||
inputs:
|
||||
solution: installer\dev\WindowsAppRuntimeInstall.vcxproj
|
||||
platform: '$(buildPlatform)'
|
||||
configuration: '$(buildConfiguration)'
|
||||
|
||||
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
|
||||
displayName: 'Component Governance Detection'
|
||||
inputs:
|
||||
scanType: 'Register'
|
||||
failOnAlert: true
|
||||
|
||||
- task: CopyFiles@2
|
||||
displayName: 'Publish Installer'
|
||||
inputs:
|
||||
SourceFolder: 'BuildOutput'
|
||||
TargetFolder: '$(ob_outputDirectory)\Installer'
|
||||
|
||||
- task: powershell@2
|
||||
displayName: 'Remove test certificate for MSIX test packages (DevCheck)'
|
||||
inputs:
|
||||
targetType: filePath
|
||||
filePath: eng\common\DevCheck.ps1
|
||||
arguments: -NoInteractive -Offline -Verbose -RemoveTestCert -RemoveTestPfx
|
||||
workingDirectory: '$(Build.SourcesDirectory)'
|
||||
|
||||
- task: PublishBuildArtifacts@1
|
||||
inputs:
|
||||
PathtoPublish: '$(ob_outputDirectory)'
|
||||
artifactName: '$(ob_artifactBaseName)'
|
|
@ -16,6 +16,8 @@ variables:
|
|||
- template: ..\eng\common\AzurePipelinesTemplates\WindowsAppSDK-GlobalVariables.yml
|
||||
|
||||
stages:
|
||||
- template: AzurePipelinesTemplates\WindowsAppSDK-BuildInstaller-Stage.yml@self
|
||||
|
||||
- template: AzurePipelinesTemplates\WindowsAppSDK-Build-Stage.yml@self
|
||||
parameters:
|
||||
SignOutput: False
|
||||
|
|
|
@ -0,0 +1,119 @@
|
|||
param
|
||||
(
|
||||
[String]$SourceFolder,
|
||||
[String]$DestinationFolder
|
||||
)
|
||||
|
||||
$overrideHeaderName = "windowsappruntime_definitions_override.h"
|
||||
|
||||
# Mapping of filenames to identifiers
|
||||
$packageMapping = @(
|
||||
[pscustomobject]@{
|
||||
Package='framework_x86.msix';
|
||||
Identifier='MSIX_FRAMEWORK_X86_PATH'
|
||||
}
|
||||
[pscustomobject]@{
|
||||
Package='framework_x64.msix';
|
||||
Identifier='MSIX_FRAMEWORK_X64_PATH'
|
||||
}
|
||||
[pscustomobject]@{
|
||||
Package='framework_arm64.msix';
|
||||
Identifier='MSIX_FRAMEWORK_ARM64_PATH'
|
||||
}
|
||||
[pscustomobject]@{
|
||||
Package='main_x86.msix';
|
||||
Identifier='MSIX_MAIN_X86_PATH'
|
||||
}
|
||||
[pscustomobject]@{
|
||||
Package='main_x64.msix';
|
||||
Identifier='MSIX_MAIN_X64_PATH'
|
||||
}
|
||||
[pscustomobject]@{
|
||||
Package='main_arm64.msix';
|
||||
Identifier='MSIX_MAIN_ARM64_PATH'
|
||||
}
|
||||
[pscustomobject]@{
|
||||
Package='main_license.xml';
|
||||
Identifier='MSIX_MAIN_LICENSE_PATH'
|
||||
}
|
||||
[pscustomobject]@{
|
||||
Package='singleton_x86.msix';
|
||||
Identifier='MSIX_SINGLETON_X86_PATH'
|
||||
}
|
||||
[pscustomobject]@{
|
||||
Package='singleton_x64.msix';
|
||||
Identifier='MSIX_SINGLETON_X64_PATH'
|
||||
}
|
||||
[pscustomobject]@{
|
||||
Package='singleton_arm64.msix';
|
||||
Identifier='MSIX_SINGLETON_ARM64_PATH'
|
||||
}
|
||||
[pscustomobject]@{
|
||||
Package='singleton_license.xml';
|
||||
Identifier='MSIX_SINGLETON_LICENSE_PATH'
|
||||
}
|
||||
[pscustomobject]@{
|
||||
Package='ddlm_x86.msix';
|
||||
Identifier='MSIX_DDLM_X86_PATH'
|
||||
}
|
||||
[pscustomobject]@{
|
||||
Package='ddlm_x64.msix';
|
||||
Identifier='MSIX_DDLM_X64_PATH'
|
||||
}
|
||||
[pscustomobject]@{
|
||||
Package='ddlm_arm64.msix';
|
||||
Identifier='MSIX_DDLM_ARM64_PATH'
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
function Remove-ItemIfExists ($Item)
|
||||
{
|
||||
if (Test-Path $Item)
|
||||
{
|
||||
Write-Host("Removing " + $Item)
|
||||
Remove-Item $Item -Recurse -Force
|
||||
}
|
||||
}
|
||||
|
||||
function Add-Text ($Text)
|
||||
{
|
||||
Add-Content $Destination $Text
|
||||
}
|
||||
|
||||
function Add-RedefineIfExists
|
||||
{
|
||||
param(
|
||||
[pscustomobject]$Object
|
||||
)
|
||||
process {
|
||||
$Package = $Object.Package
|
||||
$Identifier = $Object.Identifier
|
||||
$Path = Join-Path $SourceFolder -ChildPath $Package
|
||||
if ((Test-Path $Path -PathType Leaf) -and $Identifier)
|
||||
{
|
||||
$FullPath = $Path | Resolve-Path
|
||||
$FullPath = $FullPath -replace '\\', '\\'
|
||||
Add-Text "#undef $Identifier"
|
||||
Add-Text "#define $Identifier `"$FullPath`"`n"
|
||||
Write-Host "Added override for $Identifier"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$Destination = Join-Path $DestinationFolder -ChildPath $overrideHeaderName
|
||||
Write-Host("Destination File: " + $Destination)
|
||||
Remove-ItemIfExists ($Destination)
|
||||
New-Item $Destination | Out-Null
|
||||
|
||||
Add-Text "#pragma once`n"
|
||||
|
||||
# Iterate over known identifiers and add entries for all that exist in the source
|
||||
foreach($entry in $packageMapping)
|
||||
{
|
||||
Add-RedefineIfExists $entry
|
||||
}
|
||||
|
||||
$header = Get-Content $Destination
|
||||
Write-Host "$Destination content"
|
||||
$header
|
|
@ -0,0 +1,103 @@
|
|||
# Extracts MSIX packages from any .nupkg found in the Source directory to the Dest directory.
|
||||
# Looks specifically for certain named MSIX packages and renames them for consistently finding them as installer inputs.
|
||||
|
||||
param
|
||||
(
|
||||
[String]$Source,
|
||||
[String]$Dest
|
||||
)
|
||||
|
||||
function Remove-ItemIfExists ($Item)
|
||||
{
|
||||
if (Test-Path $Item)
|
||||
{
|
||||
Write-Host("Removing: " + $Item)
|
||||
Remove-Item $Item -Recurse -Force
|
||||
}
|
||||
}
|
||||
|
||||
# Temp locations required
|
||||
$tempExtractDirectory = 'temparchiveextract'
|
||||
$tempArchive = 'temparchive.zip'
|
||||
function Remove-TempArtifacts()
|
||||
{
|
||||
Remove-ItemIfExists($tempExtractDirectory)
|
||||
Remove-ItemIfExists($tempArchive)
|
||||
}
|
||||
|
||||
# Create Destination if not already existing.
|
||||
if (!(Test-Path $Dest -PathType Container))
|
||||
{
|
||||
New-Item -Path $Dest -ItemType Directory | Out-Null
|
||||
}
|
||||
|
||||
function Extract-MSIXFromNuget ($NugetPath)
|
||||
{
|
||||
Write-Host "Extracting packages from $NugetPath"
|
||||
Remove-TempArtifacts
|
||||
|
||||
# Expand-Archive only works on files with a .zip extension, regardless of whether it is a zip archive.
|
||||
Copy-Item -Path $NugetPath -Destination $tempArchive
|
||||
Expand-Archive -Path $tempArchive -DestinationPath $tempExtractDirectory -Force
|
||||
|
||||
# Process the archive and extract out and rename relevant files.
|
||||
foreach ($filename in Get-ChildItem -Name $tempExtractDirectory -Recurse)
|
||||
{
|
||||
Write-Host $filename
|
||||
# For each item, see if we want to extract this item to a different filename.
|
||||
$DestFilename = $false
|
||||
|
||||
# Basic MSIX filename pattern:
|
||||
#
|
||||
# NamePrefix.Release[-VersionTag].msix
|
||||
#
|
||||
# where
|
||||
# * NamePrefix = Microsoft.WindowsAppRuntime[.subname] (e.g. Microsoft.WindowsAppRuntime or Microsoft.WindowsAppRuntime.Main)
|
||||
# * Release = Major.Minor release (e.g. 1.0)
|
||||
# * VersionTag = Channel# (e.g. Experimental1 or Preview2)
|
||||
# * .msix = MSIX packages are always named *.msix
|
||||
|
||||
# Find the base Frameworks
|
||||
if ($filename -match '^.*(x86|x64|arm64)\\Microsoft\.WindowsAppRuntime[-.](\d+\.\d+)(-[a-z]+[0-9]*)?(\.appx|\.msix)$')
|
||||
{
|
||||
$DestFilename = 'framework_' + $Matches[1] + '.msix'
|
||||
}
|
||||
|
||||
# Find Main
|
||||
if ($filename -match '^.*(x86|x64|arm64)\\Microsoft\.WindowsAppRuntime\.Main([-.](\d+\.\d+))?(-[a-z]+[0-9]*)?(\.appx|\.msix)$')
|
||||
{
|
||||
$DestFilename = 'main_' + $Matches[1] + '.msix'
|
||||
}
|
||||
|
||||
# Find Singleton
|
||||
if ($filename -match '^.*(x86|x64|arm64)\\Microsoft\.WindowsAppRuntime\.Singleton([-.](\d+\.\d+))(-[a-z]+[0-9]*)?(\.appx|\.msix)$')
|
||||
{
|
||||
$DestFilename = 'singleton_' + $Matches[1] + '.msix'
|
||||
}
|
||||
|
||||
# Find DDLM
|
||||
if ($filename -match '^.*(x86|x64|arm64)\\Microsoft\.WindowsAppRuntime\.DDLM([-.](\d+\.\d+))?(-[a-z]+[0-9]*)?(\.appx|\.msix)$')
|
||||
{
|
||||
$DestFilename = 'ddlm_' + $Matches[1] + '.msix'
|
||||
}
|
||||
|
||||
# If this item has a new destination name then do the extract and rename.
|
||||
if ($DestFilename)
|
||||
{
|
||||
$Destination = Join-Path $Dest -ChildPath $DestFilename
|
||||
$SourceFile = Join-Path $tempExtractDirectory -ChildPath $filename
|
||||
Copy-Item -Path $SourceFile -Destination $Destination -Force
|
||||
Write-Host "Extracted file to:" $Destination
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach($item in Get-ChildItem $Source -Recurse | Select FullName)
|
||||
{
|
||||
if ($item.FullName -match '.*(\.nupkg)$')
|
||||
{
|
||||
Extract-MSIXFromNuget ($item.FullName)
|
||||
}
|
||||
}
|
||||
|
||||
Remove-TempArtifacts
|
Загрузка…
Ссылка в новой задаче