From 4c29df9a62644e0064b8943f790ad5efa0939396 Mon Sep 17 00:00:00 2001 From: "internalautomation[bot]" <85681268+internalautomation[bot]@users.noreply.github.com> Date: Fri, 10 Jan 2025 19:49:19 -0500 Subject: [PATCH] GitHubSync update - release-2.0 (#418) * GitHubSync update - release-2.0 * Consolidate Amazon.Lambda.Core to 2.2.0 * Consolidate Amazon.Lambda.SQSEvents to 2.2.0 * Consolidate NServiceBus.AmazonSQS to 7.0.0 * Add the direct reference to NServiceBus 9.1.2 * Bump GitHubActionsTestLogger to 2.4.1 * Bump Microsoft.NET.Test.Sdk to 17.12.0 * Bump NUnit3TestAdapter to 4.6.0 * Fix typo * Bump Particular.Approvals to 2.0.0 * Bump Particular.Packaging to 4.2.0 * Bump PublicApiGenerator to 11.3.0 * Update NServiceBus.AmazonSQS --------- Co-authored-by: internalautomation[bot] <85681268+internalautomation[bot]@users.noreply.github.com> Co-authored-by: Tamara Rivera Co-authored-by: Brandon Ording --- src/Directory.Build.props | 4 +- src/Directory.Build.targets | 4 +- ...ceBus.AwsLambda.SQS.AcceptanceTests.csproj | 10 +--- ...iceBus.AwsLambda.SQS.Analyzer.Tests.csproj | 8 +-- .../NServiceBus.AwsLambda.SQS.Analyzer.csproj | 2 +- .../NServiceBus.AwsLambda.SQS.Tests.csproj | 14 ++--- .../NServiceBus.AwsLambda.SQS.csproj | 9 +-- src/msbuild/AutomaticVersionRanges.targets | 42 ++++++++++++++ src/msbuild/ConvertToVersionRange.cs | 57 +++++++++++++++++++ 9 files changed, 120 insertions(+), 30 deletions(-) create mode 100644 src/msbuild/AutomaticVersionRanges.targets create mode 100644 src/msbuild/ConvertToVersionRange.cs diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 7e3a698c..4b7369cc 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 d47a6af6..98966408 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -1,7 +1,5 @@ - - all - + diff --git a/src/NServiceBus.AwsLambda.SQS.AcceptanceTests/NServiceBus.AwsLambda.SQS.AcceptanceTests.csproj b/src/NServiceBus.AwsLambda.SQS.AcceptanceTests/NServiceBus.AwsLambda.SQS.AcceptanceTests.csproj index 23ac3dc9..d6b4ea0a 100644 --- a/src/NServiceBus.AwsLambda.SQS.AcceptanceTests/NServiceBus.AwsLambda.SQS.AcceptanceTests.csproj +++ b/src/NServiceBus.AwsLambda.SQS.AcceptanceTests/NServiceBus.AwsLambda.SQS.AcceptanceTests.csproj @@ -9,14 +9,10 @@ - - - - - - + + - + diff --git a/src/NServiceBus.AwsLambda.SQS.Analyzer.Tests/NServiceBus.AwsLambda.SQS.Analyzer.Tests.csproj b/src/NServiceBus.AwsLambda.SQS.Analyzer.Tests/NServiceBus.AwsLambda.SQS.Analyzer.Tests.csproj index 0a69d949..30631497 100644 --- a/src/NServiceBus.AwsLambda.SQS.Analyzer.Tests/NServiceBus.AwsLambda.SQS.Analyzer.Tests.csproj +++ b/src/NServiceBus.AwsLambda.SQS.Analyzer.Tests/NServiceBus.AwsLambda.SQS.Analyzer.Tests.csproj @@ -1,7 +1,7 @@  - net8.0 + net8.0 @@ -10,11 +10,11 @@ - + - + - + diff --git a/src/NServiceBus.AwsLambda.SQS.Analyzer/NServiceBus.AwsLambda.SQS.Analyzer.csproj b/src/NServiceBus.AwsLambda.SQS.Analyzer/NServiceBus.AwsLambda.SQS.Analyzer.csproj index e3a39ce4..c178b6b3 100644 --- a/src/NServiceBus.AwsLambda.SQS.Analyzer/NServiceBus.AwsLambda.SQS.Analyzer.csproj +++ b/src/NServiceBus.AwsLambda.SQS.Analyzer/NServiceBus.AwsLambda.SQS.Analyzer.csproj @@ -13,7 +13,7 @@ - + diff --git a/src/NServiceBus.AwsLambda.SQS.Tests/NServiceBus.AwsLambda.SQS.Tests.csproj b/src/NServiceBus.AwsLambda.SQS.Tests/NServiceBus.AwsLambda.SQS.Tests.csproj index 0e67cdbe..6032beff 100644 --- a/src/NServiceBus.AwsLambda.SQS.Tests/NServiceBus.AwsLambda.SQS.Tests.csproj +++ b/src/NServiceBus.AwsLambda.SQS.Tests/NServiceBus.AwsLambda.SQS.Tests.csproj @@ -9,16 +9,12 @@ - - - - - - + + - - - + + + diff --git a/src/NServiceBus.AwsLambda.SQS/NServiceBus.AwsLambda.SQS.csproj b/src/NServiceBus.AwsLambda.SQS/NServiceBus.AwsLambda.SQS.csproj index 42eb7579..9515b55a 100644 --- a/src/NServiceBus.AwsLambda.SQS/NServiceBus.AwsLambda.SQS.csproj +++ b/src/NServiceBus.AwsLambda.SQS/NServiceBus.AwsLambda.SQS.csproj @@ -11,10 +11,11 @@ - - - - + + + + + diff --git a/src/msbuild/AutomaticVersionRanges.targets b/src/msbuild/AutomaticVersionRanges.targets new file mode 100644 index 00000000..97372103 --- /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 00000000..d9184784 --- /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; + } +}