Skip to content

Commit 553985c

Browse files
authored
Develop (#20)
* task: support for dotnet v8 (#19) * task: bump artifact actions version
1 parent e2e4ab5 commit 553985c

13 files changed

Lines changed: 218 additions & 44 deletions

File tree

.assets/scripts/utilities.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function Ensure-GitVersion-Environment {
3434
}
3535

3636
# Extract key version properties
37-
$semVer = $gitVersionOutput.FullSemVer
37+
$semVer = $gitVersionOutput.MajorMinorPatch
3838
$assemblySemVer = $gitVersionOutput.AssemblySemVer
3939
$assemblySemFileVer = $gitVersionOutput.AssemblySemFileVer
4040
$infoVersion = $gitVersionOutput.InformationalVersion

.github/workflows/dotnet.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
dotnet build --configuration Release --no-restore
6666
6767
- name: Upload Test Artifacts
68-
uses: actions/upload-artifact@v3
68+
uses: actions/upload-artifact@v4
6969
with:
7070
name: BuildOutputTest
7171
path: ./tests/FixedMathSharp.Tests/bin/Release
@@ -80,7 +80,7 @@ jobs:
8080
uses: actions/checkout@v4
8181

8282
- name: Download Test Artifacts
83-
uses: actions/download-artifact@v3
83+
uses: actions/download-artifact@v4
8484
with:
8585
name: BuildOutputTest
8686
path: ./tests/FixedMathSharp.Tests/bin/Release

FixedMathSharp.sln

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,34 @@ Global
1919
DebugUnity|Any CPU = DebugUnity|Any CPU
2020
Release|Any CPU = Release|Any CPU
2121
ReleaseUnity|Any CPU = ReleaseUnity|Any CPU
22+
DebugNet8|Any CPU = DebugNet8|Any CPU
23+
ReleaseNet8|Any CPU = ReleaseNet8|Any CPU
2224
EndGlobalSection
2325
GlobalSection(ProjectConfigurationPlatforms) = postSolution
2426
{61834921-141D-4BD5-9E75-31188DF32E93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
2527
{61834921-141D-4BD5-9E75-31188DF32E93}.Debug|Any CPU.Build.0 = Debug|Any CPU
2628
{61834921-141D-4BD5-9E75-31188DF32E93}.DebugUnity|Any CPU.ActiveCfg = DebugUnity|Any CPU
2729
{61834921-141D-4BD5-9E75-31188DF32E93}.DebugUnity|Any CPU.Build.0 = DebugUnity|Any CPU
30+
{61834921-141D-4BD5-9E75-31188DF32E93}.DebugNet8|Any CPU.ActiveCfg = DebugNet8|Any CPU
31+
{61834921-141D-4BD5-9E75-31188DF32E93}.DebugNet8|Any CPU.Build.0 = DebugNet8|Any CPU
2832
{61834921-141D-4BD5-9E75-31188DF32E93}.Release|Any CPU.ActiveCfg = Release|Any CPU
2933
{61834921-141D-4BD5-9E75-31188DF32E93}.Release|Any CPU.Build.0 = Release|Any CPU
3034
{61834921-141D-4BD5-9E75-31188DF32E93}.ReleaseUnity|Any CPU.ActiveCfg = ReleaseUnity|Any CPU
3135
{61834921-141D-4BD5-9E75-31188DF32E93}.ReleaseUnity|Any CPU.Build.0 = ReleaseUnity|Any CPU
36+
{61834921-141D-4BD5-9E75-31188DF32E93}.ReleaseNet8|Any CPU.ActiveCfg = ReleaseNet8|Any CPU
37+
{61834921-141D-4BD5-9E75-31188DF32E93}.ReleaseNet8|Any CPU.Build.0 = ReleaseNet8|Any CPU
3238
{86CD72E6-2A40-494C-9D9B-A38EF90A12A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
3339
{86CD72E6-2A40-494C-9D9B-A38EF90A12A8}.Debug|Any CPU.Build.0 = Debug|Any CPU
3440
{86CD72E6-2A40-494C-9D9B-A38EF90A12A8}.DebugUnity|Any CPU.ActiveCfg = DebugUnity|Any CPU
3541
{86CD72E6-2A40-494C-9D9B-A38EF90A12A8}.DebugUnity|Any CPU.Build.0 = DebugUnity|Any CPU
42+
{86CD72E6-2A40-494C-9D9B-A38EF90A12A8}.DebugNet8|Any CPU.ActiveCfg = DebugNet8|Any CPU
43+
{86CD72E6-2A40-494C-9D9B-A38EF90A12A8}.DebugNet8|Any CPU.Build.0 = DebugNet8|Any CPU
3644
{86CD72E6-2A40-494C-9D9B-A38EF90A12A8}.Release|Any CPU.ActiveCfg = Release|Any CPU
3745
{86CD72E6-2A40-494C-9D9B-A38EF90A12A8}.Release|Any CPU.Build.0 = Release|Any CPU
3846
{86CD72E6-2A40-494C-9D9B-A38EF90A12A8}.ReleaseUnity|Any CPU.ActiveCfg = ReleaseUnity|Any CPU
3947
{86CD72E6-2A40-494C-9D9B-A38EF90A12A8}.ReleaseUnity|Any CPU.Build.0 = ReleaseUnity|Any CPU
48+
{86CD72E6-2A40-494C-9D9B-A38EF90A12A8}.ReleaseNet8|Any CPU.ActiveCfg = ReleaseNet8|Any CPU
49+
{86CD72E6-2A40-494C-9D9B-A38EF90A12A8}.ReleaseNet8|Any CPU.Build.0 = ReleaseNet8|Any CPU
4050
EndGlobalSection
4151
GlobalSection(SolutionProperties) = preSolution
4252
HideSolutionNode = FALSE

src/FixedMathSharp/FixedMathSharp.csproj

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<Deterministic>true</Deterministic>
3434
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
3535
<UnityBuild>false</UnityBuild>
36-
<Configurations>Debug;Release;DebugUnity;ReleaseUnity</Configurations>
36+
<Configurations>Debug;Release;DebugUnity;ReleaseUnity;DebugNet8;ReleaseNet8</Configurations>
3737
</PropertyGroup>
3838
<!-- Debug and Release-specific Properties -->
3939
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -49,6 +49,14 @@
4949
<DefineConstants>DEBUG;TRACE;UNITY_EDITOR</DefineConstants>
5050
<UnityBuild>true</UnityBuild>
5151
</PropertyGroup>
52+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNet8|AnyCPU'">
53+
<TargetFramework>net8</TargetFramework>
54+
<DebugSymbols>true</DebugSymbols>
55+
<DebugType>full</DebugType>
56+
<Optimize>false</Optimize>
57+
<DefineConstants>DEBUG;TRACE</DefineConstants>
58+
<UnityBuild>true</UnityBuild>
59+
</PropertyGroup>
5260
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
5361
<Optimize>true</Optimize>
5462
<DefineConstants>TRACE</DefineConstants>
@@ -58,6 +66,12 @@
5866
<DefineConstants>TRACE;UNITY_EDITOR</DefineConstants>
5967
<UnityBuild>true</UnityBuild>
6068
</PropertyGroup>
69+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNet8|AnyCPU'">
70+
<TargetFramework>net8</TargetFramework>
71+
<Optimize>true</Optimize>
72+
<DefineConstants>TRACE</DefineConstants>
73+
<UnityBuild>true</UnityBuild>
74+
</PropertyGroup>
6175
<!-- NuGet Packaging Metadata -->
6276
<PropertyGroup>
6377
<PackageId>FixedMathSharp</PackageId>

src/FixedMathSharp/FixedRange.cs

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace FixedMathSharp
99
[Serializable]
1010
public struct FixedRange : IEquatable<FixedRange>
1111
{
12-
#region Fields and Constants
12+
#region Constants
1313

1414
/// <summary>
1515
/// The smallest possible range.
@@ -23,6 +23,20 @@ public struct FixedRange : IEquatable<FixedRange>
2323

2424
#endregion
2525

26+
#region Fields
27+
28+
/// <summary>
29+
/// Gets the minimum value of the range.
30+
/// </summary>
31+
public Fixed64 Min;
32+
33+
/// <summary>
34+
/// Gets the maximum value of the range.
35+
/// </summary>
36+
public Fixed64 Max;
37+
38+
#endregion
39+
2640
#region Constructors
2741

2842
/// <summary>
@@ -52,24 +66,6 @@ public FixedRange(Fixed64 min, Fixed64 max, bool enforceOrder = true)
5266

5367
#region Properties and Methods (Instance)
5468

55-
/// <summary>
56-
/// Gets the minimum value of the range.
57-
/// </summary>
58-
public Fixed64 Min {
59-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
60-
get;
61-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
62-
private set; }
63-
64-
/// <summary>
65-
/// Gets the maximum value of the range.
66-
/// </summary>
67-
public Fixed64 Max {
68-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
69-
get;
70-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
71-
private set; }
72-
7369
/// <summary>
7470
/// The length of the range, computed as Max - Min.
7571
/// </summary>

tests/FixedMathSharp.Tests/Fixed3x3.Tests.cs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1-
using System.IO;
1+
#if NET48_OR_GREATER
2+
using System.IO;
23
using System.Runtime.Serialization.Formatters.Binary;
4+
#endif
5+
6+
#if NET8_0_OR_GREATER
7+
using System.Text.Json;
8+
using System.Text.Json.Serialization;
9+
10+
#endif
11+
312
using Xunit;
413

514
namespace FixedMathSharp.Tests
@@ -217,13 +226,27 @@ public void Fixed3x3_Serialization_RoundTripMaintainsData()
217226
var original3x3 = Fixed3x3.CreateRotationX(FixedMath.PiOver2); // 90 degrees
218227

219228
// Serialize the Fixed3x3 object
229+
#if NET48_OR_GREATER
220230
var formatter = new BinaryFormatter();
221231
using var stream = new MemoryStream();
222232
formatter.Serialize(stream, original3x3);
223233

224234
// Reset stream position and deserialize
225235
stream.Seek(0, SeekOrigin.Begin);
226236
var deserialized3x3 = (Fixed3x3)formatter.Deserialize(stream);
237+
#endif
238+
239+
#if NET8_0_OR_GREATER
240+
var jsonOptions = new JsonSerializerOptions
241+
{
242+
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
243+
ReferenceHandler = ReferenceHandler.IgnoreCycles,
244+
IncludeFields = true,
245+
IgnoreReadOnlyProperties = true
246+
};
247+
var json = JsonSerializer.SerializeToUtf8Bytes(original3x3, jsonOptions);
248+
var deserialized3x3 = JsonSerializer.Deserialize<Fixed3x3>(json, jsonOptions);
249+
#endif
227250

228251
// Check that deserialized values match the original
229252
Assert.Equal(original3x3, deserialized3x3);

tests/FixedMathSharp.Tests/Fixed4x4.Tests.cs

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
using System;
2-
using System.Collections.Generic;
1+
#if NET48_OR_GREATER
32
using System.IO;
4-
using System.Linq;
5-
using System.Numerics;
63
using System.Runtime.Serialization.Formatters.Binary;
7-
using System.Text;
8-
using System.Threading.Tasks;
4+
#endif
5+
6+
#if NET8_0_OR_GREATER
7+
using System.Text.Json;
8+
using System.Text.Json.Serialization;
9+
10+
#endif
11+
912
using Xunit;
1013

1114
namespace FixedMathSharp.Tests
@@ -213,7 +216,6 @@ public void FixedMatrix4x4_TRS_CreatesCorrectTransformationMatrix()
213216
var scale = new Vector3d(1, 1, 1);
214217

215218
var trsMatrix = Fixed4x4.TRS(translation, rotation, scale);
216-
Assert.True(trsMatrix != null);
217219

218220
// Verify translation
219221
Assert.Equal(new Fixed64(1), trsMatrix.m03);
@@ -278,13 +280,26 @@ public void Fixed4x4_Serialization_RoundTripMaintainsData()
278280
var original4x4 = Fixed4x4.TRS(translation, rotation, scale);
279281

280282
// Serialize the Fixed4x4 object
283+
#if NET48_OR_GREATER
281284
var formatter = new BinaryFormatter();
282285
using var stream = new MemoryStream();
283286
formatter.Serialize(stream, original4x4);
284287

285288
// Reset stream position and deserialize
286289
stream.Seek(0, SeekOrigin.Begin);
287290
var deserialized4x4 = (Fixed4x4)formatter.Deserialize(stream);
291+
#endif
292+
293+
#if NET8_0_OR_GREATER
294+
var jsonOptions = new JsonSerializerOptions {
295+
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
296+
ReferenceHandler = ReferenceHandler.IgnoreCycles,
297+
IncludeFields = true,
298+
IgnoreReadOnlyProperties = true
299+
};
300+
var json = JsonSerializer.SerializeToUtf8Bytes(original4x4, jsonOptions);
301+
var deserialized4x4 = JsonSerializer.Deserialize<Fixed4x4>(json, jsonOptions);
302+
#endif
288303

289304
// Check that deserialized values match the original
290305
Assert.Equal(original4x4, deserialized4x4);

tests/FixedMathSharp.Tests/Fixed64.Tests.cs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
using System;
2+
3+
#if NET48_OR_GREATER
24
using System.IO;
35
using System.Runtime.Serialization.Formatters.Binary;
6+
#endif
7+
8+
#if NET8_0_OR_GREATER
9+
using System.Text.Json;
10+
using System.Text.Json.Serialization;
11+
12+
#endif
13+
414
using Xunit;
515

616
namespace FixedMathSharp.Tests
@@ -120,19 +130,33 @@ public void Fixed64_Serialization_RoundTripMaintainsData()
120130
var originalValue = FixedMath.PI;
121131

122132
// Serialize the Fixed64 object
133+
#if NET48_OR_GREATER
123134
var formatter = new BinaryFormatter();
124135
using var stream = new MemoryStream();
125136
formatter.Serialize(stream, originalValue);
126137

127138
// Reset stream position and deserialize
128139
stream.Seek(0, SeekOrigin.Begin);
129140
var deserializedValue = (Fixed64)formatter.Deserialize(stream);
141+
#endif
142+
143+
#if NET8_0_OR_GREATER
144+
var jsonOptions = new JsonSerializerOptions
145+
{
146+
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
147+
ReferenceHandler = ReferenceHandler.IgnoreCycles,
148+
IncludeFields = true,
149+
IgnoreReadOnlyProperties = true
150+
};
151+
var json = JsonSerializer.SerializeToUtf8Bytes(originalValue, jsonOptions);
152+
var deserializedValue = JsonSerializer.Deserialize<Fixed64>(json, jsonOptions);
153+
#endif
130154

131155
// Check that deserialized values match the original
132156
Assert.Equal(originalValue, deserializedValue);
133157
}
134158

135-
#endregion
159+
#endregion
136160

137161
#region Test: Fraction Method
138162

tests/FixedMathSharp.Tests/FixedMathSharp.Tests.csproj

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@
66
<Nullable>enable</Nullable>
77
<IsPackable>false</IsPackable>
88
<IsTestProject>true</IsTestProject>
9-
<Configurations>Debug;Release;DebugUnity;ReleaseUnity</Configurations>
9+
<Configurations>Debug;Release;DebugUnity;ReleaseUnity;DebugNet8;ReleaseNet8</Configurations>
10+
</PropertyGroup>
11+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNet8|AnyCPU'">
12+
<TargetFramework>net8</TargetFramework>
13+
</PropertyGroup>
14+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNet8|AnyCPU'">
15+
<TargetFramework>net8</TargetFramework>
1016
</PropertyGroup>
1117
<ItemGroup>
1218
<ProjectReference Include="..\..\src\FixedMathSharp\FixedMathSharp.csproj">

tests/FixedMathSharp.Tests/FixedQuanternion.Tests.cs

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
using System;
2-
using System.Collections.Generic;
1+
#if NET48_OR_GREATER
32
using System.IO;
4-
using System.Linq;
53
using System.Runtime.Serialization.Formatters.Binary;
6-
using System.Text;
7-
using System.Threading.Tasks;
4+
#endif
5+
6+
#if NET8_0_OR_GREATER
7+
using System.Text.Json;
8+
using System.Text.Json.Serialization;
9+
10+
#endif
11+
812
using Xunit;
913

1014
namespace FixedMathSharp.Tests
@@ -203,19 +207,33 @@ public void FixedQuanternion_Serialization_RoundTripMaintainsData()
203207
var originalRotation = quaternion.Rotated(sin, cos);
204208

205209
// Serialize the FixedQuaternion object
210+
#if NET48_OR_GREATER
206211
var formatter = new BinaryFormatter();
207212
using var stream = new MemoryStream();
208213
formatter.Serialize(stream, originalRotation);
209214

210215
// Reset stream position and deserialize
211216
stream.Seek(0, SeekOrigin.Begin);
212217
var deserializedRotation = (FixedQuaternion)formatter.Deserialize(stream);
218+
#endif
219+
220+
#if NET8_0_OR_GREATER
221+
var jsonOptions = new JsonSerializerOptions
222+
{
223+
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
224+
ReferenceHandler = ReferenceHandler.IgnoreCycles,
225+
IncludeFields = true,
226+
IgnoreReadOnlyProperties = true
227+
};
228+
var json = JsonSerializer.SerializeToUtf8Bytes(originalRotation, jsonOptions);
229+
var deserializedRotation = JsonSerializer.Deserialize<FixedQuaternion>(json, jsonOptions);
230+
#endif
213231

214232
// Check that deserialized values match the original
215233
Assert.Equal(originalRotation, deserializedRotation);
216234
}
217235

218-
#endregion
236+
#endregion
219237

220238
#region Test: Lerp and Slerp
221239

0 commit comments

Comments
 (0)