From 31bd4d4b1d9b2dc8082a150547cd3e06837f7fc4 Mon Sep 17 00:00:00 2001 From: Doug Bunting <6431421+dougbu@users.noreply.github.com> Date: Fri, 28 Aug 2020 09:53:20 -0700 Subject: [PATCH] [release/5.0] Correct baseline checks (#25227) - mostly duplicates #25217 - update `BaselineGenerator` to produce baselines useful in 6.0 (too) - update Baseline.Designer.props using new generator (matching 3.1.7 release) - always suppress references expressed only in `*.nuspec` files - needed even in servicing builds - restore warning and errors about removed references (new for 5.0) - adjust exclusions to handle `@(_ProjectReferenceByAssemblyName)` removal nit: do not generate empty `` elements * Correct `@(SuppressBaselineReference)` items - remove out-of-date `@(SuppressBaselineReference)` items - either 3.1.7 baselines we're using don't include reference or still using package - fix some comments and `Condition` attributes to make remainder easy to find - add missing `@(SuppressBaselineReference)` items --- eng/Baseline.Designer.props | 100 ++++++++---------- eng/targets/ResolveReferences.targets | 22 +++- eng/tools/BaselineGenerator/Program.cs | 40 +++++-- .../Microsoft.AspNetCore.Components.csproj | 14 ++- ...t.AspNetCore.Components.WebAssembly.csproj | 12 ++- ...Microsoft.AspNetCore.DataProtection.csproj | 1 - .../src/Microsoft.AspNetCore.TestHost.csproj | 5 + .../Microsoft.AspNetCore.Http.Features.csproj | 5 + ...icrosoft.Extensions.Identity.Stores.csproj | 1 - ...etCore.Identity.Specification.Tests.csproj | 4 - .../Microsoft.AspNetCore.Identity.UI.csproj | 5 + ...AspNetCore.Connections.Abstractions.csproj | 8 ++ ...soft.AspNetCore.SignalR.Client.Core.csproj | 6 +- ....AspNetCore.Http.Connections.Common.csproj | 8 -- ...t.AspNetCore.SignalR.Protocols.Json.csproj | 5 - ...Microsoft.AspNetCore.SignalR.Common.csproj | 8 -- .../src/dotnet-sql-cache.csproj | 3 - 17 files changed, 139 insertions(+), 108 deletions(-) diff --git a/eng/Baseline.Designer.props b/eng/Baseline.Designer.props index c4f0bf31d3..d3894b52f0 100644 --- a/eng/Baseline.Designer.props +++ b/eng/Baseline.Designer.props @@ -8,12 +8,10 @@ 3.0.3 - 3.0.3 - 3.1.7 @@ -29,7 +27,7 @@ 3.1.7 - + @@ -48,7 +46,7 @@ 3.1.7 - + @@ -56,7 +54,7 @@ 3.1.7 - + @@ -64,53 +62,48 @@ 3.1.7 - 3.1.7 - 3.1.7 - 3.1.7 - + 3.1.7 - 3.1.7 - + 3.1.7 - + 3.1.7 - 3.1.7 - + @@ -118,7 +111,7 @@ 3.1.7 - + @@ -132,7 +125,7 @@ 3.1.7 - + @@ -147,7 +140,7 @@ 3.1.7 - + @@ -160,7 +153,7 @@ - + @@ -173,7 +166,7 @@ 3.1.7 - + @@ -185,7 +178,7 @@ 3.1.7 - + @@ -196,7 +189,7 @@ 3.1.7 - + @@ -230,7 +223,6 @@ 3.2.1 - 3.2.1 @@ -243,7 +235,6 @@ 3.2.1 - 3.2.1 @@ -255,7 +246,7 @@ 3.1.7 - + @@ -263,7 +254,7 @@ 3.1.7 - + @@ -280,8 +271,6 @@ 3.1.7 - - 3.1.7 @@ -289,7 +278,7 @@ - + @@ -299,7 +288,7 @@ 3.1.7 - + @@ -324,8 +313,6 @@ 3.1.7 - - 3.1.7 @@ -356,7 +343,7 @@ 3.1.7 - + @@ -376,14 +363,14 @@ 3.1.7 - + 3.1.7 - + @@ -391,7 +378,7 @@ 3.1.7 - + @@ -412,7 +399,7 @@ 3.1.7 - + @@ -423,7 +410,7 @@ 3.1.7 - + @@ -435,7 +422,7 @@ 3.1.7 - + @@ -447,7 +434,7 @@ 3.1.7 - + @@ -458,7 +445,7 @@ 3.1.7 - + @@ -475,20 +462,18 @@ 3.1.7 - - 3.1.7 - + 3.1.7 - + @@ -497,7 +482,7 @@ 3.1.7 - + @@ -506,7 +491,7 @@ 3.1.7 - + @@ -515,7 +500,7 @@ 3.1.7 - + @@ -523,12 +508,11 @@ 3.1.7 - 3.1.7 - + @@ -565,7 +549,7 @@ 3.1.7 - + @@ -578,7 +562,7 @@ 3.1.7 - + @@ -604,7 +588,7 @@ 3.1.7 - + @@ -616,7 +600,7 @@ 3.1.7 - + @@ -625,14 +609,14 @@ 3.1.7 - + 3.1.7 - + @@ -640,7 +624,7 @@ 3.1.7 - + @@ -684,7 +668,7 @@ 3.1.7 - + @@ -698,7 +682,7 @@ 3.1.7 - + diff --git a/eng/targets/ResolveReferences.targets b/eng/targets/ResolveReferences.targets index 646a526c81..fe8224d198 100644 --- a/eng/targets/ResolveReferences.targets +++ b/eng/targets/ResolveReferences.targets @@ -175,9 +175,15 @@ - - + Exclude="@(Reference);@(PackageReference);@(ProjectReference->'%(Filename)')" /> + + + + + + + + + + ", "The NuGet source of packages to fetch", CommandOptionType.SingleValue); + _source = Option( + "-s|--package-source ", + "The NuGet source of packages to fetch", + CommandOptionType.SingleValue); _output = Option("-o|--output ", "The generated file output path", CommandOptionType.SingleValue); _update = Option("-u|--update", "Regenerate the input (Baseline.xml) file.", CommandOptionType.NoValue); @@ -45,9 +48,6 @@ namespace PackageBaselineGenerator private async Task Run() { - var source = _source.HasValue() - ? _source.Value().TrimEnd('/') - : "https://api.nuget.org/v3/index.json"; if (_output.HasValue() && _update.HasValue()) { await Error.WriteLineAsync("'--output' and '--update' options must not be used together."); @@ -56,6 +56,7 @@ namespace PackageBaselineGenerator var inputPath = Path.Combine(Directory.GetCurrentDirectory(), "Baseline.xml"); var input = XDocument.Load(inputPath); + var source = _source.HasValue() ? _source.Value().TrimEnd('/') : "https://api.nuget.org/v3/index.json"; var packageSource = new PackageSource(source); var providers = Repository.Provider.GetCoreV3(); // Get v2 and v3 API support var sourceRepository = new SourceRepository(packageSource, providers); @@ -89,6 +90,11 @@ namespace PackageBaselineGenerator var baselineVersion = input.Root.Attribute("Version").Value; + // Baseline and .NET Core versions always align in non-preview releases. + var parsedVersion = Version.Parse(baselineVersion); + var defaultTarget = ((parsedVersion.Major < 5) ? "netcoreapp" : "net") + + $"{parsedVersion.Major}.{parsedVersion.Minor}"; + var doc = new XDocument( new XComment(" Auto generated. Do not edit manually, use eng/tools/BaselineGenerator/ to recreate. "), new XElement("Project", @@ -136,12 +142,34 @@ namespace PackageBaselineGenerator foreach (var group in reader.NuspecReader.GetDependencyGroups()) { - var itemGroup = new XElement("ItemGroup", new XAttribute("Condition", $" '$(PackageId)' == '{id}' AND '$(TargetFramework)' == '{group.TargetFramework.GetShortFolderName()}' ")); + // Don't bother generating empty ItemGroup elements. + if (group.Packages.Count() == 0) + { + continue; + } + + // Handle changes to $(DefaultNetCoreTargetFramework) even if some projects are held back. + var targetCondition = $"'$(TargetFramework)' == '{group.TargetFramework.GetShortFolderName()}'"; + if (string.Equals( + group.TargetFramework.GetShortFolderName(), + defaultTarget, + StringComparison.OrdinalIgnoreCase)) + { + targetCondition = + $"('$(TargetFramework)' == '$(DefaultNetCoreTargetFramework)' OR {targetCondition})"; + } + + var itemGroup = new XElement( + "ItemGroup", + new XAttribute("Condition", $" '$(PackageId)' == '{id}' AND {targetCondition} ")); doc.Root.Add(itemGroup); foreach (var dependency in group.Packages) { - itemGroup.Add(new XElement("BaselinePackageReference", new XAttribute("Include", dependency.Id), new XAttribute("Version", dependency.VersionRange.ToString()))); + itemGroup.Add( + new XElement("BaselinePackageReference", + new XAttribute("Include", dependency.Id), + new XAttribute("Version", dependency.VersionRange.ToString()))); } } } diff --git a/src/Components/Components/src/Microsoft.AspNetCore.Components.csproj b/src/Components/Components/src/Microsoft.AspNetCore.Components.csproj index 1e7f881ed5..110ed5f7ae 100644 --- a/src/Components/Components/src/Microsoft.AspNetCore.Components.csproj +++ b/src/Components/Components/src/Microsoft.AspNetCore.Components.csproj @@ -17,11 +17,17 @@ - + - - - + + + diff --git a/src/Components/WebAssembly/WebAssembly/src/Microsoft.AspNetCore.Components.WebAssembly.csproj b/src/Components/WebAssembly/WebAssembly/src/Microsoft.AspNetCore.Components.WebAssembly.csproj index 906e03fe82..cf30c9c9e2 100644 --- a/src/Components/WebAssembly/WebAssembly/src/Microsoft.AspNetCore.Components.WebAssembly.csproj +++ b/src/Components/WebAssembly/WebAssembly/src/Microsoft.AspNetCore.Components.WebAssembly.csproj @@ -1,4 +1,4 @@ - + $(DefaultNetCoreTargetFramework) @@ -15,9 +15,13 @@ - - - + diff --git a/src/DataProtection/DataProtection/src/Microsoft.AspNetCore.DataProtection.csproj b/src/DataProtection/DataProtection/src/Microsoft.AspNetCore.DataProtection.csproj index 8a207fb491..8f16e33480 100644 --- a/src/DataProtection/DataProtection/src/Microsoft.AspNetCore.DataProtection.csproj +++ b/src/DataProtection/DataProtection/src/Microsoft.AspNetCore.DataProtection.csproj @@ -29,7 +29,6 @@ - diff --git a/src/Hosting/TestHost/src/Microsoft.AspNetCore.TestHost.csproj b/src/Hosting/TestHost/src/Microsoft.AspNetCore.TestHost.csproj index b4465d4958..45f833b2f3 100644 --- a/src/Hosting/TestHost/src/Microsoft.AspNetCore.TestHost.csproj +++ b/src/Hosting/TestHost/src/Microsoft.AspNetCore.TestHost.csproj @@ -13,4 +13,9 @@ + + + + + diff --git a/src/Http/Http.Features/src/Microsoft.AspNetCore.Http.Features.csproj b/src/Http/Http.Features/src/Microsoft.AspNetCore.Http.Features.csproj index aff4e11d9d..d6e93d7b02 100644 --- a/src/Http/Http.Features/src/Microsoft.AspNetCore.Http.Features.csproj +++ b/src/Http/Http.Features/src/Microsoft.AspNetCore.Http.Features.csproj @@ -20,4 +20,9 @@ + + + + + diff --git a/src/Identity/Extensions.Stores/src/Microsoft.Extensions.Identity.Stores.csproj b/src/Identity/Extensions.Stores/src/Microsoft.Extensions.Identity.Stores.csproj index 380bf7818c..367a0069f1 100644 --- a/src/Identity/Extensions.Stores/src/Microsoft.Extensions.Identity.Stores.csproj +++ b/src/Identity/Extensions.Stores/src/Microsoft.Extensions.Identity.Stores.csproj @@ -13,7 +13,6 @@ - diff --git a/src/Identity/Specification.Tests/src/Microsoft.AspNetCore.Identity.Specification.Tests.csproj b/src/Identity/Specification.Tests/src/Microsoft.AspNetCore.Identity.Specification.Tests.csproj index ab593d04a1..ba7e177bfb 100644 --- a/src/Identity/Specification.Tests/src/Microsoft.AspNetCore.Identity.Specification.Tests.csproj +++ b/src/Identity/Specification.Tests/src/Microsoft.AspNetCore.Identity.Specification.Tests.csproj @@ -20,8 +20,4 @@ - - - - diff --git a/src/Identity/UI/src/Microsoft.AspNetCore.Identity.UI.csproj b/src/Identity/UI/src/Microsoft.AspNetCore.Identity.UI.csproj index fb2f0d6eaa..685ffe67b5 100644 --- a/src/Identity/UI/src/Microsoft.AspNetCore.Identity.UI.csproj +++ b/src/Identity/UI/src/Microsoft.AspNetCore.Identity.UI.csproj @@ -42,6 +42,11 @@ + + + + + diff --git a/src/Servers/Connections.Abstractions/src/Microsoft.AspNetCore.Connections.Abstractions.csproj b/src/Servers/Connections.Abstractions/src/Microsoft.AspNetCore.Connections.Abstractions.csproj index 943461e7f7..b9614fcb02 100644 --- a/src/Servers/Connections.Abstractions/src/Microsoft.AspNetCore.Connections.Abstractions.csproj +++ b/src/Servers/Connections.Abstractions/src/Microsoft.AspNetCore.Connections.Abstractions.csproj @@ -23,4 +23,12 @@ + + + + + diff --git a/src/SignalR/clients/csharp/Client.Core/src/Microsoft.AspNetCore.SignalR.Client.Core.csproj b/src/SignalR/clients/csharp/Client.Core/src/Microsoft.AspNetCore.SignalR.Client.Core.csproj index cc35aef6bd..504f2e4549 100644 --- a/src/SignalR/clients/csharp/Client.Core/src/Microsoft.AspNetCore.SignalR.Client.Core.csproj +++ b/src/SignalR/clients/csharp/Client.Core/src/Microsoft.AspNetCore.SignalR.Client.Core.csproj @@ -27,9 +27,9 @@ - - - + + + diff --git a/src/SignalR/common/Http.Connections.Common/src/Microsoft.AspNetCore.Http.Connections.Common.csproj b/src/SignalR/common/Http.Connections.Common/src/Microsoft.AspNetCore.Http.Connections.Common.csproj index 3ecebb0f5c..02f97edfb6 100644 --- a/src/SignalR/common/Http.Connections.Common/src/Microsoft.AspNetCore.Http.Connections.Common.csproj +++ b/src/SignalR/common/Http.Connections.Common/src/Microsoft.AspNetCore.Http.Connections.Common.csproj @@ -23,12 +23,4 @@ - - - - - - - - diff --git a/src/SignalR/common/Protocols.Json/src/Microsoft.AspNetCore.SignalR.Protocols.Json.csproj b/src/SignalR/common/Protocols.Json/src/Microsoft.AspNetCore.SignalR.Protocols.Json.csproj index afe8cf0816..cae05aae11 100644 --- a/src/SignalR/common/Protocols.Json/src/Microsoft.AspNetCore.SignalR.Protocols.Json.csproj +++ b/src/SignalR/common/Protocols.Json/src/Microsoft.AspNetCore.SignalR.Protocols.Json.csproj @@ -23,9 +23,4 @@ - - - - - diff --git a/src/SignalR/common/SignalR.Common/src/Microsoft.AspNetCore.SignalR.Common.csproj b/src/SignalR/common/SignalR.Common/src/Microsoft.AspNetCore.SignalR.Common.csproj index 730549a8d9..1206aeed68 100644 --- a/src/SignalR/common/SignalR.Common/src/Microsoft.AspNetCore.SignalR.Common.csproj +++ b/src/SignalR/common/SignalR.Common/src/Microsoft.AspNetCore.SignalR.Common.csproj @@ -33,14 +33,6 @@ - - - - - - - - diff --git a/src/Tools/dotnet-sql-cache/src/dotnet-sql-cache.csproj b/src/Tools/dotnet-sql-cache/src/dotnet-sql-cache.csproj index bedcf8c051..24f2823009 100644 --- a/src/Tools/dotnet-sql-cache/src/dotnet-sql-cache.csproj +++ b/src/Tools/dotnet-sql-cache/src/dotnet-sql-cache.csproj @@ -15,9 +15,6 @@ - - -