Skip to content

Commit 82af9d1

Browse files
committed
Added support for net452 & net5.0
1 parent b9e7ba3 commit 82af9d1

File tree

5 files changed

+78
-19
lines changed

5 files changed

+78
-19
lines changed

.github/workflows/dotnet-core.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- name: Setup .NET Core
3434
uses: actions/setup-dotnet@v1
3535
with:
36-
dotnet-version: 3.1.x
36+
dotnet-version: 5.0.x
3737
- name: Restore
3838
run: dotnet restore
3939
- name: Build
@@ -73,7 +73,7 @@ jobs:
7373
- name: Setup .NET Core
7474
uses: actions/setup-dotnet@v1
7575
with:
76-
dotnet-version: 3.1.x
76+
dotnet-version: 5.0.x
7777
- name: Create Release NuGet package
7878
run: |
7979
arrTag=(${GITHUB_REF//\// })

Directory.Build.props

Lines changed: 72 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,79 @@
4141
</PropertyGroup>
4242

4343
<PropertyGroup>
44-
<LangVersion>8.0</LangVersion>
44+
<LangVersion>9.0</LangVersion>
4545
</PropertyGroup>
4646

47-
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
48-
<DefineConstants>$(DefineConstants);SUPPORTS_HASHCODE</DefineConstants>
49-
</PropertyGroup>
50-
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
51-
<DefineConstants>$(DefineConstants);SUPPORTS_HASHCODE</DefineConstants>
52-
</PropertyGroup>
53-
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
54-
<DefineConstants>$(DefineConstants);SUPPORTS_HASHCODE</DefineConstants>
55-
</PropertyGroup>
47+
<!-- Define target framework specific constants.
48+
https://apisof.net/
49+
+===================+=======+==========+=====================+=============+=================+====================+==============+=========+============|===============|
50+
| SUPPORTS | MATHF | HASHCODE | EXTENDED_INTRINSICS | SPAN_STREAM | ENCODING_STRING | RUNTIME_INTRINSICS | CODECOVERAGE | HOTPATH | CREATESPAN | BITOPERATIONS |
51+
+===================+=======+==========+=====================+=============+=================+====================+==============+=========|============|===============|
52+
| >=netcoreapp3.1 | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |
53+
| netcoreapp2.1 | Y | Y | Y | Y | Y | N | Y | N | Y | N |
54+
| netcoreapp2.0 | Y | N | N | N | N | N | Y | N | Y | N |
55+
| netstandard2.1 | Y | Y | N | Y | Y | N | Y | N | Y | N |
56+
| netstandard2.0 | N | N | N | N | N | N | Y | N | N | N |
57+
| netstandard1.3 | N | N | N | N | N | N | N | N | N | N |
58+
| net472, net48 | N | N | Y | N | N | N | Y | N | N | N |
59+
+===================+=======+==========+=====================+=============+=================+====================+==============+=========|============|===============|
60+
-->
61+
<Choose>
62+
<When Condition="'$(TargetFramework)' == 'net472' OR '$(TargetFramework)' == 'net48'">
63+
<PropertyGroup>
64+
<DefineConstants>$(DefineConstants);SUPPORTS_EXTENDED_INTRINSICS</DefineConstants>
65+
<DefineConstants>$(DefineConstants);SUPPORTS_CODECOVERAGE</DefineConstants>
66+
</PropertyGroup>
67+
</When>
68+
<When Condition="'$(TargetFramework)' == 'netstandard2.0'">
69+
<PropertyGroup>
70+
<DefineConstants>$(DefineConstants);SUPPORTS_EXTENDED_INTRINSICS</DefineConstants>
71+
<DefineConstants>$(DefineConstants);SUPPORTS_CODECOVERAGE</DefineConstants>
72+
</PropertyGroup>
73+
</When>
74+
<When Condition="'$(TargetFramework)' == 'netstandard2.1'">
75+
<PropertyGroup>
76+
<DefineConstants>$(DefineConstants);SUPPORTS_MATHF</DefineConstants>
77+
<DefineConstants>$(DefineConstants);SUPPORTS_HASHCODE</DefineConstants>
78+
<DefineConstants>$(DefineConstants);SUPPORTS_SPAN_STREAM</DefineConstants>
79+
<DefineConstants>$(DefineConstants);SUPPORTS_ENCODING_STRING</DefineConstants>
80+
<DefineConstants>$(DefineConstants);SUPPORTS_CODECOVERAGE</DefineConstants>
81+
<DefineConstants>$(DefineConstants);SUPPORTS_CREATESPAN</DefineConstants>
82+
</PropertyGroup>
83+
</When>
84+
<When Condition="'$(TargetFramework)' == 'netcoreapp2.0'">
85+
<PropertyGroup>
86+
<DefineConstants>$(DefineConstants);SUPPORTS_MATHF</DefineConstants>
87+
<DefineConstants>$(DefineConstants);SUPPORTS_CODECOVERAGE</DefineConstants>
88+
<DefineConstants>$(DefineConstants);SUPPORTS_CREATESPAN</DefineConstants>
89+
</PropertyGroup>
90+
</When>
91+
<When Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
92+
<PropertyGroup>
93+
<DefineConstants>$(DefineConstants);SUPPORTS_MATHF</DefineConstants>
94+
<DefineConstants>$(DefineConstants);SUPPORTS_HASHCODE</DefineConstants>
95+
<DefineConstants>$(DefineConstants);SUPPORTS_EXTENDED_INTRINSICS</DefineConstants>
96+
<DefineConstants>$(DefineConstants);SUPPORTS_SPAN_STREAM</DefineConstants>
97+
<DefineConstants>$(DefineConstants);SUPPORTS_ENCODING_STRING</DefineConstants>
98+
<DefineConstants>$(DefineConstants);SUPPORTS_CODECOVERAGE</DefineConstants>
99+
<DefineConstants>$(DefineConstants);SUPPORTS_CREATESPAN</DefineConstants>
100+
</PropertyGroup>
101+
</When>
102+
<When Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)','netcoreapp3.1'))">
103+
<!--NETCORE 3.1. NET5.0, and future versions will fallback to this as the closest target.-->
104+
<PropertyGroup>
105+
<DefineConstants>$(DefineConstants);SUPPORTS_MATHF</DefineConstants>
106+
<DefineConstants>$(DefineConstants);SUPPORTS_HASHCODE</DefineConstants>
107+
<DefineConstants>$(DefineConstants);SUPPORTS_EXTENDED_INTRINSICS</DefineConstants>
108+
<DefineConstants>$(DefineConstants);SUPPORTS_SPAN_STREAM</DefineConstants>
109+
<DefineConstants>$(DefineConstants);SUPPORTS_ENCODING_STRING</DefineConstants>
110+
<DefineConstants>$(DefineConstants);SUPPORTS_RUNTIME_INTRINSICS</DefineConstants>
111+
<DefineConstants>$(DefineConstants);SUPPORTS_CODECOVERAGE</DefineConstants>
112+
<DefineConstants>$(DefineConstants);SUPPORTS_HOTPATH</DefineConstants>
113+
<DefineConstants>$(DefineConstants);SUPPORTS_CREATESPAN</DefineConstants>
114+
<DefineConstants>$(DefineConstants);SUPPORTS_BITOPERATIONS</DefineConstants>
115+
</PropertyGroup>
116+
</When>
117+
</Choose>
56118

57119
</Project>

src/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Project>
33

44
<PropertyGroup>
5-
<TargetFrameworks>netcoreapp3.1;netcoreapp2.1;netstandard2.1;netstandard2.0;netstandard1.6</TargetFrameworks>
5+
<TargetFrameworks>net452;netcoreapp2.1;netcoreapp3.1;netstandard1.6;netstandard2.0;netstandard2.1;net5.0</TargetFrameworks>
66
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileDirectory)..\Directory.Build.props</MSBuildAllProjects>
77
<SynercodingProjectCategory>src</SynercodingProjectCategory>
88
</PropertyGroup>

src/Synercoding.Primitives/Synercoding.Primitives.csproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@
22

33
<PropertyGroup>
44
<Nullable>enable</Nullable>
5-
<LangVersion>8.0</LangVersion>
65
</PropertyGroup>
76

87
<Import Project="$(MSBuildThisFileDirectory)\PackageDetails.props" />
98

10-
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' Or '$(TargetFramework)' == 'netstandard1.6'">
9+
<ItemGroup Condition="'$(TargetFramework)' == 'net452' Or '$(TargetFramework)' == 'netstandard2.0' Or '$(TargetFramework)' == 'netstandard1.6'">
1110
<PackageReference Include="System.Memory " Version="4.5.4" />
1211
</ItemGroup>
1312

14-
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.6'">
13+
<ItemGroup Condition="'$(TargetFramework)' == 'net452' Or '$(TargetFramework)' == 'netstandard1.6'">
1514
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
1615
</ItemGroup>
1716

src/Synercoding.Primitives/System/HashCode.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,8 @@ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
4646

4747
[assembly: TypeForwardedTo(typeof(System.HashCode))]
4848
#else
49-
using System.Buffers.Binary;
5049
using System.Collections.Generic;
5150
using System.ComponentModel;
52-
using System.Diagnostics.CodeAnalysis;
5351
using System.Runtime.CompilerServices;
5452
using System.Security.Cryptography;
5553

@@ -82,7 +80,7 @@ private static uint GenerateGlobalSeed()
8280
rng.GetBytes(data);
8381
}
8482

85-
return BinaryPrimitives.ReadUInt32LittleEndian(data);
83+
return BitConverter.ToUInt32(data, 0);
8684
}
8785

8886
public static int Combine<T1>(T1 value1)

0 commit comments

Comments
 (0)