From b4a07e241c1fb4a53d455c7a1abaa2834008079f Mon Sep 17 00:00:00 2001 From: "internalautomation[bot]" <85681268+internalautomation[bot]@users.noreply.github.com> Date: Mon, 2 Dec 2024 18:03:12 -0500 Subject: [PATCH] GitHubSync update - master (#699) * GitHubSync update - master * Consolidate Azure.Storage.Blobs to 12.21.2 * Consolidate NServiceBus.ClaimCheck to 1.0.1 * Remove unnecessary dependency * Bump Azure.Storage.Blobs to 12.23.0 * Bump Fody to 6.9.1 * Clean up the verbose reference definition * Tweaks * Add NUnit.Analyzers to test project --------- Co-authored-by: internalautomation[bot] <85681268+internalautomation[bot]@users.noreply.github.com> Co-authored-by: Tamara Rivera Co-authored-by: Brandon Ording --- .github/dependabot.yml | 5 ++ ...ck.AzureBlobStorage.AcceptanceTests.csproj | 10 +--- .../When_using_claimcheck_with_client.cs | 4 +- ...using_claimcheck_with_connection_string.cs | 4 +- ...n_using_claimcheck_with_custom_provider.cs | 6 +- .../When_using_claimcheck_with_expiry.cs | 4 +- ...ServiceBus.DataBus.AzureBlobStorage.csproj | 12 ++-- src/Directory.Build.props | 4 +- src/Directory.Build.targets | 4 +- ...eBus.DataBus.AzureBlobStorage.Tests.csproj | 3 - src/msbuild/AutomaticVersionRanges.targets | 42 ++++++++++++++ src/msbuild/ConvertToVersionRange.cs | 57 +++++++++++++++++++ 12 files changed, 123 insertions(+), 32 deletions(-) create mode 100644 src/msbuild/AutomaticVersionRanges.targets create mode 100644 src/msbuild/ConvertToVersionRange.cs diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 8a261a2..bc1175f 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,7 +1,12 @@ version: 2 +registries: + particular-packages: + type: nuget-feed + url: https://f.feedz.io/particular-software/packages/nuget/index.json updates: - package-ecosystem: nuget directory: "/src" + registries: "*" schedule: interval: daily open-pull-requests-limit: 1000 diff --git a/src/AcceptanceTests/NServiceBus.ClaimCheck.AzureBlobStorage.AcceptanceTests.csproj b/src/AcceptanceTests/NServiceBus.ClaimCheck.AzureBlobStorage.AcceptanceTests.csproj index 2f168bb..26777dd 100644 --- a/src/AcceptanceTests/NServiceBus.ClaimCheck.AzureBlobStorage.AcceptanceTests.csproj +++ b/src/AcceptanceTests/NServiceBus.ClaimCheck.AzureBlobStorage.AcceptanceTests.csproj @@ -9,15 +9,11 @@ - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - + - - + + diff --git a/src/AcceptanceTests/When_using_claimcheck_with_client.cs b/src/AcceptanceTests/When_using_claimcheck_with_client.cs index 97533fb..73e2a01 100644 --- a/src/AcceptanceTests/When_using_claimcheck_with_client.cs +++ b/src/AcceptanceTests/When_using_claimcheck_with_client.cs @@ -4,11 +4,9 @@ using System.Threading.Tasks; using AcceptanceTesting; using NServiceBus; - using NServiceBus.ClaimCheck; using NServiceBus.AcceptanceTests; using NServiceBus.AcceptanceTests.EndpointTemplates; using NUnit.Framework; - using NUnit.Framework.Legacy; public class When_using_claimcheck_with_client : NServiceBusAcceptanceTest { @@ -27,7 +25,7 @@ public async Task Should_work() .Done(c => c.MessageReceived) .Run(); - CollectionAssert.AreEqual(payloadToSend, context.PayloadReceived); + Assert.That(context.PayloadReceived, Is.EqualTo(payloadToSend).AsCollection); } public class Context : ScenarioContext diff --git a/src/AcceptanceTests/When_using_claimcheck_with_connection_string.cs b/src/AcceptanceTests/When_using_claimcheck_with_connection_string.cs index bdf9090..f6b1cf8 100644 --- a/src/AcceptanceTests/When_using_claimcheck_with_connection_string.cs +++ b/src/AcceptanceTests/When_using_claimcheck_with_connection_string.cs @@ -4,11 +4,9 @@ using System.Threading.Tasks; using AcceptanceTesting; using NServiceBus; - using NServiceBus.ClaimCheck; using NServiceBus.AcceptanceTests; using NServiceBus.AcceptanceTests.EndpointTemplates; using NUnit.Framework; - using NUnit.Framework.Legacy; public class When_using_claimcheck_with_connection_string : NServiceBusAcceptanceTest { @@ -27,7 +25,7 @@ public async Task Should_work() .Done(c => c.MessageReceived) .Run(); - CollectionAssert.AreEqual(payloadToSend, context.PayloadReceived); + Assert.That(context.PayloadReceived, Is.EqualTo(payloadToSend).AsCollection); } public class Context : ScenarioContext diff --git a/src/AcceptanceTests/When_using_claimcheck_with_custom_provider.cs b/src/AcceptanceTests/When_using_claimcheck_with_custom_provider.cs index d1a74aa..66511eb 100644 --- a/src/AcceptanceTests/When_using_claimcheck_with_custom_provider.cs +++ b/src/AcceptanceTests/When_using_claimcheck_with_custom_provider.cs @@ -3,13 +3,11 @@ using System; using System.Threading.Tasks; using AcceptanceTesting; - using NUnit.Framework; using Azure.Storage.Blobs; using Microsoft.Extensions.DependencyInjection; - using NServiceBus.ClaimCheck; using NServiceBus.AcceptanceTests; using NServiceBus.AcceptanceTests.EndpointTemplates; - using NUnit.Framework.Legacy; + using NUnit.Framework; public class When_using_claimcheck_with_custom_provider : NServiceBusAcceptanceTest { @@ -28,7 +26,7 @@ public async Task Should_work() .Run(); Assert.That(context.ProviderWasCalled); - CollectionAssert.AreEqual(payloadToSend, context.PayloadReceived); + Assert.That(context.PayloadReceived, Is.EqualTo(payloadToSend).AsCollection); } public class Context : ScenarioContext diff --git a/src/AcceptanceTests/When_using_claimcheck_with_expiry.cs b/src/AcceptanceTests/When_using_claimcheck_with_expiry.cs index 20a4795..100408f 100644 --- a/src/AcceptanceTests/When_using_claimcheck_with_expiry.cs +++ b/src/AcceptanceTests/When_using_claimcheck_with_expiry.cs @@ -4,11 +4,9 @@ using System.Threading.Tasks; using AcceptanceTesting; using NServiceBus; - using NServiceBus.ClaimCheck; using NServiceBus.AcceptanceTests; using NServiceBus.AcceptanceTests.EndpointTemplates; using NUnit.Framework; - using NUnit.Framework.Legacy; public class When_using_claimcheck_with_expiry : NServiceBusAcceptanceTest { @@ -27,7 +25,7 @@ public async Task Should_work() .Done(c => c.MessageReceived) .Run(); - CollectionAssert.AreEqual(payloadToSend, context.PayloadReceived); + Assert.That(context.PayloadReceived, Is.EqualTo(payloadToSend).AsCollection); } public class Context : ScenarioContext diff --git a/src/DataBus/NServiceBus.DataBus.AzureBlobStorage.csproj b/src/DataBus/NServiceBus.DataBus.AzureBlobStorage.csproj index 7616732..91943a0 100644 --- a/src/DataBus/NServiceBus.DataBus.AzureBlobStorage.csproj +++ b/src/DataBus/NServiceBus.DataBus.AzureBlobStorage.csproj @@ -8,10 +8,14 @@ - - - - + + + + + + + + diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 7e3a698..4b7369c 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -7,10 +7,10 @@ true 5.0 true - low + all - 2.1.2 + 2.1.3 0024000004800000940000000602000000240000525341310004000001000100dde965e6172e019ac82c2639ffe494dd2e7dd16347c34762a05732b492e110f2e4e2e1b5ef2d85c848ccfb671ee20a47c8d1376276708dc30a90ff1121b647ba3b7259a6bc383b2034938ef0e275b58b920375ac605076178123693c6c4f1331661a62eba28c249386855637780e3ff5f23a6d854700eaa6803ef48907513b92 00240000048000009400000006020000002400005253413100040000010001007f16e21368ff041183fab592d9e8ed37e7be355e93323147a1d29983d6e591b04282e4da0c9e18bd901e112c0033925eb7d7872c2f1706655891c5c9d57297994f707d16ee9a8f40d978f064ee1ffc73c0db3f4712691b23bf596f75130f4ec978cf78757ec034625a5f27e6bb50c618931ea49f6f628fd74271c32959efb1c5 diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index d47a6af..9896640 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -1,7 +1,5 @@ - - all - + diff --git a/src/Tests/NServiceBus.DataBus.AzureBlobStorage.Tests.csproj b/src/Tests/NServiceBus.DataBus.AzureBlobStorage.Tests.csproj index 59805b5..7186cf8 100644 --- a/src/Tests/NServiceBus.DataBus.AzureBlobStorage.Tests.csproj +++ b/src/Tests/NServiceBus.DataBus.AzureBlobStorage.Tests.csproj @@ -11,11 +11,8 @@ - - - diff --git a/src/msbuild/AutomaticVersionRanges.targets b/src/msbuild/AutomaticVersionRanges.targets new file mode 100644 index 0000000..9737210 --- /dev/null +++ b/src/msbuild/AutomaticVersionRanges.targets @@ -0,0 +1,42 @@ + + + + false + false + false + true + + + + + + + + + + + @(_ProjectReferencesWithVersions->Count()) + + + + + + <_ProjectReferencesWithVersions Remove="@(_ProjectReferencesWithVersions)" /> + <_ProjectReferencesWithVersions Include="@(_ProjectReferencesWithVersionRanges)" /> + + + + + + @(PackageReference->Count()) + + + + + + + + + + + diff --git a/src/msbuild/ConvertToVersionRange.cs b/src/msbuild/ConvertToVersionRange.cs new file mode 100644 index 0000000..d918478 --- /dev/null +++ b/src/msbuild/ConvertToVersionRange.cs @@ -0,0 +1,57 @@ +using System; +using System.Text.RegularExpressions; +using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; + +public class ConvertToVersionRange : Task +{ + [Required] + public ITaskItem[] References { get; set; } = []; + + [Required] + public string VersionProperty { get; set; } = string.Empty; + + [Output] + public ITaskItem[] ReferencesWithVersionRanges { get; private set; } = []; + + public override bool Execute() + { + var success = true; + + foreach (var reference in References) + { + var automaticVersionRange = reference.GetMetadata("AutomaticVersionRange"); + + if (automaticVersionRange.Equals("false", StringComparison.OrdinalIgnoreCase)) + { + continue; + } + + var privateAssets = reference.GetMetadata("PrivateAssets"); + + if (privateAssets.Equals("All", StringComparison.OrdinalIgnoreCase)) + { + continue; + } + + var version = reference.GetMetadata(VersionProperty); + var match = Regex.Match(version, @"^\d+"); + + if (match.Value.Equals(string.Empty, StringComparison.Ordinal)) + { + Log.LogError("Reference '{0}' with version '{1}' is not valid for automatic version range conversion. Fix the version or exclude the reference from conversion by setting 'AutomaticVersionRange=\"false\"' on the reference.", reference.ItemSpec, version); + success = false; + continue; + } + + var nextMajor = Convert.ToInt32(match.Value) + 1; + + var versionRange = $"[{version}, {nextMajor}.0.0)"; + reference.SetMetadata(VersionProperty, versionRange); + } + + ReferencesWithVersionRanges = References; + + return success; + } +}