From 23ec1df53cd63d9d7d8bd37b5f586c6173dc7213 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Fri, 15 Dec 2023 11:51:50 +0100 Subject: [PATCH] Add missing runtimeconfig.json file for 8.0 (#4792) Co-authored-by: Marco Rossignoli --- eng/verify-nupkgs.ps1 | 52 +++++++++++++++++-- .../Microsoft.TestPlatform.CLI.nuspec | 1 + ...rosoft.TestPlatform.CLI.sourcebuild.nuspec | 1 + .../Microsoft.TestPlatform.nuspec | 1 + temp/testhost/testhost-8.0.runtimeconfig.json | 9 ++++ 5 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 temp/testhost/testhost-8.0.runtimeconfig.json diff --git a/eng/verify-nupkgs.ps1 b/eng/verify-nupkgs.ps1 index be44eeefb7..46e785b8c8 100644 --- a/eng/verify-nupkgs.ps1 +++ b/eng/verify-nupkgs.ps1 @@ -5,7 +5,10 @@ Param( [string] $configuration, [Parameter(Mandatory)] - [string] $versionPrefix + [string] $versionPrefix, + + [Parameter(Mandatory)] + [string] $currentBranch ) $ErrorActionPreference = 'Stop' @@ -16,13 +19,13 @@ function Verify-Nuget-Packages { $expectedNumOfFiles = @{ "Microsoft.CodeCoverage" = 59; "Microsoft.NET.Test.Sdk" = 16; - "Microsoft.TestPlatform" = 607; + "Microsoft.TestPlatform" = 606; "Microsoft.TestPlatform.Build" = 21; - "Microsoft.TestPlatform.CLI" = 472; + "Microsoft.TestPlatform.CLI" = 471; "Microsoft.TestPlatform.Extensions.TrxLogger" = 35; "Microsoft.TestPlatform.ObjectModel" = 93; "Microsoft.TestPlatform.AdapterUtilities" = 34; - "Microsoft.TestPlatform.Portable" = 595; + "Microsoft.TestPlatform.Portable" = 592; "Microsoft.TestPlatform.TestHost" = 63; "Microsoft.TestPlatform.TranslationLayer" = 123; "Microsoft.TestPlatform.Internal.Uwp" = 39; @@ -89,6 +92,10 @@ function Verify-Nuget-Packages { if ($expectedNumOfFiles[$packageKey] -ne $actualNumOfFiles) { $errors += "Number of files are not equal for '$packageBaseName', expected: $($expectedNumOfFiles[$packageKey]) actual: $actualNumOfFiles" } + + if ($packageKey -eq "Microsoft.TestPlatform") { + Verify-Version -nugetDir $unzipNugetPackageDir -errors $errors + } } finally { if ($null -ne $unzipNugetPackageDir -and (Test-Path $unzipNugetPackageDir)) { @@ -112,4 +119,41 @@ function Unzip { [System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath) } +function Match-VersionAgainstBranch { + param ([string]$vsTestVersion, [string]$branchName, [string[]]$errors) + + # Output useful info. + Write-Host "VSTest Product Version: `"$vsTestVersion`"" + Write-Host "Current Branch: `"$branchName`"" + + $versionIsRTM = $vsTestVersion -match "^\d+\.\d+\.\d+$" + $versionIsRelease = $vsTestVersion -match "^\d+\.\d+\.\d+\-release\-\d{8}\-\d{2}$" + $versionIsPreview = $vsTestVersion -match "^\d+\.\d+\.\d+\-preview\-\d{8}\-\d{2}$" + + $isReleaseBranch = $branchName -like "rel/*" + $isPreviewBranch = $branchName -like "main" + + if (!$isReleaseBranch -and !$isPreviewBranch) { + Write-Host "Skipping check since branch is neither `"release`" nor `"preview`"" + return + } + + Write-Host "Matching branch against product version ... " + if ($isReleaseBranch -and !$versionIsRTM -and !$versionIsRelease) { + $errors += "Release version `"$vsTestVersion`" should either be RTM, or contain a `"release`" suffix." + } + if ($isPreviewBranch -and !$versionIsPreview) { + $errors += "Preview version `"$vsTestVersion`" should contain a `"preview`" suffix." + } +} + +function Verify-Version { + param ([string]$nugetDir, [string[]] $errors) + + $vsTestExe = "$nugetDir/tools/net462/Common7/IDE/Extensions/TestPlatform/vstest.console.exe" + $vsTestProductVersion = (Get-Item $vsTestExe).VersionInfo.ProductVersion + + Match-VersionAgainstBranch -vsTestVersion $vsTestProductVersion -branchName $currentBranch -errors $errors +} + Verify-Nuget-Packages diff --git a/src/package/Microsoft.TestPlatform.CLI/Microsoft.TestPlatform.CLI.nuspec b/src/package/Microsoft.TestPlatform.CLI/Microsoft.TestPlatform.CLI.nuspec index 05c7823f3d..5651e6cc85 100644 --- a/src/package/Microsoft.TestPlatform.CLI/Microsoft.TestPlatform.CLI.nuspec +++ b/src/package/Microsoft.TestPlatform.CLI/Microsoft.TestPlatform.CLI.nuspec @@ -45,6 +45,7 @@ + diff --git a/src/package/Microsoft.TestPlatform.CLI/Microsoft.TestPlatform.CLI.sourcebuild.nuspec b/src/package/Microsoft.TestPlatform.CLI/Microsoft.TestPlatform.CLI.sourcebuild.nuspec index 4de0d6f867..49335ccdcf 100644 --- a/src/package/Microsoft.TestPlatform.CLI/Microsoft.TestPlatform.CLI.sourcebuild.nuspec +++ b/src/package/Microsoft.TestPlatform.CLI/Microsoft.TestPlatform.CLI.sourcebuild.nuspec @@ -44,6 +44,7 @@ + diff --git a/src/package/Microsoft.TestPlatform/Microsoft.TestPlatform.nuspec b/src/package/Microsoft.TestPlatform/Microsoft.TestPlatform.nuspec index 43d19aef20..d95e2a9012 100644 --- a/src/package/Microsoft.TestPlatform/Microsoft.TestPlatform.nuspec +++ b/src/package/Microsoft.TestPlatform/Microsoft.TestPlatform.nuspec @@ -541,6 +541,7 @@ + diff --git a/temp/testhost/testhost-8.0.runtimeconfig.json b/temp/testhost/testhost-8.0.runtimeconfig.json new file mode 100644 index 0000000000..15af9f03a0 --- /dev/null +++ b/temp/testhost/testhost-8.0.runtimeconfig.json @@ -0,0 +1,9 @@ +{ + "runtimeOptions": { + "tfm": "net8.0", + "framework": { + "name": "Microsoft.NETCore.App", + "version": "8.0.0-preview.0" + } + } +}