From 00ca4883f6e9538ab8c8999875bd49f60ed19251 Mon Sep 17 00:00:00 2001 From: Dustin Howett Date: Tue, 22 Feb 2022 12:30:30 -0600 Subject: [PATCH] Run the release pipeline twice, for Win10 and Win11, at the same time This required some changes in how we download artifacts to make sure that we could control which version of Windows we were processing in any individual step. We're also going to patch the package manifest on the Windows 11 version so the store targets it more specifically. On top of the prior three commits, this lets us ship a Windows 11 package that costs only ~15MB on disk. The Windows 10 version, for comparison, is about 40. --- build/pipelines/release.yml | 68 +++++++++++-------- .../Patch-ManifestsToWindowsVersion.ps1 | 14 ++++ custom.props | 12 ++++ 3 files changed, 65 insertions(+), 29 deletions(-) create mode 100644 build/scripts/Patch-ManifestsToWindowsVersion.ps1 diff --git a/build/pipelines/release.yml b/build/pipelines/release.yml index 00b2f666ea8..abe79847680 100644 --- a/build/pipelines/release.yml +++ b/build/pipelines/release.yml @@ -52,6 +52,11 @@ parameters: - x64 - x86 - arm64 + - name: buildWindowsVersions + type: object + default: + - Win10 + - Win11 variables: TerminalInternalPackageVersion: "0.0.7" @@ -68,9 +73,11 @@ jobs: matrix: ${{ each config in parameters.buildConfigurations }}: ${{ each platform in parameters.buildPlatforms }}: - ${{ config }}_${{ platform }}: - BuildConfiguration: ${{ config }} - BuildPlatform: ${{ platform }} + ${{ each windowsVersion in parameters.buildWindowsVersions }}: + ${{ config }}_${{ platform }}_${{ windowsVersion }}: + BuildConfiguration: ${{ config }} + BuildPlatform: ${{ platform }} + TerminalTargetWindowsVersion: ${{ windowsVersion }} displayName: Build timeoutInMinutes: 240 cancelTimeoutInMinutes: 1 @@ -167,6 +174,10 @@ jobs: arguments: -MarkdownNoticePath .\NOTICE.md -OutputPath .\src\cascadia\CascadiaPackage\NOTICE.html pwsh: true - ${{ if eq(parameters.buildTerminal, true) }}: + - pwsh: |- + ./build/scripts/Patch-ManifestsToWindowsVersion.ps1 -NewWindowsVersion "10.0.22000.0" + displayName: Update manifest target version to Win11 (if necessary) + condition: and(succeeded(), eq(variables['TerminalTargetWindowsVersion'], 'Win11')) - task: VSBuild@1 displayName: Build solution **\OpenConsole.sln condition: true @@ -184,7 +195,7 @@ jobs: continueOnError: True inputs: PathtoPublish: $(Build.SourcesDirectory)\msbuild.binlog - ArtifactName: binlog-$(BuildPlatform) + ArtifactName: binlog-$(BuildPlatform)-$(TerminalTargetWindowsVersion) - task: PowerShell@2 displayName: Check MSIX for common regressions inputs: @@ -247,7 +258,7 @@ jobs: displayName: Publish Artifact (appx) inputs: PathtoPublish: $(Build.ArtifactStagingDirectory)/appx - ArtifactName: appx-$(BuildPlatform)-$(BuildConfiguration) + ArtifactName: appx-$(BuildPlatform)-$(BuildConfiguration)-$(TerminalTargetWindowsVersion) - ${{ if eq(parameters.buildWPF, true) }}: - task: CopyFiles@2 displayName: Copy PublicTerminalCore.dll to Artifacts @@ -265,7 +276,7 @@ jobs: condition: and(succeeded(), ne(variables['BuildPlatform'], 'arm64')) inputs: PathtoPublish: $(Build.ArtifactStagingDirectory)/wpf - ArtifactName: wpf-dll-$(BuildPlatform)-$(BuildConfiguration) + ArtifactName: wpf-dll-$(BuildPlatform)-$(BuildConfiguration)-$(TerminalTargetWindowsVersion) - task: PublishSymbols@2 displayName: Publish symbols path @@ -283,6 +294,11 @@ jobs: - ${{ if eq(parameters.buildTerminal, true) }}: - job: BundleAndSign + strategy: + matrix: + ${{ each windowsVersion in parameters.buildWindowsVersions }}: + ${{ windowsVersion }}: + TerminalTargetWindowsVersion: ${{ windowsVersion }} displayName: Create and sign AppX/MSIX bundles dependsOn: Build steps: @@ -295,23 +311,16 @@ jobs: displayName: Package ES - Setup Build inputs: disableOutputRedirect: true - - task: DownloadBuildArtifacts@0 - displayName: Download Artifacts (*.appx, *.msix, *.appxsym) - inputs: - downloadType: specific - itemPattern: >- - **/*.msix - - **/*.appx - - **/*.appxsym - extractTars: false - + - ${{ each platform in parameters.buildPlatforms }}: + - task: DownloadBuildArtifacts@0 + displayName: Download Artifacts ${{ platform }} $(TerminalTargetWindowsVersion) + inputs: + artifactName: appx-${{ platform }}-Release-$(TerminalTargetWindowsVersion) - task: PowerShell@2 displayName: Create WindowsTerminal*.msixbundle inputs: filePath: build\scripts\Create-AppxBundle.ps1 - arguments: -InputPath "$(System.ArtifactsDirectory)" -ProjectName CascadiaPackage -BundleVersion 0.0.0.0 -OutputPath "$(System.ArtifactsDirectory)\Microsoft.WindowsTerminal_$(XES_APPXMANIFESTVERSION)_8wekyb3d8bbwe.msixbundle" + arguments: -InputPath "$(System.ArtifactsDirectory)" -ProjectName CascadiaPackage -BundleVersion 0.0.0.0 -OutputPath "$(System.ArtifactsDirectory)\Microsoft.WindowsTerminal_$(TerminalTargetWindowsVersion)_$(XES_APPXMANIFESTVERSION)_8wekyb3d8bbwe.msixbundle" - task: EsrpCodeSigning@1 displayName: Submit *.msixbundle to ESRP for code signing inputs: @@ -351,7 +360,7 @@ jobs: displayName: 'Publish Artifact: appxbundle-signed' inputs: PathtoPublish: $(System.ArtifactsDirectory) - ArtifactName: appxbundle-signed + ArtifactName: appxbundle-signed-$(TerminalTargetWindowsVersion) - ${{ if eq(parameters.buildWPF, true) }}: - job: PackageAndSignWPF @@ -375,14 +384,14 @@ jobs: - task: DownloadBuildArtifacts@0 displayName: Download x86 PublicTerminalCore inputs: - artifactName: wpf-dll-x86-$(BuildConfiguration) + artifactName: wpf-dll-x86-$(BuildConfiguration)-Win10 itemPattern: '**/*.dll' downloadPath: bin\Win32\$(BuildConfiguration)\ extractTars: false - task: DownloadBuildArtifacts@0 displayName: Download x64 PublicTerminalCore inputs: - artifactName: wpf-dll-x64-$(BuildConfiguration) + artifactName: wpf-dll-x64-$(BuildConfiguration)-Win10 itemPattern: '**/*.dll' downloadPath: bin\x64\$(BuildConfiguration)\ extractTars: false @@ -476,12 +485,13 @@ jobs: - task: PkgESSetupBuild@12 displayName: Package ES - Setup Build - # Download the appx-PLATFORM-CONFIG artifact for every platform combo + # Download the appx-PLATFORM-CONFIG-VERSION artifact for every platform/version combo - ${{ each platform in parameters.buildPlatforms }}: - - task: DownloadBuildArtifacts@0 - displayName: Download Symbols ${{ platform }} - inputs: - artifactName: appx-${{ platform }}-Release + - ${{ each windowsVersion in parameters.buildWindowsVersions }}: + - task: DownloadBuildArtifacts@0 + displayName: Download Symbols ${{ platform }} ${{ windowsVersion }} + inputs: + artifactName: appx-${{ platform }}-Release-${{ windowsVersion }} # It seems easier to do this -- download every appxsym -- then enumerate all the PDBs in the build directory for the # public symbol push. Otherwise, we would have to list all of the PDB files one by one. @@ -542,7 +552,7 @@ jobs: - task: DownloadBuildArtifacts@0 displayName: Download Build Artifacts inputs: - artifactName: appxbundle-signed + artifactName: appxbundle-signed-Win11 extractTars: false - task: PowerShell@2 displayName: Rename and stage packages for vpack @@ -551,7 +561,7 @@ jobs: script: >- # Rename to known/fixed name for Windows build system - Get-ChildItem Microsoft.WindowsTerminal_*.msixbundle | Rename-Item -NewName { 'Microsoft.WindowsTerminal_8wekyb3d8bbwe.msixbundle' } + Get-ChildItem Microsoft.WindowsTerminal_Win11_*.msixbundle | Rename-Item -NewName { 'Microsoft.WindowsTerminal_8wekyb3d8bbwe.msixbundle' } # Create vpack directory and place item inside diff --git a/build/scripts/Patch-ManifestsToWindowsVersion.ps1 b/build/scripts/Patch-ManifestsToWindowsVersion.ps1 new file mode 100644 index 00000000000..fe86f24fd8c --- /dev/null +++ b/build/scripts/Patch-ManifestsToWindowsVersion.ps1 @@ -0,0 +1,14 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT license. + +Param( + [string]$NewWindowsVersion = "10.0.22000.0" +) + +Get-ChildItem src/cascadia/CascadiaPackage -Recurse -Filter *.appxmanifest | ForEach-Object { + $xml = [xml](Get-Content $_.FullName) + $xml.Package.Dependencies.TargetDeviceFamily | Where-Object Name -Like "Windows*" | ForEach-Object { + $_.MinVersion = $NewWindowsVersion + } + $xml.Save($_.FullName) +} diff --git a/custom.props b/custom.props index e82cc844cc2..aab0b65870b 100644 --- a/custom.props +++ b/custom.props @@ -2,6 +2,18 @@ + + $([MSBuild]::Add($(VersionBuildRevision), 1)) + true 2022 1