Merge in 'release/6.0.1xx' changes

This commit is contained in:
dotnet-bot 2023-03-02 15:13:25 +00:00
commit 4ec90d24d3
3 changed files with 70 additions and 904 deletions

View file

@ -5,6 +5,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Enumeration;
using System.Linq;
using System.Text.RegularExpressions;
using Xunit.Abstractions;
@ -27,16 +28,15 @@ public class SdkContentTests : SmokeTests
{
const string msftFileListingFileName = "msftSdkFiles.txt";
const string sbFileListingFileName = "sbSdkFiles.txt";
WriteTarballFileList(Config.MsftSdkTarballPath, msftFileListingFileName, isPortable: true);
WriteTarballFileList(Config.SdkTarballPath, sbFileListingFileName, isPortable: false);
WriteTarballFileList(Config.MsftSdkTarballPath, msftFileListingFileName, isPortable: true, "msft");
WriteTarballFileList(Config.SdkTarballPath, sbFileListingFileName, isPortable: false, "sb");
string diff = BaselineHelper.DiffFiles(msftFileListingFileName, sbFileListingFileName, OutputHelper);
diff = BaselineHelper.RemoveVersions(diff);
diff = RemoveDiffMarkers(diff);
BaselineHelper.CompareContents("MsftToSbSdk.diff", diff, OutputHelper, Config.WarnOnSdkContentDiffs);
}
private void WriteTarballFileList(string? tarballPath, string outputFileName, bool isPortable)
private void WriteTarballFileList(string? tarballPath, string outputFileName, bool isPortable, string sdkType)
{
if (!File.Exists(tarballPath))
{
@ -45,11 +45,34 @@ public class SdkContentTests : SmokeTests
string fileListing = ExecuteHelper.ExecuteProcessValidateExitCode("tar", $"tf {tarballPath}", OutputHelper);
fileListing = BaselineHelper.RemoveRids(fileListing, isPortable);
fileListing = BaselineHelper.RemoveVersions(fileListing);
IEnumerable<string> files = fileListing.Split(Environment.NewLine).OrderBy(path => path);
files = RemoveExclusions(
files,
GetExclusionFilters(
Path.Combine(BaselineHelper.GetAssetsDirectory(), "SdkDiffExclusions.txt"),
sdkType));
File.WriteAllLines(outputFileName, files);
}
private static IEnumerable<string> RemoveExclusions(IEnumerable<string> files, IEnumerable<string> exclusions) =>
files.Where(item => !exclusions.Any(p => FileSystemName.MatchesSimpleExpression(p, item)));
private static IEnumerable<string> GetExclusionFilters(string exclusionsFilePath, string sdkType)
{
int prefixSkip = sdkType.Length + 1;
return File.ReadAllLines(exclusionsFilePath)
.Where(line => line.StartsWith(sdkType + ",")) // process only specific sdk exclusions
.Select(line =>
{
// Ignore comments
var index = line.IndexOf('#');
return index >= 0 ? line[prefixSkip..index].TrimEnd() : line[prefixSkip..];
})
.ToList();
}
private static string RemoveDiffMarkers(string source)
{
Regex indexRegex = new("^index .*", RegexOptions.Multiline);

View file

@ -0,0 +1,33 @@
# This list is processed using FileSystemName.MatchesSimpleExpression
#
# Format
# {msft|sb},<path> [# comment]
# msft = Microsoft built SDK
# sb = source-built SDK
#
# Examples
# 'folder/*' matches 'folder/' and 'folder/abc'
# 'folder/?*' matches 'folder/abc' but not 'folder/'
#
# We do not want to filter-out folder entries, therefore, we should use: '?*' and not just '*'
msft,./sdk/x.y.z/Sdks/Microsoft.NET.Sdk.Publish/tools/net472/?* # Intentional - source-build includes SDK Publishing package that target latest .NET TFM
msft,./sdk/x.y.z/Sdks/Microsoft.NET.Sdk.WindowsDesktop/?* # Intentional - explicitly excluded from source-build
# vstest localization is disabled in Linux builds - https://github.com/microsoft/vstest/issues/4305
msft,./sdk/x.y.z/*?/Microsoft.CodeCoverage.IO.resources.dll
msft,./sdk/x.y.z/*?/Microsoft.TestPlatform.*?.resources.dll
msft,./sdk/x.y.z/*?/Microsoft.VisualStudio.TestPlatform.*?.resources.dll
msft,./sdk/x.y.z/*?/Test.Utility.resources.dll
msft,./sdk/x.y.z/*?/vstest.console.resources.dll
msft,./sdk/x.y.z/Extensions/*?/Microsoft.TestPlatform.*?.resources.dll
msft,./sdk/x.y.z/Extensions/*?/Microsoft.VisualStudio.TestPlatform.*?.resources.dll
msft,./sdk/x.y.z/TestHost/*?/*?.resources.dll
# nuget localization is not available for Linux builds - https://github.com/NuGet/Home/issues/12440
msft,./sdk/x.y.z/*?/NuGet.*?.resources.dll
msft,./sdk/x.y.z/*?/Microsoft.Build.NuGetSdkResolver.resources.dll
# ILMerge is not supported in Linux builds - excluding the whole NuGet.Build.Tasks.Pack directory, to avoid a noisy diff
msft,./sdk/x.y.z/Sdks/NuGet.Build.Tasks.Pack/*?
sb,./sdk/x.y.z/Sdks/NuGet.Build.Tasks.Pack/*?