From d68cd0c14eb4784f5a26d6b14b8b1ed16f4a7200 Mon Sep 17 00:00:00 2001 From: Joel Verhagen Date: Wed, 16 Nov 2022 06:13:40 -0800 Subject: [PATCH] Update to latest client SDK to bring .NET 7 support onto the frameworks tab (#9312) * Add .NET 7 TFMs * Update to latest NuGet SDK and System.Data.SqlClient to resolve CG alerts I had to modify the TFM resolution code to resolve an Obsolete warning. Existing UT coverage is good and they all passed. Resolve https://github.com/NuGet/NuGetGallery/issues/9313 --- .../NuGet.Services.DatabaseMigration.csproj | 2 +- .../NuGet.Services.Entities.csproj | 14 ++++------ .../Frameworks/SupportedFrameworks.cs | 11 +++++++- .../NuGetGallery.Core.csproj | 2 +- .../Services/AssetFrameworkHelper.cs | 27 +++++++++++++------ .../NuGetGallery.Services.csproj | 2 +- src/NuGetGallery/Web.config | 10 ++++++- 7 files changed, 46 insertions(+), 22 deletions(-) diff --git a/src/NuGet.Services.DatabaseMigration/NuGet.Services.DatabaseMigration.csproj b/src/NuGet.Services.DatabaseMigration/NuGet.Services.DatabaseMigration.csproj index e45db0c788..0e7cae022d 100644 --- a/src/NuGet.Services.DatabaseMigration/NuGet.Services.DatabaseMigration.csproj +++ b/src/NuGet.Services.DatabaseMigration/NuGet.Services.DatabaseMigration.csproj @@ -74,7 +74,7 @@ all - 6.0.0 + 6.4.0 runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/NuGet.Services.Entities/NuGet.Services.Entities.csproj b/src/NuGet.Services.Entities/NuGet.Services.Entities.csproj index 137aaea0b4..c5478a4955 100644 --- a/src/NuGet.Services.Entities/NuGet.Services.Entities.csproj +++ b/src/NuGet.Services.Entities/NuGet.Services.Entities.csproj @@ -8,15 +8,11 @@ - - 6.4.0-preview3-19553-01 - - - 13.0.1 - - - 6.0.0 - + + + + + diff --git a/src/NuGetGallery.Core/Frameworks/SupportedFrameworks.cs b/src/NuGetGallery.Core/Frameworks/SupportedFrameworks.cs index 5d685f9c3b..4c40002035 100644 --- a/src/NuGetGallery.Core/Frameworks/SupportedFrameworks.cs +++ b/src/NuGetGallery.Core/Frameworks/SupportedFrameworks.cs @@ -33,6 +33,13 @@ public static class SupportedFrameworks public static readonly NuGetFramework Net60Tizen = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version6, "tizen", EmptyVersion); public static readonly NuGetFramework Net60TvOs = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version6, "tvos", EmptyVersion); public static readonly NuGetFramework Net60Windows = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version6, "windows", EmptyVersion); + public static readonly NuGetFramework Net70Android = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version7, "android", EmptyVersion); + public static readonly NuGetFramework Net70Ios = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version7, "ios", EmptyVersion); + public static readonly NuGetFramework Net70MacOs = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version7, "macos", EmptyVersion); + public static readonly NuGetFramework Net70MacCatalyst = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version7, "maccatalyst", EmptyVersion); + public static readonly NuGetFramework Net70Tizen = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version7, "tizen", EmptyVersion); + public static readonly NuGetFramework Net70TvOs = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version7, "tvos", EmptyVersion); + public static readonly NuGetFramework Net70Windows = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version7, "windows", EmptyVersion); public static readonly NuGetFramework NetCore = new NuGetFramework(FrameworkIdentifiers.NetCore, EmptyVersion); public static readonly NuGetFramework NetMf = new NuGetFramework(FrameworkIdentifiers.NetMicro, EmptyVersion); public static readonly NuGetFramework UAP = new NuGetFramework(FrameworkIdentifiers.UAP, EmptyVersion); @@ -51,7 +58,9 @@ static SupportedFrameworks() MonoAndroid, MonoMac, MonoTouch, Native, Net11, Net2, Net35, Net4, Net403, Net45, Net451, Net452, Net46, Net461, Net462, Net463, Net47, Net471, Net472, Net48, - Net50, Net50Windows, Net60, Net60Android, Net60Ios, Net60MacCatalyst, Net60MacOs, Net60TvOs, Net60Windows, + Net50, Net50Windows, + Net60, Net60Android, Net60Ios, Net60MacCatalyst, Net60MacOs, Net60TvOs, Net60Windows, + Net70, Net70Android, Net70Ios, Net70MacCatalyst, Net70MacOs, Net70TvOs, Net70Windows, NetCore, NetCore45, NetCore451, NetCoreApp10, NetCoreApp11, NetCoreApp20, NetCoreApp21, NetCoreApp22, NetCoreApp30, NetCoreApp31, NetMf, diff --git a/src/NuGetGallery.Core/NuGetGallery.Core.csproj b/src/NuGetGallery.Core/NuGetGallery.Core.csproj index 20d9209f3c..57187ffd97 100644 --- a/src/NuGetGallery.Core/NuGetGallery.Core.csproj +++ b/src/NuGetGallery.Core/NuGetGallery.Core.csproj @@ -47,7 +47,7 @@ 5.2.6 - 6.0.0 + 6.4.0 2.106.0 diff --git a/src/NuGetGallery.Core/Services/AssetFrameworkHelper.cs b/src/NuGetGallery.Core/Services/AssetFrameworkHelper.cs index a5e4358704..1d01a27a3d 100644 --- a/src/NuGetGallery.Core/Services/AssetFrameworkHelper.cs +++ b/src/NuGetGallery.Core/Services/AssetFrameworkHelper.cs @@ -39,12 +39,12 @@ public static IEnumerable GetAssetFrameworks(string packageId, I var conventions = new ManagedCodeConventions(runtimeGraph); // Let's test for tools packages first--they're a special case - var groups = Enumerable.Empty(); + var groups = new List(); if (packageTypes.Count == 1 && (packageTypes[0] == PackageType.DotnetTool || packageTypes[0] == PackageType.DotnetCliTool)) { // Only a package that is a tool package (and nothing else) will be matched against tools pattern set - groups = items.FindItemGroups(conventions.Patterns.ToolsAssemblies); + items.PopulateItemGroups(conventions.Patterns.ToolsAssemblies, groups); } else { @@ -67,14 +67,25 @@ public static IEnumerable GetAssetFrameworks(string packageId, I }; // We'll create a set of "groups" --these are content items which satisfy file pattern sets - var standardGroups = patterns - .SelectMany(p => items.FindItemGroups(p)); + foreach (var pattern in patterns) + { + items.PopulateItemGroups(pattern, groups); + } // Filter out MSBuild assets that don't match the package ID and append to groups we already have - var msbuildGroups = msbuildPatterns - .SelectMany(p => items.FindItemGroups(p)) - .Where(g => HasBuildItemsForPackageId(g.Items, packageId)); - groups = standardGroups.Concat(msbuildGroups); + var msbuildGroups = new List(); + foreach (var pattern in msbuildPatterns) + { + items.PopulateItemGroups(pattern, msbuildGroups); + } + + foreach (var group in msbuildGroups) + { + if (HasBuildItemsForPackageId(group.Items, packageId)) + { + groups.Add(group); + } + } } // Now that we have a collection of groups which have made it through the pattern set filter, let's transform them into TFMs diff --git a/src/NuGetGallery.Services/NuGetGallery.Services.csproj b/src/NuGetGallery.Services/NuGetGallery.Services.csproj index d32dc98cdd..4e8bcc1826 100644 --- a/src/NuGetGallery.Services/NuGetGallery.Services.csproj +++ b/src/NuGetGallery.Services/NuGetGallery.Services.csproj @@ -85,7 +85,7 @@ 4.2.2 - 6.0.0 + 6.4.0 2.106.0 diff --git a/src/NuGetGallery/Web.config b/src/NuGetGallery/Web.config index 99ad9340ca..c622639fb5 100644 --- a/src/NuGetGallery/Web.config +++ b/src/NuGetGallery/Web.config @@ -576,6 +576,14 @@ + + + + + + + + @@ -674,4 +682,4 @@ - \ No newline at end of file +