From 211db5cc5a35af0c1dc72faa163f76477ea1d2b7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 22 Mar 2026 12:48:19 +0000 Subject: [PATCH 1/2] (deps): Bump Scriban from 6.6.0 to 7.0.0 --- updated-dependencies: - dependency-name: Scriban dependency-version: 7.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- new-cli/Directory.Packages.props | 2 +- new-cli/GitVersion.Cli.Generator/SystemCommandlineContent.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/new-cli/Directory.Packages.props b/new-cli/Directory.Packages.props index 42eec33987..508a13c354 100644 --- a/new-cli/Directory.Packages.props +++ b/new-cli/Directory.Packages.props @@ -25,7 +25,7 @@ - + diff --git a/new-cli/GitVersion.Cli.Generator/SystemCommandlineContent.cs b/new-cli/GitVersion.Cli.Generator/SystemCommandlineContent.cs index ce2fa4fd75..46f0b16b77 100644 --- a/new-cli/GitVersion.Cli.Generator/SystemCommandlineContent.cs +++ b/new-cli/GitVersion.Cli.Generator/SystemCommandlineContent.cs @@ -15,7 +15,7 @@ namespace {{GeneratedNamespaceName}}; public class {{Model.CommandTypeName}}Impl : Command, ICommandImpl { public string CommandImplName => nameof({{Model.CommandTypeName}}Impl); - {{- if (Model.ParentCommand | string.empty) }} + {{- if (Model.ParentCommand == null || Model.ParentCommand == "") }} public string ParentCommandImplName => string.Empty; {{- else }} public string ParentCommandImplName => nameof({{Model.ParentCommand}}Impl); From 81b4ee9975e73b7ffa14a25602ca48ccd9b01f12 Mon Sep 17 00:00:00 2001 From: Artur Stolear Date: Sun, 22 Mar 2026 21:45:54 +0100 Subject: [PATCH 2/2] refactor(cli): Adopt PolySharp to manage polyfills and remove custom implementations --- new-cli/Directory.Packages.props | 1 + .../GitVersion.Cli.Generator.csproj | 5 ++ .../CallerArgumentExpressionAttribute.cs | 40 ------------- .../CompilerFeatureRequiredAttribute.cs | 56 ------------------- .../Polyfill/IsExternalInit.cs | 21 ------- .../Polyfill/NotNullAttribute.cs | 26 --------- .../Polyfill/RequiredMemberAttribute.cs | 29 ---------- .../Polyfill/SetsRequiredMembersAttribute.cs | 20 ------- 8 files changed, 6 insertions(+), 192 deletions(-) delete mode 100644 new-cli/GitVersion.Cli.Generator/Polyfill/CallerArgumentExpressionAttribute.cs delete mode 100644 new-cli/GitVersion.Cli.Generator/Polyfill/CompilerFeatureRequiredAttribute.cs delete mode 100644 new-cli/GitVersion.Cli.Generator/Polyfill/IsExternalInit.cs delete mode 100644 new-cli/GitVersion.Cli.Generator/Polyfill/NotNullAttribute.cs delete mode 100644 new-cli/GitVersion.Cli.Generator/Polyfill/RequiredMemberAttribute.cs delete mode 100644 new-cli/GitVersion.Cli.Generator/Polyfill/SetsRequiredMembersAttribute.cs diff --git a/new-cli/Directory.Packages.props b/new-cli/Directory.Packages.props index 508a13c354..5713f5be3d 100644 --- a/new-cli/Directory.Packages.props +++ b/new-cli/Directory.Packages.props @@ -22,6 +22,7 @@ + diff --git a/new-cli/GitVersion.Cli.Generator/GitVersion.Cli.Generator.csproj b/new-cli/GitVersion.Cli.Generator/GitVersion.Cli.Generator.csproj index d93d7009bb..f54b1f214b 100644 --- a/new-cli/GitVersion.Cli.Generator/GitVersion.Cli.Generator.csproj +++ b/new-cli/GitVersion.Cli.Generator/GitVersion.Cli.Generator.csproj @@ -6,12 +6,17 @@ true en true + $(NoWarn);CS8669 + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/new-cli/GitVersion.Cli.Generator/Polyfill/CallerArgumentExpressionAttribute.cs b/new-cli/GitVersion.Cli.Generator/Polyfill/CallerArgumentExpressionAttribute.cs deleted file mode 100644 index a1f589114f..0000000000 --- a/new-cli/GitVersion.Cli.Generator/Polyfill/CallerArgumentExpressionAttribute.cs +++ /dev/null @@ -1,40 +0,0 @@ -// -#pragma warning disable - -#if NETFRAMEWORK || NETSTANDARD || NETCOREAPP2X - -namespace System.Runtime.CompilerServices; - -using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; -using Link = System.ComponentModel.DescriptionAttribute; - -/// -/// Indicates that a parameter captures the expression passed for another parameter as a string. -/// -[ExcludeFromCodeCoverage] -[DebuggerNonUserCode] -[AttributeUsage(AttributeTargets.Parameter)] -[Link("https://learn.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.callerargumentexpressionattribute")] -#if PolyPublic -public -#endif -sealed class CallerArgumentExpressionAttribute : - Attribute -{ - /// - /// Initializes a new instance of the class. - /// - /// - /// The name of the parameter whose expression should be captured as a string. - /// - public CallerArgumentExpressionAttribute(string parameterName) => - ParameterName = parameterName; - - /// - /// Gets the name of the parameter whose expression should be captured as a string. - /// - public string ParameterName { get; } -} - -#endif diff --git a/new-cli/GitVersion.Cli.Generator/Polyfill/CompilerFeatureRequiredAttribute.cs b/new-cli/GitVersion.Cli.Generator/Polyfill/CompilerFeatureRequiredAttribute.cs deleted file mode 100644 index 37cf5ccc71..0000000000 --- a/new-cli/GitVersion.Cli.Generator/Polyfill/CompilerFeatureRequiredAttribute.cs +++ /dev/null @@ -1,56 +0,0 @@ -// -#pragma warning disable - -#if !NET7_0_OR_GREATER - -namespace System.Runtime.CompilerServices; - -using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; -using Link = System.ComponentModel.DescriptionAttribute; - -/// -/// Indicates that compiler support for a particular feature is required for the location where this attribute is applied. -/// -[ExcludeFromCodeCoverage] -[DebuggerNonUserCode] -[AttributeUsage( - validOn: AttributeTargets.All, - AllowMultiple = true, - Inherited = false)] -[Link("https://learn.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.compilerfeaturerequiredattribute")] -#if PolyPublic -public -#endif -sealed class CompilerFeatureRequiredAttribute : - Attribute -{ - /// - /// Initialize a new instance of - /// - /// The name of the required compiler feature. - public CompilerFeatureRequiredAttribute(string featureName) => - FeatureName = featureName; - - /// - /// The name of the compiler feature. - /// - public string FeatureName { get; } - - /// - /// If true, the compiler can choose to allow access to the location where this attribute is applied if it does not understand . - /// - public bool IsOptional { get; init; } - - /// - /// The used for the ref structs C# feature. - /// - public const string RefStructs = nameof(RefStructs); - - /// - /// The used for the required members C# feature. - /// - public const string RequiredMembers = nameof(RequiredMembers); -} - -#endif diff --git a/new-cli/GitVersion.Cli.Generator/Polyfill/IsExternalInit.cs b/new-cli/GitVersion.Cli.Generator/Polyfill/IsExternalInit.cs deleted file mode 100644 index f7221c6dda..0000000000 --- a/new-cli/GitVersion.Cli.Generator/Polyfill/IsExternalInit.cs +++ /dev/null @@ -1,21 +0,0 @@ -// -#pragma warning disable - -#if !NET5_0_OR_GREATER - -namespace System.Runtime.CompilerServices; - -using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; - -/// -/// Reserved to be used by the compiler for tracking metadata. This class should not be used by developers in source code. -/// -[ExcludeFromCodeCoverage] -[DebuggerNonUserCode] -#if PolyPublic -public -#endif -static class IsExternalInit; - -#endif diff --git a/new-cli/GitVersion.Cli.Generator/Polyfill/NotNullAttribute.cs b/new-cli/GitVersion.Cli.Generator/Polyfill/NotNullAttribute.cs deleted file mode 100644 index 827063a13d..0000000000 --- a/new-cli/GitVersion.Cli.Generator/Polyfill/NotNullAttribute.cs +++ /dev/null @@ -1,26 +0,0 @@ -// -#pragma warning disable - -#if NETSTANDARD2_0 || NETFRAMEWORK || NETCOREAPP2X - -namespace System.Diagnostics.CodeAnalysis; - -using Targets = AttributeTargets; - -/// -/// Specifies that an output is not even if the -/// corresponding type allows it. -/// -[ExcludeFromCodeCoverage] -[DebuggerNonUserCode] -[AttributeUsage( - validOn: Targets.Field | - Targets.Parameter | - Targets.Property | - Targets.ReturnValue)] -#if PolyPublic -public -#endif -sealed class NotNullAttribute : - Attribute; -#endif diff --git a/new-cli/GitVersion.Cli.Generator/Polyfill/RequiredMemberAttribute.cs b/new-cli/GitVersion.Cli.Generator/Polyfill/RequiredMemberAttribute.cs deleted file mode 100644 index a38ca389fd..0000000000 --- a/new-cli/GitVersion.Cli.Generator/Polyfill/RequiredMemberAttribute.cs +++ /dev/null @@ -1,29 +0,0 @@ -// -#pragma warning disable - -#if !NET7_0_OR_GREATER - -namespace System.Runtime.CompilerServices; - -using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; - -using Targets = AttributeTargets; - -/// -/// Specifies that a type has required members or that a member is required. -/// -[ExcludeFromCodeCoverage] -[DebuggerNonUserCode] -[AttributeUsage( - validOn: Targets.Class | - Targets.Struct | - Targets.Field | - Targets.Property, - Inherited = false)] -#if PolyPublic -public -#endif -sealed class RequiredMemberAttribute : - Attribute; -#endif diff --git a/new-cli/GitVersion.Cli.Generator/Polyfill/SetsRequiredMembersAttribute.cs b/new-cli/GitVersion.Cli.Generator/Polyfill/SetsRequiredMembersAttribute.cs deleted file mode 100644 index a3cdfc8608..0000000000 --- a/new-cli/GitVersion.Cli.Generator/Polyfill/SetsRequiredMembersAttribute.cs +++ /dev/null @@ -1,20 +0,0 @@ -// -#pragma warning disable - -#if !NET7_0_OR_GREATER - -namespace System.Diagnostics.CodeAnalysis; - -/// -/// Specifies that this constructor sets all required members for the current type, and callers -/// do not need to set any required members themselves. -/// -[ExcludeFromCodeCoverage] -[DebuggerNonUserCode] -[AttributeUsage(AttributeTargets.Constructor)] -#if PolyPublic -public -#endif -sealed class SetsRequiredMembersAttribute : - Attribute; -#endif