Target .NET Standard 2.1, .NET 6, .NET 8 only (#8184)

* Target .NET Standard 2.1, .NET 6, .NET 8 only

* Remove mono usage

* Fix bat name ref

* Up deps

* Up deps

* Reinstate build-windows

* Fix name

---------

Co-authored-by: Derek Bailey <derekbailey@google.com>
This commit is contained in:
Björn Harrtell
2023-12-19 23:43:55 +01:00
committed by GitHub
parent e5fc3b16d8
commit 129ef422e8
15 changed files with 109 additions and 449 deletions

View File

@@ -1,203 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Properties\AssemblyInfo.cs" />
</ItemGroup>
<PropertyGroup Condition="'$(UnsafeByteBuffer)' == 'true'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>$(DefineConstants);UNSAFE_BYTEBUFFER</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(EnableSpanT)' == 'true'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>$(DefineConstants);ENABLE_SPAN_T</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\net\FlatBuffers\ByteBuffer.cs">
<Link>FlatBuffers\ByteBuffer.cs</Link>
</Compile>
<Compile Include="..\..\net\FlatBuffers\ByteBufferUtil.cs">
<Link>FlatBuffers\ByteBufferUtil.cs</Link>
</Compile>
<Compile Include="..\..\net\FlatBuffers\IFlatbufferObject.cs">
<Link>FlatBuffers\IFlatbufferObject.cs</Link>
</Compile>
<Compile Include="..\..\net\FlatBuffers\Offset.cs">
<Link>FlatBuffers\Offset.cs</Link>
</Compile>
<Compile Include="..\..\net\FlatBuffers\FlatBufferBuilder.cs">
<Link>FlatBuffers\FlatBufferBuilder.cs</Link>
</Compile>
<Compile Include="..\..\net\FlatBuffers\FlatBufferConstants.cs">
<Link>FlatBuffers\FlatBufferConstants.cs</Link>
</Compile>
<Compile Include="..\..\net\FlatBuffers\FlatBufferVerify.cs">
<Link>FlatBuffers\FlatBufferVerify.cs</Link>
</Compile>
<Compile Include="..\..\net\FlatBuffers\Struct.cs">
<Link>FlatBuffers\Struct.cs</Link>
</Compile>
<Compile Include="..\..\net\FlatBuffers\Table.cs">
<Link>FlatBuffers\Table.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example2\Monster.cs">
<Link>MyGame\Example2\Monster.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\Any.cs">
<Link>MyGame\Example\Any.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\AnyAmbiguousAliases.cs">
<Link>MyGame\Example\AnyAmbiguousAliases.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\AnyUniqueAliases.cs">
<Link>MyGame\Example\AnyUniqueAliases.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\Color.cs">
<Link>MyGame\Example\Color.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\Race.cs">
<Link>MyGame\Example\Race.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\Monster.cs">
<Link>MyGame\Example\Monster.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\Referrable.cs">
<Link>MyGame\Example\Referrable.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\Stat.cs">
<Link>MyGame\Example\Stat.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\Test.cs">
<Link>MyGame\Example\Test.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\TestSimpleTableWithEnum.cs">
<Link>MyGame\Example\TestSimpleTableWithEnum.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\TypeAliases.cs">
<Link>MyGame\Example\TypeAliases.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\Vec3.cs">
<Link>MyGame\Example\Vec3.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\Ability.cs">
<Link>MyGame\Example\Ability.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\ArrayTable.cs">
<Link>MyGame\Example\ArrayTable.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\ArrayStruct.cs">
<Link>MyGame\Example\ArrayStruct.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\NestedStruct.cs">
<Link>MyGame\Example\NestedStruct.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\LongEnum.cs">
<Link>MyGame\Example\LongEnum.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\TestEnum.cs">
<Link>MyGame\Example\TestEnum.cs</Link>
</Compile>
<Compile Include="..\MyGame\InParentNamespace.cs">
<Link>MyGame\InParentNamespace.cs</Link>
</Compile>
<Compile Include="..\namespace_test\NamespaceA\NamespaceB\EnumInNestedNS.cs">
<Link>NamespaceA\NamespaceB\EnumInNestedNS.cs</Link>
</Compile>
<Compile Include="..\namespace_test\NamespaceA\NamespaceB\StructInNestedNS.cs">
<Link>NamespaceA\NamespaceB\StructInNestedNS.cs</Link>
</Compile>
<Compile Include="..\namespace_test\NamespaceA\NamespaceB\TableInNestedNS.cs">
<Link>NamespaceA\NamespaceB\TableInNestedNS.cs</Link>
</Compile>
<Compile Include="..\namespace_test\NamespaceA\NamespaceB\UnionInNestedNS.cs">
<Link>NamespaceA\NamespaceB\UnionInNestedNS.cs</Link>
</Compile>
<Compile Include="..\namespace_test\NamespaceA\TableInFirstNS.cs">
<Link>NamespaceA\TableInFirstNS.cs</Link>
</Compile>
<Compile Include="..\union_vector\Attacker.cs">
<Link>union_vector\Attacker.cs</Link>
</Compile>
<Compile Include="..\union_vector\BookReader.cs">
<Link>union_vector\BookReader.cs</Link>
</Compile>
<Compile Include="..\union_vector\Character.cs">
<Link>union_vector\Character.cs</Link>
</Compile>
<Compile Include="..\union_vector\Movie.cs">
<Link>union_vector\Movie.cs</Link>
</Compile>
<Compile Include="..\union_vector\Rapunzel.cs">
<Link>union_vector\Rapunzel.cs</Link>
</Compile>
<Compile Include="..\optional_scalars\OptionalByte.cs">
<Link>optional_scalars\OptionalByte.cs</Link>
</Compile>
<Compile Include="..\optional_scalars\ScalarStuff.cs">
<Link>optional_scalars\ScalarStuff.cs</Link>
</Compile>
<Compile Include="..\KeywordTest\ABC.cs">
<Link>KeywordTest\ABC.cs</Link>
</Compile>
<Compile Include="..\KeywordTest\public.cs">
<Link>KeywordTest\public.cs</Link>
</Compile>
<Compile Include="..\KeywordTest\KeywordsInTable.cs">
<Link>KeywordTest\KeywordsInTable.cs</Link>
</Compile>
<Compile Include="..\KeywordTest\KeywordsInUnion.cs">
<Link>KeywordTest\KeywordsInUnion.cs</Link>
</Compile>
<Compile Include="..\nested_namespace_test\nested_namespace_test1_generated.cs">
<Link>nested_namespace_test\nested_namespace_test1_generated.cs</Link>
</Compile>
<Compile Include="..\nested_namespace_test\nested_namespace_test2_generated.cs">
<Link>nested_namespace_test\nested_namespace_test2_generated.cs</Link>
</Compile>
<Compile Include="..\nested_namespace_test\nested_namespace_test3_generated.cs">
<Link>nested_namespace_test\nested_namespace_test3_generated.cs</Link>
</Compile>
<Compile Include="..\union_value_collsion\union_value_collision_generated.cs">
<Link>union_value_collsion\union_value_collision_generated.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<None Remove=".gitignore" />
<None Remove="clean.sh" />
<None Remove="NetTest.sh" />
<None Remove="packages.config" />
<None Remove="README.md" />
</ItemGroup>
<ItemGroup>
<Content Include="..\monsterdata_test.mon">
<Link>Resources\monsterdata_test.mon</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\monsterdata_test.json">
<Link>Resources\monsterdata_test.json</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>
</Project>

View File

@@ -1,52 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{9DB0B5E7-757E-4BD1-A5F6-279390331254}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>FlatBuffers.Test</RootNamespace>
<AssemblyName>FlatBuffers.Test</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<RuntimeIdentifier>win</RuntimeIdentifier>
<LangVersion>4</LangVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Properties\AssemblyInfo.cs" />
</ItemGroup>
<PropertyGroup Condition="'$(UnsafeByteBuffer)' == 'true'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>$(DefineConstants);UNSAFE_BYTEBUFFER</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core">
</Reference>
</ItemGroup>
<PropertyGroup Condition="'$(EnableSpanT)' == 'true'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>$(DefineConstants);ENABLE_SPAN_T</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\net\FlatBuffers\ByteBuffer.cs">
<Link>FlatBuffers\ByteBuffer.cs</Link>
@@ -123,12 +103,12 @@
<Compile Include="..\MyGame\Example\ArrayStruct.cs">
<Link>MyGame\Example\ArrayStruct.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\LongEnum.cs">
<Link>MyGame\Example\LongEnum.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\NestedStruct.cs">
<Link>MyGame\Example\NestedStruct.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\LongEnum.cs">
<Link>MyGame\Example\LongEnum.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\TestEnum.cs">
<Link>MyGame\Example\TestEnum.cs</Link>
</Compile>
@@ -192,19 +172,19 @@
<Compile Include="..\nested_namespace_test\nested_namespace_test3_generated.cs">
<Link>nested_namespace_test\nested_namespace_test3_generated.cs</Link>
</Compile>
<Compile Include="Assert.cs" />
<Compile Include="ByteBufferTests.cs" />
<Compile Include="FlatBufferBuilderTests.cs" />
<Compile Include="FlatBuffersFuzzTests.cs" />
<Compile Include="FlatBuffersTestClassAttribute.cs" />
<Compile Include="FlatBuffersTestMethodAttribute.cs" />
<Compile Include="FuzzTestData.cs" />
<Compile Include="Lcg.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="FlatBuffersExampleTests.cs" />
<Compile Include="TestTable.cs" />
<Compile Include="..\union_value_collsion\union_value_collision_generated.cs">
<Link>union_value_collsion\union_value_collision_generated.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<None Remove=".gitignore" />
<None Remove="clean.sh" />
<None Remove="NetTest.sh" />
<None Remove="packages.config" />
<None Remove="README.md" />
</ItemGroup>
<ItemGroup>
<Content Include="..\monsterdata_test.mon">
<Link>Resources\monsterdata_test.mon</Link>
@@ -215,15 +195,9 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -4,8 +4,8 @@
set TEMP_BIN=.tmp
@REM Run the .NET Core tests
set CORE_FILE=FlatBuffers.Core.Test
@REM Run the .NET tests
set CORE_FILE=FlatBuffers.Test
set CORE_PROJ_FILE=%CORE_FILE%.csproj
set CORE_SLN_FILE=%CORE_FILE%.sln
dotnet new sln --force --name %CORE_FILE%

View File

@@ -1,7 +1,6 @@
#!/bin/sh
PROJ_FILE=FlatBuffers.Test.csproj
CORE_PROJ_FILE=FlatBuffers.Core.Test.csproj
TEMP_DOTNET_DIR=.dotnet_tmp
TEMP_BIN=.tmp
@@ -18,37 +17,20 @@ $DOTNET new sln
$DOTNET sln add $PROJ_FILE
$DOTNET restore -r linux-x64 $PROJ_FILE
# Testing C# on Linux using Mono.
# Testing with default options.
msbuild -property:Configuration=Release,OutputPath=$TEMP_BIN -verbosity:quiet $PROJ_FILE
mono $TEMP_BIN/FlatBuffers.Test.exe
$TEMP_BIN/FlatBuffers.Core.Test.exe
rm -fr $TEMP_BIN
# Repeat with unsafe versions
msbuild -property:Configuration=Release,UnsafeByteBuffer=true,OutputPath=$TEMP_BIN -verbosity:quiet $PROJ_FILE
mono $TEMP_BIN/FlatBuffers.Test.exe
rm -fr $TEMP_BIN
rm FlatBuffers.Test.sln
rm -rf obj
$DOTNET new sln
$DOTNET sln add $CORE_PROJ_FILE
$DOTNET restore -r linux-x64 $CORE_PROJ_FILE
# Testing C# on Linux using .Net Core.
msbuild -property:Configuration=Release,OutputPath=$TEMP_BIN -verbosity:quiet $CORE_PROJ_FILE
$TEMP_BIN/FlatBuffers.Core.Test.exe
rm -fr $TEMP_BIN
# Repeat with unsafe versions
msbuild -property:Configuration=Release,UnsafeByteBuffer=true,OutputPath=$TEMP_BIN -verbosity:quiet $CORE_PROJ_FILE
$TEMP_BIN/FlatBuffers.Core.Test.exe
rm -fr $TEMP_BIN
# Repeat with SpanT versions
msbuild -property:Configuration=Release,EnableSpanT=true,OutputPath=$TEMP_BIN -verbosity:quiet $CORE_PROJ_FILE
msbuild -property:Configuration=Release,EnableSpanT=true,OutputPath=$TEMP_BIN -verbosity:quiet $PROJ_FILE
$TEMP_BIN/FlatBuffers.Core.Test.exe
rm -fr $TEMP_BIN
rm FlatBuffers.Core.Test.sln
rm FlatBuffers.Test.sln
rm -rf obj

Binary file not shown.

Binary file not shown.

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net35" />
</packages>
<package id="Newtonsoft.Json" version="13.0.3" />
</packages>