Skip to content

Commit f1b8fcb

Browse files
committed
#if'ed the definition of ExcludeFromCodeCoverageAttribute depending on the target framework
1 parent 5330bbb commit f1b8fcb

File tree

6 files changed

+132
-0
lines changed

6 files changed

+132
-0
lines changed

src/GitVersionCore.Tests/VersionConverters/Approved/cs/GitVersionInfoGeneratorTests.ShouldCreateFile.approved.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,30 @@
88
// </auto-generated>
99
//------------------------------------------------------------------------------
1010

11+
#if NET20 || NET35
12+
#define SHOULD_DEFINE_EXCLUDE_FROM_CODE_COVERAGE
13+
#elif NETCOREAPP1_0 || NETCOREAPP1_1
14+
#define SHOULD_DEFINE_EXCLUDE_FROM_CODE_COVERAGE
15+
#elif NETSTANDARD1_0 || NETSTANDARD1_1 || NETSTANDARD1_2 || NETSTANDARD1_3 || NETSTANDARD1_4 || NETSTANDARD1_5 || NETSTANDARD1_6
16+
#define SHOULD_DEFINE_EXCLUDE_FROM_CODE_COVERAGE
17+
#endif
18+
19+
#if SHOULD_DEFINE_EXCLUDE_FROM_CODE_COVERAGE
20+
namespace System.Diagnostics.CodeAnalysis
21+
{
22+
[global::System.AttributeUsage(
23+
global::System.AttributeTargets.Assembly |
24+
global::System.AttributeTargets.Class |
25+
global::System.AttributeTargets.Struct |
26+
global::System.AttributeTargets.Constructor |
27+
global::System.AttributeTargets.Method |
28+
global::System.AttributeTargets.Property |
29+
global::System.AttributeTargets.Event,
30+
Inherited = false, AllowMultiple = false)]
31+
internal sealed class ExcludeFromCodeCoverageAttribute : global::System.Attribute { }
32+
}
33+
#endif
34+
1135
[global::System.Runtime.CompilerServices.CompilerGenerated]
1236
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
1337
static class GitVersionInformation

src/GitVersionCore.Tests/VersionConverters/Approved/fs/GitVersionInfoGeneratorTests.ShouldCreateFile.approved.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,22 @@
88
// </auto-generated>
99
//------------------------------------------------------------------------------
1010

11+
#if NET20 || NET35 || NETCOREAPP1_0 || NETCOREAPP1_1 || NETSTANDARD1_0 || NETSTANDARD1_1 || NETSTANDARD1_2 || NETSTANDARD1_3 || NETSTANDARD1_4 || NETSTANDARD1_5 || NETSTANDARD1_6
12+
namespace System.Diagnostics.CodeAnalysis
13+
14+
[<Sealed>]
15+
[<global.System.AttributeUsage(
16+
global.System.AttributeTargets.Assembly |||
17+
global.System.AttributeTargets.Class |||
18+
global.System.AttributeTargets.Struct |||
19+
global.System.AttributeTargets.Constructor |||
20+
global.System.AttributeTargets.Method |||
21+
global.System.AttributeTargets.Property |||
22+
global.System.AttributeTargets.Event,
23+
Inherited = false, AllowMultiple = false)>]
24+
type ExcludeFromCodeCoverageAttribute() = inherit global.System.Attribute()
25+
#endif
26+
1127
namespace global
1228

1329
[<AbstractClass; Sealed>]

src/GitVersionCore.Tests/VersionConverters/Approved/vb/GitVersionInfoGeneratorTests.ShouldCreateFile.approved.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,32 @@
88
' </auto-generated>
99
'------------------------------------------------------------------------------
1010

11+
#If NET20 OrElse NET35 Then
12+
#Const SHOULD_DEFINE_EXCLUDE_FROM_CODE_COVERAGE = 1
13+
#End If
14+
#If NETCOREAPP1_0 OrElse NETCOREAPP1_1 Then
15+
#Const SHOULD_DEFINE_EXCLUDE_FROM_CODE_COVERAGE = 1
16+
#End If
17+
#If NETSTANDARD1_0 OrElse NETSTANDARD1_1 OrElse NETSTANDARD1_2 OrElse NETSTANDARD1_3 OrElse NETSTANDARD1_4 OrElse NETSTANDARD1_5 OrElse NETSTANDARD1_6 Then
18+
#Const SHOULD_DEFINE_EXCLUDE_FROM_CODE_COVERAGE = 1
19+
#End If
20+
21+
#If SHOULD_DEFINE_EXCLUDE_FROM_CODE_COVERAGE Then
22+
Namespace Global.System.Diagnostics.CodeAnalysis
23+
<Global.System.AttributeUsage(
24+
Global.System.AttributeTargets.Assembly Or
25+
Global.System.AttributeTargets.Class Or
26+
Global.System.AttributeTargets.Struct Or
27+
Global.System.AttributeTargets.Constructor Or
28+
Global.System.AttributeTargets.Method Or
29+
Global.System.AttributeTargets.Property Or
30+
Global.System.AttributeTargets.Event, Inherited:=False, AllowMultiple:=False)>
31+
Friend NotInheritable Class ExcludeFromCodeCoverageAttribute
32+
Inherits Global.System.Attribute
33+
End Class
34+
End Namespace
35+
#End If
36+
1137
Namespace Global
1238

1339
<Global.System.Runtime.CompilerServices.CompilerGenerated()>

src/GitVersionCore/VersionConverters/GitVersionInfo/Templates/GitVersionInformation.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,30 @@
88
// </auto-generated>
99
//------------------------------------------------------------------------------
1010

11+
#if NET20 || NET35
12+
#define SHOULD_DEFINE_EXCLUDE_FROM_CODE_COVERAGE
13+
#elif NETCOREAPP1_0 || NETCOREAPP1_1
14+
#define SHOULD_DEFINE_EXCLUDE_FROM_CODE_COVERAGE
15+
#elif NETSTANDARD1_0 || NETSTANDARD1_1 || NETSTANDARD1_2 || NETSTANDARD1_3 || NETSTANDARD1_4 || NETSTANDARD1_5 || NETSTANDARD1_6
16+
#define SHOULD_DEFINE_EXCLUDE_FROM_CODE_COVERAGE
17+
#endif
18+
19+
#if SHOULD_DEFINE_EXCLUDE_FROM_CODE_COVERAGE
20+
namespace System.Diagnostics.CodeAnalysis
21+
{{
22+
[global::System.AttributeUsage(
23+
global::System.AttributeTargets.Assembly |
24+
global::System.AttributeTargets.Class |
25+
global::System.AttributeTargets.Struct |
26+
global::System.AttributeTargets.Constructor |
27+
global::System.AttributeTargets.Method |
28+
global::System.AttributeTargets.Property |
29+
global::System.AttributeTargets.Event,
30+
Inherited = false, AllowMultiple = false)]
31+
internal sealed class ExcludeFromCodeCoverageAttribute : global::System.Attribute {{ }}
32+
}}
33+
#endif
34+
1135
[global::System.Runtime.CompilerServices.CompilerGenerated]
1236
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
1337
static class GitVersionInformation

src/GitVersionCore/VersionConverters/GitVersionInfo/Templates/GitVersionInformation.fs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,22 @@
88
// </auto-generated>
99
//------------------------------------------------------------------------------
1010

11+
#if NET20 || NET35 || NETCOREAPP1_0 || NETCOREAPP1_1 || NETSTANDARD1_0 || NETSTANDARD1_1 || NETSTANDARD1_2 || NETSTANDARD1_3 || NETSTANDARD1_4 || NETSTANDARD1_5 || NETSTANDARD1_6
12+
namespace System.Diagnostics.CodeAnalysis
13+
14+
[<Sealed>]
15+
[<global.System.AttributeUsage(
16+
global.System.AttributeTargets.Assembly |||
17+
global.System.AttributeTargets.Class |||
18+
global.System.AttributeTargets.Struct |||
19+
global.System.AttributeTargets.Constructor |||
20+
global.System.AttributeTargets.Method |||
21+
global.System.AttributeTargets.Property |||
22+
global.System.AttributeTargets.Event,
23+
Inherited = false, AllowMultiple = false)>]
24+
type ExcludeFromCodeCoverageAttribute() = inherit global.System.Attribute()
25+
#endif
26+
1127
namespace global
1228

1329
[<AbstractClass; Sealed>]

src/GitVersionCore/VersionConverters/GitVersionInfo/Templates/GitVersionInformation.vb

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,32 @@
88
' </auto-generated>
99
'------------------------------------------------------------------------------
1010

11+
#If NET20 OrElse NET35 Then
12+
#Const SHOULD_DEFINE_EXCLUDE_FROM_CODE_COVERAGE = 1
13+
#End If
14+
#If NETCOREAPP1_0 OrElse NETCOREAPP1_1 Then
15+
#Const SHOULD_DEFINE_EXCLUDE_FROM_CODE_COVERAGE = 1
16+
#End If
17+
#If NETSTANDARD1_0 OrElse NETSTANDARD1_1 OrElse NETSTANDARD1_2 OrElse NETSTANDARD1_3 OrElse NETSTANDARD1_4 OrElse NETSTANDARD1_5 OrElse NETSTANDARD1_6 Then
18+
#Const SHOULD_DEFINE_EXCLUDE_FROM_CODE_COVERAGE = 1
19+
#End If
20+
21+
#If SHOULD_DEFINE_EXCLUDE_FROM_CODE_COVERAGE Then
22+
Namespace Global.System.Diagnostics.CodeAnalysis
23+
<Global.System.AttributeUsage(
24+
Global.System.AttributeTargets.Assembly Or
25+
Global.System.AttributeTargets.Class Or
26+
Global.System.AttributeTargets.Struct Or
27+
Global.System.AttributeTargets.Constructor Or
28+
Global.System.AttributeTargets.Method Or
29+
Global.System.AttributeTargets.Property Or
30+
Global.System.AttributeTargets.Event, Inherited:=False, AllowMultiple:=False)>
31+
Friend NotInheritable Class ExcludeFromCodeCoverageAttribute
32+
Inherits Global.System.Attribute
33+
End Class
34+
End Namespace
35+
#End If
36+
1137
Namespace Global
1238

1339
<Global.System.Runtime.CompilerServices.CompilerGenerated()>

0 commit comments

Comments
 (0)