From 83fe1efc37fa217a7d1d2a7cc060350089ffb3bb Mon Sep 17 00:00:00 2001 From: "internalautomation[bot]" <85681268+internalautomation[bot]@users.noreply.github.com> Date: Wed, 30 Oct 2024 00:18:07 +0000 Subject: [PATCH 1/2] GitHubSync update - master --- src/Directory.Build.props | 4 +- src/Directory.Build.targets | 4 +- src/msbuild/AutomaticVersionRanges.targets | 42 ++++++++++++++++ src/msbuild/ConvertToVersionRange.cs | 57 ++++++++++++++++++++++ 4 files changed, 102 insertions(+), 5 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 7e3a698c3f..4b7369cc5e 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 d47a6af61e..98966408a6 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -1,7 +1,5 @@ - - all - + diff --git a/src/msbuild/AutomaticVersionRanges.targets b/src/msbuild/AutomaticVersionRanges.targets new file mode 100644 index 0000000000..9737210327 --- /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 0000000000..d918478458 --- /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; + } +} From 215918aa7927a233f6bebf98bd0454cf6002f422 Mon Sep 17 00:00:00 2001 From: Brandon Ording Date: Tue, 19 Nov 2024 17:10:16 -0500 Subject: [PATCH 2/2] Update packages --- .../Particular.PlatformSample.ServicePulse.csproj | 2 +- src/ServicePulse.Host.Tests/ServicePulse.Host.Tests.csproj | 2 +- src/ServicePulse.Host/ServicePulse.Host.csproj | 2 +- .../ServicePulse.Install.CustomActions.csproj | 2 +- src/ServicePulse/ServicePulse.csproj | 4 ++-- src/Setup/Setup.csproj | 2 +- src/SmokeTest.Shared/SmokeTest.Shared.csproj | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Particular.PlatformSample.ServicePulse/Particular.PlatformSample.ServicePulse.csproj b/src/Particular.PlatformSample.ServicePulse/Particular.PlatformSample.ServicePulse.csproj index 3752a91b5e..b481204854 100644 --- a/src/Particular.PlatformSample.ServicePulse/Particular.PlatformSample.ServicePulse.csproj +++ b/src/Particular.PlatformSample.ServicePulse/Particular.PlatformSample.ServicePulse.csproj @@ -15,7 +15,7 @@ - + diff --git a/src/ServicePulse.Host.Tests/ServicePulse.Host.Tests.csproj b/src/ServicePulse.Host.Tests/ServicePulse.Host.Tests.csproj index 2896f0575a..6eb2c2072a 100644 --- a/src/ServicePulse.Host.Tests/ServicePulse.Host.Tests.csproj +++ b/src/ServicePulse.Host.Tests/ServicePulse.Host.Tests.csproj @@ -10,7 +10,7 @@ - + diff --git a/src/ServicePulse.Host/ServicePulse.Host.csproj b/src/ServicePulse.Host/ServicePulse.Host.csproj index 98160bca7f..4e5992f495 100644 --- a/src/ServicePulse.Host/ServicePulse.Host.csproj +++ b/src/ServicePulse.Host/ServicePulse.Host.csproj @@ -15,7 +15,7 @@ - + diff --git a/src/ServicePulse.Install.CustomActions/ServicePulse.Install.CustomActions.csproj b/src/ServicePulse.Install.CustomActions/ServicePulse.Install.CustomActions.csproj index 5a479839cf..ccaf100140 100644 --- a/src/ServicePulse.Install.CustomActions/ServicePulse.Install.CustomActions.csproj +++ b/src/ServicePulse.Install.CustomActions/ServicePulse.Install.CustomActions.csproj @@ -9,7 +9,7 @@ - + diff --git a/src/ServicePulse/ServicePulse.csproj b/src/ServicePulse/ServicePulse.csproj index 3d78a7d46f..820608dbc6 100644 --- a/src/ServicePulse/ServicePulse.csproj +++ b/src/ServicePulse/ServicePulse.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/src/Setup/Setup.csproj b/src/Setup/Setup.csproj index 31569ec11a..fd4730f192 100644 --- a/src/Setup/Setup.csproj +++ b/src/Setup/Setup.csproj @@ -14,7 +14,7 @@ - + diff --git a/src/SmokeTest.Shared/SmokeTest.Shared.csproj b/src/SmokeTest.Shared/SmokeTest.Shared.csproj index 938c3cac6f..2abd94539a 100644 --- a/src/SmokeTest.Shared/SmokeTest.Shared.csproj +++ b/src/SmokeTest.Shared/SmokeTest.Shared.csproj @@ -5,7 +5,7 @@ - +