Skip to content

Commit

Permalink
Add net 9 (#449)
Browse files Browse the repository at this point in the history
* Support net9.0

* Update MonoAotValidation.yml

* Update MonoAotValidation.yml

* Update MonoAotValidation.yml

* Update codecov.yml

* Update dotnet.yml

* Update stryker.yml

* Update dotnet.yml

* Fix AOT build?

* Disable trim warnings

* Update codecov.yml
  • Loading branch information
jamescourtney authored Nov 6, 2024
1 parent 334fa59 commit 9b48653
Show file tree
Hide file tree
Showing 16 changed files with 68 additions and 40 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/MonoAotValidation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Setup .NET 8
uses: actions/setup-dotnet@v1
- name: Setup .NET 9
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
dotnet-quality: preview
dotnet-version: 9.0.x

- name: Install Mono
run: sudo apt install mono-complete
Expand Down
22 changes: 14 additions & 8 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,30 @@ jobs:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
steps:
- uses: actions/checkout@v2

- name: Setup .NET 9
uses: actions/setup-dotnet@v4
with:
dotnet-quality: preview
dotnet-version: 9.0.x

- name: Setup .NET 8
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Setup .NET 7
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0.x

- name: Setup .NET 6
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x

- name: Setup .NET 5
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: 5.0.x

Expand Down Expand Up @@ -102,19 +108,19 @@ jobs:
- name: E2E Tests
working-directory: src
run: dotnet test Tests/FlatSharpEndToEndTests -c Debug -p:SignAssembly=false --collect:"XPlat Code Coverage" --settings Tests/coverlet.runsettings -f net8.0
run: dotnet test Tests/FlatSharpEndToEndTests -c Debug -p:SignAssembly=false --collect:"XPlat Code Coverage" --settings Tests/coverlet.runsettings -f net9.0

- name: E2E Tests (Poolable)
working-directory: src
run: dotnet test Tests/FlatSharpPoolableEndToEndTests -c Debug -p:SignAssembly=false --collect:"XPlat Code Coverage" --settings Tests/coverlet.runsettings -f net8.0
run: dotnet test Tests/FlatSharpPoolableEndToEndTests -c Debug -p:SignAssembly=false --collect:"XPlat Code Coverage" --settings Tests/coverlet.runsettings -f net9.0

- name: Compiler Tests
working-directory: src
run: dotnet test Tests/FlatSharpCompilerTests -c Debug -p:SignAssembly=false --collect:"XPlat Code Coverage" --settings Tests/coverlet.runsettings -f net8.0
run: dotnet test Tests/FlatSharpCompilerTests -c Debug -p:SignAssembly=false --collect:"XPlat Code Coverage" --settings Tests/coverlet.runsettings -f net9.0

- name: Stryker Tests
working-directory: src
run: dotnet test Tests/Stryker/Tests -c Debug -p:SignAssembly=false --collect:"XPlat Code Coverage" --settings Tests/coverlet.runsettings -f net8.0
run: dotnet test Tests/Stryker/Tests -c Debug -p:SignAssembly=false --collect:"XPlat Code Coverage" --settings Tests/coverlet.runsettings -f net9.0

- name: Upload
run: codecov -f **/*coverage*.xml
16 changes: 11 additions & 5 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,24 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Setup .NET 9
uses: actions/setup-dotnet@v4
with:
dotnet-quality: preview
dotnet-version: 9.0.x

- name: Setup .NET 8
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Setup .NET 7
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0.x

- name: Setup .NET 6
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x

Expand All @@ -56,8 +62,8 @@ jobs:
env:
BuildAot: 'true'
run: |
dotnet publish -c Release -f net8.0 -r ${{ matrix.rid }}
./bin/Release/net8.0/${{ matrix.rid }}/publish/FlatSharpEndToEndTests
dotnet publish -c Release -f net9.0 -r ${{ matrix.rid }}
./bin/Release/net9.0/${{ matrix.rid }}/publish/FlatSharpEndToEndTests
- name: Poolable E2E Test
working-directory: src/Tests/FlatSharpPoolableEndToEndTests
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/stryker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Setup .NET 8
uses: actions/setup-dotnet@v1
- name: Setup .NET 9
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
dotnet-quality: preview
dotnet-version: 9.0.x

- name: Install Stryker
run: dotnet tool install -g dotnet-stryker
Expand Down
4 changes: 2 additions & 2 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
</PropertyGroup>

<PropertyGroup>
<Version>7.7.0</Version>
<PackageVersion>7.7.0</PackageVersion>
<Version>7.8.0</Version>
<PackageVersion>7.8.0</PackageVersion>
<AssemblyVersion>$(Version)</AssemblyVersion>
<Authors>James Courtney</Authors>
<Description>FlatSharp is a fast, idiomatic implementation of the FlatBuffer binary format.</Description>
Expand Down
4 changes: 2 additions & 2 deletions src/FlatSharp.Compiler/FlatSharp.Compiler.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<AssemblyName>FlatSharp.Compiler</AssemblyName>
<RootNamespace>FlatSharp.Compiler</RootNamespace>
<OutputType>Exe</OutputType>
Expand All @@ -15,7 +15,7 @@
<NoWarn>$(NoWarn);CS3021;3021;NU5127</NoWarn>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
<PropertyGroup Condition=" '$(TargetFramework)' == 'net9.0' ">
<Nullable>enable</Nullable>
</PropertyGroup>

Expand Down
1 change: 1 addition & 0 deletions src/FlatSharp.Compiler/FlatSharp.Compiler.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@
<file src="$OutDir$\net6.0\**" target="tools/net6.0" />
<file src="$OutDir$\net7.0\**" target="tools/net7.0" />
<file src="$OutDir$\net8.0\**" target="tools/net8.0" />
<file src="$OutDir$\net9.0\**" target="tools/net9.0" />
</files>
</package>
7 changes: 6 additions & 1 deletion src/FlatSharp.Compiler/FlatSharp.Compiler.targets
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
</Exec>

<PropertyGroup>
<CompilerVersion>net8.0</CompilerVersion>
<CompilerVersion>net9.0</CompilerVersion>
</PropertyGroup>

<!-- try .net6.0. -->
Expand All @@ -118,6 +118,11 @@
<CompilerVersion>net8.0</CompilerVersion>
</PropertyGroup>

<!-- try .net9.0. -->
<PropertyGroup Condition=" $([System.Text.RegularExpressions.Regex]::IsMatch($(StdOut), '9\.0\.\d+')) ">
<CompilerVersion>net9.0</CompilerVersion>
</PropertyGroup>

<PropertyGroup>
<FlatSharpOutput>$(IntermediateOutputPath)</FlatSharpOutput>
<FlatSharpOutput Condition=" '$(FlatSharpMutationTestingMode)' == 'true' ">$(MSBuildProjectDirectory)/</FlatSharpOutput>
Expand Down
4 changes: 2 additions & 2 deletions src/FlatSharp.Runtime/FlatSharp.Runtime.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<AssemblyName>FlatSharp.Runtime</AssemblyName>
<RootNamespace>FlatSharp.Runtime</RootNamespace>
<Description>FlatSharp.Runtime is the runtime component of FlatSharp that supports code emitted by the FlatSharp.Compiler package.</Description>
Expand All @@ -11,7 +11,7 @@
<NoWarn>$(NoWarn);CS1591</NoWarn>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
<PropertyGroup Condition=" '$(TargetFramework)' == 'net9.0' ">
<Nullable>enable</Nullable>
<IsAotCompatible>true</IsAotCompatible>
</PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/FlatSharp/FlatSharp.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<AssemblyName>FlatSharp</AssemblyName>
<RootNamespace>FlatSharp</RootNamespace>
<Description>FlatSharp is an idiomatic C# implementation of the FlatBuffer serialization format. Use attributes to declare your data contracts!</Description>
Expand All @@ -11,7 +11,7 @@
<NoWarn>$(NoWarn);NETSDK1023;NU5104</NoWarn>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
<PropertyGroup Condition=" '$(TargetFramework)' == 'net9.0' ">
<Nullable>enable</Nullable>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<PlatformTarget>x64</PlatformTarget>
<AssemblyName>FlatSharpCompilerTests</AssemblyName>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<NeedsFlatSharpCompiler>true</NeedsFlatSharpCompiler>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(PipelineBuild)' == 'true' and '$([MSBuild]::IsOSUnixLike())' != 'true' ">net472;net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(PipelineBuild)' == 'true' and '$([MSBuild]::IsOSUnixLike())' == 'true' ">net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>net9.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(PipelineBuild)' == 'true' and '$([MSBuild]::IsOSUnixLike())' != 'true' ">net472;net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(PipelineBuild)' == 'true' and '$([MSBuild]::IsOSUnixLike())' == 'true' ">net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<AssemblyName>FlatSharpEndToEndTests</AssemblyName>
<RootNamespace>FlatSharpTests</RootNamespace>
Expand All @@ -19,7 +19,7 @@

<PropertyGroup Condition=" '$(BuildAot)' == 'true' ">
<PublishAot>true</PublishAot>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net9.0</TargetFrameworks>
<StartupObject>FlatSharpEndToEndTests.Program</StartupObject>
<OutputType>exe</OutputType>
<DefineConstants>$(DefineConstants);AOT</DefineConstants>
Expand Down
10 changes: 9 additions & 1 deletion src/Tests/FlatSharpEndToEndTests/Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -304,16 +304,24 @@ public static void ValidateListVector<T>(
}
}

public static T TestProgressiveFieldLoad<P, T>(int index, bool expected, P parent, Func<P, T> getter)
public static T TestProgressiveFieldLoad<P, T>(
int index,
bool expected,
P parent,
Func<P, T> getter)
{
IFlatBufferDeserializedObject obj = (IFlatBufferDeserializedObject)parent;

int maskNum = index / 8;
byte bitMask = (byte)(1 << (index % 8));

#pragma warning disable IL2075

FieldInfo mask = parent.GetType().GetField($"__mask{maskNum}", BindingFlags.NonPublic | BindingFlags.Instance);
FieldInfo vtable = parent.GetType().GetField("__vtable", BindingFlags.NonPublic | BindingFlags.Instance);

#pragma warning restore IL2075

bool IsFieldLoaded()
{
byte value = (byte)mask.GetValue(parent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<NeedsFlatSharpCompiler>true</NeedsFlatSharpCompiler>
<PipelineBuild>false</PipelineBuild>
<PipelineBuild Condition=" '$(AppVeyorBuild)' == 'true' or '$(CoverageBuild)' == 'true' ">true</PipelineBuild>
<TargetFrameworks>net7.0;net6.0;net8.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(PipelineBuild)' == 'true' and '$([MSBuild]::IsOSUnixLike())' != 'true' ">net472;net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(PipelineBuild)' == 'true' and '$([MSBuild]::IsOSUnixLike())' == 'true' ">net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(CoverageBuild)' == 'true' ">net8.0</TargetFrameworks>
<TargetFrameworks>net7.0;net6.0;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(PipelineBuild)' == 'true' and '$([MSBuild]::IsOSUnixLike())' != 'true' ">net472;net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(PipelineBuild)' == 'true' and '$([MSBuild]::IsOSUnixLike())' == 'true' ">net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(CoverageBuild)' == 'true' ">net9.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<AssemblyName>PoolingTests</AssemblyName>
<RootNamespace>FlatSharpTests</RootNamespace>
Expand Down
2 changes: 1 addition & 1 deletion src/Tests/Stryker/CodeGen/CodeGen.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<NeedsFlatSharpCompiler>true</NeedsFlatSharpCompiler>
<FlatSharpMutationTestingMode>true</FlatSharpMutationTestingMode>
<AssemblyName>StrykerTestsCodeGen</AssemblyName>
Expand Down
2 changes: 1 addition & 1 deletion src/Tests/Stryker/Tests/StrykerTests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<IsPackable>false</IsPackable>
<AssemblyName>FlatSharpStrykerTests</AssemblyName>
<RootNamespace>FlatSharpStrykerTests</RootNamespace>
Expand Down

0 comments on commit 9b48653

Please sign in to comment.