Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Net8 #412

Merged
merged 11 commits into from
Dec 2, 2023
Merged

Net8 #412

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/charp8build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ jobs:
AppVeyorBuild: true
steps:
- uses: actions/checkout@v2

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

- name: Setup .NET 7
uses: actions/setup-dotnet@v1
Expand Down
25 changes: 15 additions & 10 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ jobs:
steps:
- uses: actions/checkout@v2

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

- name: Setup .NET 7
uses: actions/setup-dotnet@v1
with:
Expand Down Expand Up @@ -53,13 +58,13 @@ jobs:
script: |
$fbs = (gci -r src/tests/FlatsharpEndToEndTests/*.fbs) -join ";"
coverlet `
.\src\FlatSharp.Compiler\bin\Debug\net7.0 `
.\src\FlatSharp.Compiler\bin\Debug\net8.0 `
--skipautoprops `
--use-source-link `
--format opencover `
--target "dotnet" `
--output e2etests.coverage.xml `
--targetargs "src\FlatSharp.Compiler\bin\Debug\net7.0\FlatSharp.Compiler.dll --nullable-warnings false --normalize-field-names true --input `"$fbs`" -o src/tests/FlatSharpEndToEndTests"
--targetargs "src\FlatSharp.Compiler\bin\Debug\net8.0\FlatSharp.Compiler.dll --nullable-warnings false --normalize-field-names true --input `"$fbs`" -o src/tests/FlatSharpEndToEndTests"

- name: Run FlatSharp.Compiler (Pooling Tests)
# You may pin to the exact commit or the version.
Expand All @@ -70,13 +75,13 @@ jobs:
script: |
$fbs = (gci -r src/tests/FlatSharpPoolableEndToEndTests/*.fbs) -join ";"
coverlet `
.\src\FlatSharp.Compiler\bin\Debug\net7.0 `
.\src\FlatSharp.Compiler\bin\Debug\net8.0 `
--skipautoprops `
--use-source-link `
--format opencover `
--target "dotnet" `
--output pooling.coverage.xml `
--targetargs "src\FlatSharp.Compiler\bin\Debug\net7.0\FlatSharp.Compiler.dll --nullable-warnings false --normalize-field-names true --gen-poolable true --input `"$fbs`" -o src/tests/FlatSharpPoolableEndToEndTests"
--targetargs "src\FlatSharp.Compiler\bin\Debug\net8.0\FlatSharp.Compiler.dll --nullable-warnings false --normalize-field-names true --gen-poolable true --input `"$fbs`" -o src/tests/FlatSharpPoolableEndToEndTests"

- name: Run FlatSharp.Compiler (Stryker Tests)
# You may pin to the exact commit or the version.
Expand All @@ -87,29 +92,29 @@ jobs:
script: |
$fbs = (gci -r src/tests/Stryker/*.fbs) -join ";"
coverlet `
.\src\FlatSharp.Compiler\bin\Debug\net7.0 `
.\src\FlatSharp.Compiler\bin\Debug\net8.0 `
--skipautoprops `
--use-source-link `
--format opencover `
--target "dotnet" `
--output stryker.coverage.xml `
--targetargs "src/FlatSharp.Compiler/bin/Debug/net7.0/FlatSharp.Compiler.dll --nullable-warnings false --normalize-field-names true --input `"$fbs`" -o src/tests/Stryker/CodeGen --mutation-testing-mode"
--targetargs "src/FlatSharp.Compiler/bin/Debug/net8.0/FlatSharp.Compiler.dll --nullable-warnings false --normalize-field-names true --input `"$fbs`" -o src/tests/Stryker/CodeGen --mutation-testing-mode"

- 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 net7.0
run: dotnet test Tests/FlatSharpEndToEndTests -c Debug -p:SignAssembly=false --collect:"XPlat Code Coverage" --settings Tests/coverlet.runsettings -f net8.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 net7.0
run: dotnet test Tests/FlatSharpPoolableEndToEndTests -c Debug -p:SignAssembly=false --collect:"XPlat Code Coverage" --settings Tests/coverlet.runsettings -f net8.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 net7.0
run: dotnet test Tests/FlatSharpCompilerTests -c Debug -p:SignAssembly=false --collect:"XPlat Code Coverage" --settings Tests/coverlet.runsettings -f net8.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 net7.0
run: dotnet test Tests/Stryker/Tests -c Debug -p:SignAssembly=false --collect:"XPlat Code Coverage" --settings Tests/coverlet.runsettings -f net8.0

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

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

- name: Setup .NET 7
uses: actions/setup-dotnet@v1
with:
Expand All @@ -44,7 +49,7 @@ jobs:
# PowerShell script to execute in Actions-hydrated context
script: |
$fbs = (gci -r src/Tests/FlatSharpEndToEndTests/*.fbs) -join ";"
dotnet src/FlatSharp.Compiler/bin/Release/net7.0/FlatSharp.Compiler.dll --nullable-warnings false --normalize-field-names true --input "$fbs" -o src/Tests/FlatSharpEndToEndTests
dotnet src/FlatSharp.Compiler/bin/Release/net8.0/FlatSharp.Compiler.dll --nullable-warnings false --normalize-field-names true --input "$fbs" -o src/Tests/FlatSharpEndToEndTests

- name: Run FlatSharp.Compiler (Pooling Tests)
# You may pin to the exact commit or the version.
Expand All @@ -54,7 +59,7 @@ jobs:
# PowerShell script to execute in Actions-hydrated context
script: |
$fbs = (gci -r src/Tests/FlatSharpPoolableEndToEndTests/*.fbs) -join ";"
dotnet src/FlatSharp.Compiler/bin/Release/net7.0/FlatSharp.Compiler.dll --nullable-warnings false --normalize-field-names true --gen-poolable true --input "$fbs" -o src/Tests/FlatSharpPoolableEndToEndTests
dotnet src/FlatSharp.Compiler/bin/Release/net8.0/FlatSharp.Compiler.dll --nullable-warnings false --normalize-field-names true --gen-poolable true --input "$fbs" -o src/Tests/FlatSharpPoolableEndToEndTests

- name: Build
working-directory: src
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/stryker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
steps:
- uses: actions/checkout@v2

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

- name: Install Stryker
run: dotnet tool install -g dotnet-stryker
Expand All @@ -35,7 +35,7 @@ jobs:
# PowerShell script to execute in Actions-hydrated context
script: |
$fbs = (gci -r src/tests/Stryker/*.fbs) -join ";"
dotnet src/FlatSharp.Compiler/bin/Release/net7.0/FlatSharp.Compiler.dll --nullable-warnings false --normalize-field-names true --input "$fbs" -o src/tests/Stryker/CodeGen --mutation-testing-mode
dotnet src/FlatSharp.Compiler/bin/Release/net8.0/FlatSharp.Compiler.dll --nullable-warnings false --normalize-field-names true --input "$fbs" -o src/tests/Stryker/CodeGen --mutation-testing-mode
- name: Build
working-directory: src/Tests/Stryker/Tests
Expand Down
34 changes: 0 additions & 34 deletions src/Benchmarks/Benchmark.6.0.0/Benchmark.6.0.0.csproj

This file was deleted.

12 changes: 6 additions & 6 deletions src/Benchmarks/Benchmark/Benchmark.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net7.0</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
<DelaySign>false</DelaySign>
<SignAssembly>false</SignAssembly>
<DefineConstants>$(DefineContants);CURRENT_VERSION_ONLY;FLATSHARP_7_0_0_OR_GREATER;RUN_COMPARISON_BENCHMARKS</DefineConstants>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.2" />
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.13.2" />
<PackageReference Include="MessagePack" Version="2.4.35" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="protobuf-net" Version="3.1.22" />
<PackageReference Include="BenchmarkDotNet" Version="0.13.10" />
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.13.10" />
<PackageReference Include="MessagePack" Version="2.5.140" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="protobuf-net" Version="3.2.30" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net7.0</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
<DelaySign>false</DelaySign>
<SignAssembly>false</SignAssembly>
<!--<PublishAot>true</PublishAot>-->
<IsPackable>false</IsPackable>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<FlatSharpCompilerPath>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)\..\..\FlatSharp.Compiler\bin\$(Configuration)\net7.0\FlatSharp.Compiler.dll'))</FlatSharpCompilerPath>
<FlatSharpCompilerPath>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)\..\..\FlatSharp.Compiler\bin\$(Configuration)\net8.0\FlatSharp.Compiler.dll'))</FlatSharpCompilerPath>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.2" />
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.13.2" />
<PackageReference Include="BenchmarkDotNet" Version="0.13.10" />
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.13.10" />
</ItemGroup>

<ItemGroup>
Expand Down
10 changes: 5 additions & 5 deletions src/Benchmarks/MicroBench.Current/Microbench.Current.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<DelaySign>false</DelaySign>
<SignAssembly>false</SignAssembly>
<Nullable>enable</Nullable>
<DefineConstants>$(DefineConstants);PUBLIC_IVTABLE;VECTOR_VISITORS</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<FlatSharpCompilerPath>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)\..\..\FlatSharp.Compiler\bin\$(Configuration)\net7.0\FlatSharp.Compiler.dll'))</FlatSharpCompilerPath>
<FlatSharpCompilerPath>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)\..\..\FlatSharp.Compiler\bin\$(Configuration)\net8.0\FlatSharp.Compiler.dll'))</FlatSharpCompilerPath>
<FlatSharpPoolable>false</FlatSharpPoolable>
<FlatSharpNullable>false</FlatSharpNullable>
</PropertyGroup>
Expand All @@ -19,9 +19,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.2" />
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.13.2" />
<PackageReference Include="Grpc" Version="2.46.5" />
<PackageReference Include="BenchmarkDotNet" Version="0.13.10" />
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.13.10" />
<PackageReference Include="Grpc" Version="2.46.6" />
<PackageReference Include="System.IO.FileSystem.Primitives" Version="4.3.0" />
<PackageReference Include="System.Runtime.InteropServices" Version="4.3.0" />
</ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/FlatSharp.Compiler/FlatSharp.Compiler.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Import Project="..\common.props" />

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<AssemblyName>FlatSharp.Compiler</AssemblyName>
<RootNamespace>FlatSharp.Compiler</RootNamespace>
<OutputType>Exe</OutputType>
Expand All @@ -16,7 +16,7 @@
<NoWarn>$(NoWarn);CS3021;3021;NU5127</NoWarn>
</PropertyGroup>

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

Expand Down
2 changes: 2 additions & 0 deletions src/FlatSharp.Compiler/FlatSharp.Compiler.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@
<file src="FlatSharp.Compiler.targets" target="tools/" />

<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" />
</files>
</package>
26 changes: 25 additions & 1 deletion src/FlatSharp.Compiler/FlatSharp.Compiler.targets
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,34 @@
<ProcessFlatSharpSchema Inputs="@(FlatSharpSchema)">
<Output TaskParameter="IncludeDirectories" PropertyName="Includes" />
</ProcessFlatSharpSchema>

<!-- Query the installed SDKs. -->
<Exec Command="dotnet --list-sdks" ConsoleToMsBuild="false">
<Output TaskParameter="ConsoleOutput" PropertyName="StdOut" />
</Exec>

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

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

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

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

<!-- find compiler and set base command -->
<PropertyGroup>
<CompilerPath>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)\..\tools\net6.0\FlatSharp.Compiler.dll'))</CompilerPath>
<CompilerPath>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)\..\tools\$(CompilerVersion)\FlatSharp.Compiler.dll'))</CompilerPath>
<CompilerPath Condition=" '$(FlatSharpCompilerPath)' != '' ">$(FlatSharpCompilerPath)</CompilerPath>
<CompilerCommand>dotnet &quot;$(CompilerPath)&quot; --input &quot;@(FlatSharpSchema)&quot; --includes &quot;$(Includes)&quot; --output $(IntermediateOutputPath)</CompilerCommand>
</PropertyGroup>
Expand Down
4 changes: 3 additions & 1 deletion src/FlatSharp.Compiler/SchemaModel/ValueUnionSchemaModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,9 @@ private void WriteConstructor(CodeWriter writer, string resolvedType, EnumVal un
using (writer.WithBlock())
{
writer.AppendLine($"var localSpan = new Span<byte>(pByte, {propertyType.StructLayoutAttribute.Size});");
writer.AppendLine($"System.Runtime.InteropServices.MemoryMarshal.Write(localSpan, ref value);");
writer.BeginPreprocessorIf(CSharpHelpers.Net8PreprocessorVariable, "System.Runtime.InteropServices.MemoryMarshal.Write(localSpan, in value);")
.Else("System.Runtime.InteropServices.MemoryMarshal.Write(localSpan, ref value);")
.Flush();
}
}
else
Expand Down
4 changes: 2 additions & 2 deletions src/FlatSharp.Runtime/FlatSharp.Runtime.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Import Project="..\common.props" />

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net7.0;net8.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 @@ -12,7 +12,7 @@
<NoWarn>$(NoWarn);CS1591</NoWarn>
</PropertyGroup>

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

Expand Down
7 changes: 0 additions & 7 deletions src/FlatSharp.sln
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Google.FlatBuffers", "Googl
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FlatSharpEndToEndTests", "Tests\FlatSharpEndToEndTests\FlatSharpEndToEndTests.csproj", "{E6B5266D-A983-4A9C-BA2D-85AE1B7CEF07}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Benchmark.6.0.0", "Benchmarks\Benchmark.6.0.0\Benchmark.6.0.0.csproj", "{F9C48012-AB11-4541-911C-BAF2B0B1158B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MicroBench", "MicroBench", "{927A2D53-B127-4297-B17A-4E4EEE7ACD0D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microbench.Current", "Benchmarks\MicroBench.Current\Microbench.Current.csproj", "{5A173CC8-53B4-445B-9AA2-68A61A4BE449}"
Expand Down Expand Up @@ -71,10 +69,6 @@ Global
{E6B5266D-A983-4A9C-BA2D-85AE1B7CEF07}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E6B5266D-A983-4A9C-BA2D-85AE1B7CEF07}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E6B5266D-A983-4A9C-BA2D-85AE1B7CEF07}.Release|Any CPU.Build.0 = Release|Any CPU
{F9C48012-AB11-4541-911C-BAF2B0B1158B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F9C48012-AB11-4541-911C-BAF2B0B1158B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F9C48012-AB11-4541-911C-BAF2B0B1158B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F9C48012-AB11-4541-911C-BAF2B0B1158B}.Release|Any CPU.Build.0 = Release|Any CPU
{5A173CC8-53B4-445B-9AA2-68A61A4BE449}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5A173CC8-53B4-445B-9AA2-68A61A4BE449}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5A173CC8-53B4-445B-9AA2-68A61A4BE449}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -96,7 +90,6 @@ Global
{BD1950AE-7A04-4677-AD81-35F512D45112} = {83478353-8C5A-41C2-84C2-F79488B43CB0}
{A72F5D45-6AAF-40F7-AB73-1F4E33CE9A9D} = {D1E90BAE-FC51-44DB-8215-1D9BB6059886}
{E6B5266D-A983-4A9C-BA2D-85AE1B7CEF07} = {D1E90BAE-FC51-44DB-8215-1D9BB6059886}
{F9C48012-AB11-4541-911C-BAF2B0B1158B} = {83478353-8C5A-41C2-84C2-F79488B43CB0}
{927A2D53-B127-4297-B17A-4E4EEE7ACD0D} = {83478353-8C5A-41C2-84C2-F79488B43CB0}
{5A173CC8-53B4-445B-9AA2-68A61A4BE449} = {927A2D53-B127-4297-B17A-4E4EEE7ACD0D}
{7E55A248-4BBD-48AD-B27D-A7E0E705DC89} = {D1E90BAE-FC51-44DB-8215-1D9BB6059886}
Expand Down
Loading
Loading