Skip to content

Commit

Permalink
Merge pull request GitTools#4316 from arturcic/main
Browse files Browse the repository at this point in the history
cleanup code targeting  < net8.0
  • Loading branch information
arturcic authored Nov 17, 2024
2 parents cddb689 + 7eb9399 commit b2387e6
Show file tree
Hide file tree
Showing 12 changed files with 90 additions and 154 deletions.
35 changes: 0 additions & 35 deletions src/GitVersion.Core/Polyfills/StringSyntaxAttribute.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,6 @@
// </auto-generated>
//------------------------------------------------------------------------------

#if NET20 || NET35 || NETCOREAPP1_0 || NETCOREAPP1_1 || NETSTANDARD1_0 || NETSTANDARD1_1 || NETSTANDARD1_2 || NETSTANDARD1_3 || NETSTANDARD1_4 || NETSTANDARD1_5 || NETSTANDARD1_6
namespace System.Diagnostics.CodeAnalysis
{
[global::System.AttributeUsage(
global::System.AttributeTargets.Assembly |
global::System.AttributeTargets.Class |
global::System.AttributeTargets.Struct |
global::System.AttributeTargets.Constructor |
global::System.AttributeTargets.Method |
global::System.AttributeTargets.Property |
global::System.AttributeTargets.Event,
Inherited = false, AllowMultiple = false)]
internal sealed class ExcludeFromCodeCoverageAttribute : global::System.Attribute { }
}
#endif

[global::System.Runtime.CompilerServices.CompilerGenerated]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
static class GitVersionInformation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,6 @@
// </auto-generated>
//------------------------------------------------------------------------------

#if NET20 || NET35 || NETCOREAPP1_0 || NETCOREAPP1_1 || NETSTANDARD1_0 || NETSTANDARD1_1 || NETSTANDARD1_2 || NETSTANDARD1_3 || NETSTANDARD1_4 || NETSTANDARD1_5 || NETSTANDARD1_6
namespace System.Diagnostics.CodeAnalysis
{
[global::System.AttributeUsage(
global::System.AttributeTargets.Assembly |
global::System.AttributeTargets.Class |
global::System.AttributeTargets.Struct |
global::System.AttributeTargets.Constructor |
global::System.AttributeTargets.Method |
global::System.AttributeTargets.Property |
global::System.AttributeTargets.Event,
Inherited = false, AllowMultiple = false)]
internal sealed class ExcludeFromCodeCoverageAttribute : global::System.Attribute { }
}
#endif

namespace My.Custom.Namespace
{
[global::System.Runtime.CompilerServices.CompilerGenerated]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,6 @@
// </auto-generated>
//------------------------------------------------------------------------------

#if NET20 || NET35 || NETCOREAPP1_0 || NETCOREAPP1_1 || NETSTANDARD1_0 || NETSTANDARD1_1 || NETSTANDARD1_2 || NETSTANDARD1_3 || NETSTANDARD1_4 || NETSTANDARD1_5 || NETSTANDARD1_6
namespace System.Diagnostics.CodeAnalysis

[<Sealed>]
[<global.System.AttributeUsage(
global.System.AttributeTargets.Assembly |||
global.System.AttributeTargets.Class |||
global.System.AttributeTargets.Struct |||
global.System.AttributeTargets.Constructor |||
global.System.AttributeTargets.Method |||
global.System.AttributeTargets.Property |||
global.System.AttributeTargets.Event,
Inherited = false, AllowMultiple = false)>]
type ExcludeFromCodeCoverageAttribute() = inherit global.System.Attribute()
#endif

namespace global

[<AbstractClass; Sealed>]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// GitVersion
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace My.Custom.Namespace

[<AbstractClass; Sealed>]
[<global.System.Runtime.CompilerServices.CompilerGenerated>]
[<global.System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage>]
type GitVersionInformation =
static member AssemblySemFileVer = "1.2.3.0"
static member AssemblySemVer = "1.2.3.0"
static member BranchName = "feature1"
static member BuildMetaData = "5"
static member CommitDate = "2014-03-06"
static member CommitsSinceVersionSource = "5"
static member EscapedBranchName = "feature1"
static member FullBuildMetaData = "5.Branch.feature1.Sha.commitSha"
static member FullSemVer = "1.2.3-unstable.4+5"
static member InformationalVersion = "1.2.3-unstable.4+5.Branch.feature1.Sha.commitSha"
static member Major = "1"
static member MajorMinorPatch = "1.2.3"
static member Minor = "2"
static member Patch = "3"
static member PreReleaseLabel = "unstable"
static member PreReleaseLabelWithDash = "-unstable"
static member PreReleaseNumber = "4"
static member PreReleaseTag = "unstable.4"
static member PreReleaseTagWithDash = "-unstable.4"
static member SemVer = "1.2.3-unstable.4"
static member Sha = "commitSha"
static member ShortSha = "commitShortSha"
static member UncommittedChanges = "0"
static member VersionSourceSha = "versionSourceSha"
static member WeightedPreReleaseNumber = "4"
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,6 @@
' </auto-generated>
'------------------------------------------------------------------------------

#If NET20 OrElse NET35 OrElse NETCOREAPP1_0 OrElse NETCOREAPP1_1 OrElse NETSTANDARD1_0 OrElse NETSTANDARD1_1 OrElse NETSTANDARD1_2 OrElse NETSTANDARD1_3 OrElse NETSTANDARD1_4 OrElse NETSTANDARD1_5 OrElse NETSTANDARD1_6 Then
Namespace Global.System.Diagnostics.CodeAnalysis
<Global.System.AttributeUsage(
Global.System.AttributeTargets.Assembly Or
Global.System.AttributeTargets.Class Or
Global.System.AttributeTargets.Struct Or
Global.System.AttributeTargets.Constructor Or
Global.System.AttributeTargets.Method Or
Global.System.AttributeTargets.Property Or
Global.System.AttributeTargets.Event, Inherited:=False, AllowMultiple:=False)>
Friend NotInheritable Class ExcludeFromCodeCoverageAttribute
Inherits Global.System.Attribute
End Class
End Namespace
#End If

Namespace Global

<Global.System.Runtime.CompilerServices.CompilerGenerated()>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' GitVersion
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------

Namespace My.Custom.Namespace

<Global.System.Runtime.CompilerServices.CompilerGenerated()>
<Global.System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage()>
NotInheritable Class GitVersionInformation
Private Sub New()
End Sub
Public Shared AssemblySemFileVer As String = "1.2.3.0"
Public Shared AssemblySemVer As String = "1.2.3.0"
Public Shared BranchName As String = "feature1"
Public Shared BuildMetaData As String = "5"
Public Shared CommitDate As String = "2014-03-06"
Public Shared CommitsSinceVersionSource As String = "5"
Public Shared EscapedBranchName As String = "feature1"
Public Shared FullBuildMetaData As String = "5.Branch.feature1.Sha.commitSha"
Public Shared FullSemVer As String = "1.2.3-unstable.4+5"
Public Shared InformationalVersion As String = "1.2.3-unstable.4+5.Branch.feature1.Sha.commitSha"
Public Shared Major As String = "1"
Public Shared MajorMinorPatch As String = "1.2.3"
Public Shared Minor As String = "2"
Public Shared Patch As String = "3"
Public Shared PreReleaseLabel As String = "unstable"
Public Shared PreReleaseLabelWithDash As String = "-unstable"
Public Shared PreReleaseNumber As String = "4"
Public Shared PreReleaseTag As String = "unstable.4"
Public Shared PreReleaseTagWithDash As String = "-unstable.4"
Public Shared SemVer As String = "1.2.3-unstable.4"
Public Shared Sha As String = "commitSha"
Public Shared ShortSha As String = "commitShortSha"
Public Shared UncommittedChanges As String = "0"
Public Shared VersionSourceSha As String = "versionSourceSha"
Public Shared WeightedPreReleaseNumber As String = "4"
End Class

End Namespace
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@ public void ShouldCreateFile(string fileExtension)
/// <summary>
/// Regression test for issue #4196 (https://github.com/GitTools/GitVersion/issues/4196)
/// </summary>
[TestCase]
public void ShouldProperlyOutputNamespaceDeclaration()
[TestCase("cs")]
[TestCase("fs")]
[TestCase("vb")]
public void ShouldProperlyOutputNamespaceDeclaration(string fileExtension)
{
const string fileExtension = "cs";
const string targetNamespace = "My.Custom.Namespace";

var directory = PathHelper.Combine(PathHelper.GetTempPath(), "GitVersionInfoGeneratorTests", Guid.NewGuid().ToString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,6 @@
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

#if NET20 || NET35 || NETCOREAPP1_0 || NETCOREAPP1_1 || NETSTANDARD1_0 || NETSTANDARD1_1 || NETSTANDARD1_2 || NETSTANDARD1_3 || NETSTANDARD1_4 || NETSTANDARD1_5 || NETSTANDARD1_6
namespace System.Diagnostics.CodeAnalysis
{{
[global::System.AttributeUsage(
global::System.AttributeTargets.Assembly |
global::System.AttributeTargets.Class |
global::System.AttributeTargets.Struct |
global::System.AttributeTargets.Constructor |
global::System.AttributeTargets.Method |
global::System.AttributeTargets.Property |
global::System.AttributeTargets.Event,
Inherited = false, AllowMultiple = false)]
internal sealed class ExcludeFromCodeCoverageAttribute : global::System.Attribute {{ }}
}}
#endif
{1}{2}
{4}[global::System.Runtime.CompilerServices.CompilerGenerated]
{4}[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,6 @@
// </auto-generated>
//------------------------------------------------------------------------------

#if NET20 || NET35 || NETCOREAPP1_0 || NETCOREAPP1_1 || NETSTANDARD1_0 || NETSTANDARD1_1 || NETSTANDARD1_2 || NETSTANDARD1_3 || NETSTANDARD1_4 || NETSTANDARD1_5 || NETSTANDARD1_6
namespace System.Diagnostics.CodeAnalysis

[<Sealed>]
[<global.System.AttributeUsage(
global.System.AttributeTargets.Assembly |||
global.System.AttributeTargets.Class |||
global.System.AttributeTargets.Struct |||
global.System.AttributeTargets.Constructor |||
global.System.AttributeTargets.Method |||
global.System.AttributeTargets.Property |||
global.System.AttributeTargets.Event,
Inherited = false, AllowMultiple = false)>]
type ExcludeFromCodeCoverageAttribute() = inherit global.System.Attribute()
#endif

namespace {1}

[<AbstractClass; Sealed>]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,6 @@
' </auto-generated>
'------------------------------------------------------------------------------

#If NET20 OrElse NET35 OrElse NETCOREAPP1_0 OrElse NETCOREAPP1_1 OrElse NETSTANDARD1_0 OrElse NETSTANDARD1_1 OrElse NETSTANDARD1_2 OrElse NETSTANDARD1_3 OrElse NETSTANDARD1_4 OrElse NETSTANDARD1_5 OrElse NETSTANDARD1_6 Then
Namespace Global.System.Diagnostics.CodeAnalysis
<Global.System.AttributeUsage(
Global.System.AttributeTargets.Assembly Or
Global.System.AttributeTargets.Class Or
Global.System.AttributeTargets.Struct Or
Global.System.AttributeTargets.Constructor Or
Global.System.AttributeTargets.Method Or
Global.System.AttributeTargets.Property Or
Global.System.AttributeTargets.Event, Inherited:=False, AllowMultiple:=False)>
Friend NotInheritable Class ExcludeFromCodeCoverageAttribute
Inherits Global.System.Attribute
End Class
End Namespace
#End If

Namespace {1}

<Global.System.Runtime.CompilerServices.CompilerGenerated()>
Expand Down
4 changes: 0 additions & 4 deletions src/GitVersion.Testing/Helpers/StringBuilderExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
#if NET7_0_OR_GREATER
using System.Diagnostics.CodeAnalysis;
#endif

namespace GitVersion.Testing.Internal;

internal static class StringBuilderExtensions
{
public static void AppendLineFormat(this StringBuilder stringBuilder,
#if NET7_0_OR_GREATER
[StringSyntax(StringSyntaxAttribute.CompositeFormat)]
#endif
string format,
params object?[] args)
{
Expand Down

0 comments on commit b2387e6

Please sign in to comment.