Merged PR 19015: Pull changes for nightly branch into master

- Fix the versioning so that the ADO pipeline counter increments based on the current Win2D version read from the VERSION file.
 - Allow the WinAppSDK version to be set by the pipeline and override the version set by WinAppSDK-version.props
 - Create the nightly yml file
 - Include a script to automatically updated packages.config versions (used only by the nightly pipeline)
This commit is contained in:
Geoffrey Trousdale 2022-02-09 18:30:51 +00:00
Родитель bfafcac420
Коммит 736f760692
16 изменённых файлов: 271 добавлений и 36 удалений

Просмотреть файл

@ -0,0 +1,21 @@
# Writes the WinAppSDK version assigned to the environment variable winappsdk_version to all the nuget.config files
# Used to programatically update the nuget.config files when building nightly versions of Win2D
Write-Host "Updating packages.config files with new WinAppSDK version"
$fileList = 'winrt\lib\packages.config','winrt\dll\packages.config','winrt\test.external\packages.config','winrt\test.internal\packages.config','build\pkges\packages.config'
foreach ( $configFile in $fileList )
{
$configPath = "$env:Build_SourcesDirectory\$configFile"
$configXml = [xml](Get-Content $configPath)
$configXml.packages.package | Where-Object id -eq 'Microsoft.WindowsAppSDK' | ForEach-Object {
$_.SetAttribute("version", $env:winappsdk_version);
Write-Host "Setting the WinAppSDK version for $configfile to $env:winappsdk_version"
}
$configXml.Save($configPath)
}
Write-Host "Done."

Просмотреть файл

@ -56,6 +56,19 @@ steps:
filename: cmd
arguments: '/c if exist build\pkges\PoliCheckExclusions.txt exit 1'
# Update the build number
- script: |
echo "WinAppSDK version override (optional): $(winappsdk_version)"
if "$(winappsdk_version)"=="" (
echo "WinAppSDK version override not set, defaulting to version in build\WindowsAppSdk.common.props"
)
echo "Win2D Package Version: $(version)"
echo ##vso[build.updatebuildnumber]$(version)
displayName: Update Build Number
# Use .NET Core SDK
- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
@ -78,18 +91,21 @@ steps:
.$env:Build_SourcesDirectory\build\nuget\download-nuget.cmd
- task: PowerShell@1
displayName: 'Nuget Restore'
env:
REUNION_FEED: $(REUNION_FEED)
inputs:
scriptType: inlineScript
inlineScript: |
$env:_MSBDIR="C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\"
.$env:Build_SourcesDirectory\build\Enter-VSShell.ps1 -vsPath $env:_MSBDIR
$env:PATH="$env:Build_SourcesDirectory\build\nuget;$env:PATH"
.$env:Build_SourcesDirectory\build\nuget\nuget.exe restore ($env:Build_SourcesDirectory + "\build\pkges\packages.config") -PackagesDirectory ($env:Build_SourcesDirectory + "\packages")
.$env:Build_SourcesDirectory\build\nuget\nuget.exe restore ($env:Build_SourcesDirectory + "\build\pkges\packages.config") -PackagesDirectory ($env:Build_SourcesDirectory + "\packages") -configFile ($env:Build_SourcesDirectory + "\nuget.config") -NonInteractive
$env:Platform="AnyCPU"
$env:Configuration="Release"
.$env:Build_SourcesDirectory\build\nuget\nuget.exe restore .\Microsoft.Graphics.Win2D.sln
.$env:Build_SourcesDirectory\build\nuget\nuget.exe restore .\Microsoft.Graphics.Win2D.sln -PackagesDirectory ($env:Build_SourcesDirectory + "\packages") -configFile ($env:Build_SourcesDirectory + "\nuget.config") -NonInteractive
rm env:Configuration
rm env:Platform
- task: PowerShell@1
displayName: 'Build Product'
inputs:

Просмотреть файл

@ -0,0 +1,21 @@
steps:
# Find WinAppSDK version
- task: powershell@2
name: winappsdkVersionTask
inputs:
targetType: inline
# Reads the WinAppSDK Version from eng\Version.Details.xml
# Used to read the nightly WinAppSDK version for building nightly versions of Win2D
script: |
$file = "eng\Version.Details.xml"
$xmlfile = [xml](Get-Content $file)
Write-Host "Found Version.Details.xml file."
$xmlfile.Dependencies.ProductDependencies.Dependency | Where-Object Name -eq 'Microsoft.WindowsAppSDK' | ForEach-Object {
$WIN_APP_SDK_VERSION = $_.Version
Write-Host "The WinAppSDK Version is $WIN_APP_SDK_VERSION"
Write-Host "##vso[task.setvariable variable=winappsdk_version]$WIN_APP_SDK_VERSION"
Write-Host "##vso[task.setvariable variable=winappsdk_version;isOutput=true]$WIN_APP_SDK_VERSION"
}
Write-Host "Done."
displayName: 'Find WindowsAppSDK Version for Nightly Build'

Просмотреть файл

@ -17,16 +17,18 @@ steps:
displayName: 'NuGet Authenticate'
- task: PowerShell@1
displayName: 'Nuget Restore'
env:
REUNION_FEED: $(REUNION_FEED)
inputs:
scriptType: inlineScript
inlineScript: |
$env:_MSBDIR="C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\"
.$env:Build_SourcesDirectory\build\Enter-VSShell.ps1 -vsPath $env:_MSBDIR
$env:PATH="$env:Build_SourcesDirectory\build\nuget;$env:PATH"
.$env:Build_SourcesDirectory\build\nuget\nuget.exe restore ($env:Build_SourcesDirectory + "\build\pkges\packages.config") -PackagesDirectory ($env:Build_SourcesDirectory + "\packages")
.$env:Build_SourcesDirectory\build\nuget\nuget.exe restore ($env:Build_SourcesDirectory + "\build\pkges\packages.config") -PackagesDirectory ($env:Build_SourcesDirectory + "\packages") -configFile ($env:Build_SourcesDirectory + "\nuget.config") -NonInteractive
$env:Platform="AnyCPU"
$env:Configuration="Debug"
.$env:Build_SourcesDirectory\build\nuget\nuget.exe restore .\Microsoft.Graphics.Win2D.sln
$env:Configuration="Release"
.$env:Build_SourcesDirectory\build\nuget\nuget.exe restore .\Microsoft.Graphics.Win2D.sln -PackagesDirectory ($env:Build_SourcesDirectory + "\packages") -configFile ($env:Build_SourcesDirectory + "\nuget.config") -NonInteractive
rm env:Configuration
rm env:Platform
- task: PowerShell@1

Просмотреть файл

@ -0,0 +1,30 @@
steps:
- task: powershell@2
name: win2dVersionTask
inputs:
targetType: inline
# Version numbers look like this:
# Nightly - Microsoft.Graphics.Win2D.1.0.0-Nightly-WinAppSDK.1.0.0-20211122.1-CI-stable.0
# CI - Microsoft.Graphics.Win2D.1.0.0-CI.257
# Release - Microsoft.Graphics.Win2D.1.0.0.0
script: |
Write-Host "Setting versions for Nightly/CI/Release pipelines"
Write-Host "Reading from VERSION file"
$versionMMP = Get-Content build\nuget\VERSION
$versionNightly = $versionMMP + '-Nightly-WinAppSDK-' + $env:winappsdk_version
Write-Host "##vso[task.setvariable variable=versionNightly;isOutput=true]$versionNightly"
$versionCI = $versionMMP + '-CI'
Write-Host "##vso[task.setvariable variable=versionCI;isOutput=true]$versionCI"
$versionRelease = $versionMMP
Write-Host "##vso[task.setvariable variable=versionRelease;isOutput=true]$versionRelease"
Write-Host "Set Nightly version to $versionNightly"
Write-Host "Set CI version to $versionCI"
Write-Host "Set Release version to $versionRelease"
Write-Host Done.
displayName: Set Win2D Version number and Pipeline number

Просмотреть файл

@ -1,20 +1,40 @@
trigger:
- reunion_master
name: $[format('{0:yyyyMMdd}.{1}', pipeline.startTime, 'CI')]
variables:
version: $[format('{0}-CI', counter(0,0))]
- name: date
value: $[format('{0:yyMMdd}', pipeline.startTime)]
name: $[format('{0}.{1}.CI', variables['date'], counter(variables['date']))]
jobs:
- job: BuildProduct
# Set Version for Win2D
- job: Win2DVersioning
pool:
vmImage: 'windows-2019'
variables:
# Codesigning not needed for this job
- name: runCodesignValidationInjection
value: false
steps:
- template: AzurePipelinesTemplates\Win2D-VersionNumber.yml
# Build Win2D
- job: BuildProduct
dependsOn: 'Win2DVersioning'
pool:
vmImage: 'windows-2019'
variables:
- name: version
value: $[format('{0}.{1}', dependencies.Win2DVersioning.outputs['win2dVersionTask.versionCI'], counter(dependencies.Win2DVersioning.outputs['win2dVersionTask.versionCI']))]
steps:
- template: AzurePipelinesTemplates\Win2D-Build-Steps.yml
parameters:
isRelease: false
- job: TestProduct
# Run tests
- job: TestProduct
dependsOn: 'Win2DVersioning'
pool:
name: 'Hosted Windows 2019 with VS2019'
steps:

57
build/Win2D-Nightly.yml Normal file
Просмотреть файл

@ -0,0 +1,57 @@
trigger:
- user/getrou/nightly
pool:
vmImage: 'windows-2019'
variables:
- name: date
value: $[format('{0:yyMMdd}', pipeline.startTime)]
name: $[format('{0}.{1}.Nightly', variables['date'], counter(variables['date']))]
jobs:
# Set Version for Win2D
- job: Win2DVersioning
pool:
vmImage: 'windows-2019'
variables:
# Codesigning not needed for this job
- name: runCodesignValidationInjection
value: false
steps:
- template: AzurePipelinesTemplates\Win2D-Find-WinAppSDK-Version.yml
- template: AzurePipelinesTemplates\Win2D-VersionNumber.yml
# Build Win2D
- job: BuildProduct
dependsOn: 'Win2DVersioning'
pool:
vmImage: 'windows-2019'
variables:
- name: version
value: $[format('{0}.{1}', dependencies.Win2DVersioning.outputs['win2dVersionTask.versionNightly'], counter(dependencies.Win2DVersioning.outputs['win2dVersionTask.versionNightly']))]
- name: winappsdk_version
value: $[dependencies.Win2DVersioning.outputs['winappsdkVersionTask.winappsdk_version']]
steps:
# Update package.config files with Nightly WinAppSDK version
- task: powershell@2
inputs:
targetType: filePath
filePath: build\Apply-WinAppSDK-Version-To-Configs.ps1
displayName: 'Apply Nightly WinAppSDK version to packages.config files'
# Build Win2D
- template: AzurePipelinesTemplates\Win2D-Build-Steps.yml
parameters:
isRelease: false
# Run tests
- job: TestProduct
dependsOn: 'Win2DVersioning'
pool:
name: 'Hosted Windows 2019 with VS2019'
variables:
- name: winappsdk_version
value: $[dependencies.Win2DVersioning.outputs['winappsdkVersionTask.winappsdk_version']]
steps:
- template: AzurePipelinesTemplates\Win2D-Test-Steps.yml

Просмотреть файл

@ -1,12 +1,33 @@
name: $[format('{0:yyyyMMdd}.{1}', pipeline.startTime, 'Release')]
pool:
vmImage: 'windows-2019'
variables:
version: $[format('{0}', counter(0,0))]
- name: date
value: $[format('{0:yyMMdd}', pipeline.startTime)]
steps:
- template: AzurePipelinesTemplates\Win2D-Build-Steps.yml
name: $[format('{0}.{1}.Release', variables['date'], counter(variables['date']))]
jobs:
# Set Version for Win2D
- job: Win2DVersioning
pool:
vmImage: 'windows-2019'
variables:
# Codesigning not needed for this job
- name: runCodesignValidationInjection
value: false
steps:
- template: AzurePipelinesTemplates\Win2D-VersionNumber.yml
# Build Win2D
- job: BuildProduct
dependsOn: 'Win2DVersioning'
pool:
vmImage: 'windows-2019'
variables:
- name: version
value: $[format('{0}.{1}', dependencies.Win2DVersioning.outputs['win2dVersionTask.versionRelease'], counter(dependencies.Win2DVersioning.outputs['win2dVersionTask.versionRelease']))]
steps:
- template: AzurePipelinesTemplates\Win2D-Build-Steps.yml
parameters:
isRelease: true

Просмотреть файл

@ -2,8 +2,11 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- This value controls all of the projects consuming the WindowsAppSdk and centralizes it in one spot.
When updating the version, don't forget to update all of the package.config files as well. -->
<WindowsAppSdkVersion>1.0.0</WindowsAppSdkVersion>
When updating the version, don't forget to update all of the package.config files as well.
The AzureDevOps pipeline will override the version here by setting WINAPPSDK_VERSION in the nightly build.
That nightly version is read from \eng\Version.Details.xml -->
<WindowsAppSdkVersion Condition="'$(WINAPPSDK_VERSION)' == ''">1.0.0</WindowsAppSdkVersion>
<WindowsAppSdkVersion Condition="'$(WINAPPSDK_VERSION)' != ''">$(WINAPPSDK_VERSION)</WindowsAppSdkVersion>
<_PackagesPath>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\packages'))</_PackagesPath>
<_WindowsAppSdkPackageRoot>$(_PackagesPath)\Microsoft.WindowsAppSdk.$(WindowsAppSdkVersion)</_WindowsAppSdkPackageRoot>

Просмотреть файл

@ -44,7 +44,8 @@ IF "%1" == "signed" (
)
IF NOT "%1" == "" (
SET VERSION=%VERSION%.%1
ECHO Setting VERSION to '%1'
SET VERSION=%1
)
SET NUGET_ARGS=^

Просмотреть файл

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.WindowsAppSdk" version="1.0.0" targetFramework="native" />
</packages>

21
eng/Version.Details.xml Normal file
Просмотреть файл

@ -0,0 +1,21 @@
<?xml version="1.0"?>
<!--
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License. See LICENSE.txt in the project root for license information.
-->
<!-- This version is updated automatically by Maestro in the Nightly branch.
It is used by the Nightly pipeline, but it is NOT used by the CI pipeline,
the Release pipeline, or the local build.cmd script. Those builds use the version
defined in build\WindowsAppSdk.common.props -->
<Dependencies>
<ProductDependencies>
<Dependency Name="Microsoft.WindowsAppSDK" Version="1.0.0">
<Uri>https://dev.azure.com/microsoft/ProjectReunion/_git/ProjectReunionInternal</Uri>
<Sha>26a4f01996caf57be507bf8fc5bf5fe1292edec2</Sha>
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
</ToolsetDependencies>
</Dependencies>

16
eng/Versions.props Normal file
Просмотреть файл

@ -0,0 +1,16 @@
<?xml version="1.0"?>
<!--
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License. See LICENSE.txt in the project root for license information.
-->
<Dependencies>
<ProductDependencies>
<Dependency Name="Microsoft.WindowsAppSDK" Version="1.0.0">
<Uri>https://dev.azure.com/microsoft/WindowsAppSDK</Uri>
<Sha>400c67880dae14f57e388cf8eb364d60fe814eb6</Sha>
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
</ToolsetDependencies>
</Dependencies>

Просмотреть файл

@ -1,5 +1,5 @@
{
"sdk": {
"version": "5.0.203"
"version": "5.0.403"
}
}

Просмотреть файл

@ -3,5 +3,12 @@
<packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<!-- <add key="Project.Reunion.nuget.internal" value="https://pkgs.dev.azure.com/microsoft/ProjectReunion/_packaging/Project.Reunion.nuget.internal/nuget/v3/index.json" /> -->
</packageSources>
<!-- <packageSourceCredentials>
<Project.Reunion.nuget.internal>
<add key="Username" value="adouser" />
<add key="ClearTextPassword" value="%REUNION_FEED%" />
</Project.Reunion.nuget.internal>
</packageSourceCredentials> -->
</configuration>

Просмотреть файл

@ -57,8 +57,7 @@ namespace CheckCode
string[] xmlFooter =
{
"-->",
""
"-->"
};
return xmlHeader.Concat(copyrightBanner)