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

[C#] Prepares for official Nuget release #7496

Merged
merged 5 commits into from Sep 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion net/FlatBuffers/ByteBuffer.cs
Expand Up @@ -51,7 +51,7 @@
#warning ENABLE_SPAN_T requires UNSAFE_BYTEBUFFER to also be defined
#endif

namespace FlatBuffers
namespace Google.FlatBuffers
{
public abstract class ByteBufferAllocator
{
Expand Down
2 changes: 1 addition & 1 deletion net/FlatBuffers/ByteBufferUtil.cs
Expand Up @@ -16,7 +16,7 @@

using System;

namespace FlatBuffers
namespace Google.FlatBuffers
{
/// <summary>
/// Class that collects utility functions around `ByteBuffer`.
Expand Down
2 changes: 1 addition & 1 deletion net/FlatBuffers/FlatBufferBuilder.cs
Expand Up @@ -23,7 +23,7 @@
/// @addtogroup flatbuffers_csharp_api
/// @{

namespace FlatBuffers
namespace Google.FlatBuffers
{
/// <summary>
/// Responsible for building up and accessing a FlatBuffer formatted byte
Expand Down
2 changes: 1 addition & 1 deletion net/FlatBuffers/FlatBufferConstants.cs
Expand Up @@ -19,7 +19,7 @@
using System.Linq;
using System.Text;

namespace FlatBuffers
namespace Google.FlatBuffers
{
public static class FlatBufferConstants
{
Expand Down
23 changes: 0 additions & 23 deletions net/FlatBuffers/FlatBuffers.csproj

This file was deleted.

46 changes: 46 additions & 0 deletions net/FlatBuffers/Google.FlatBuffers.csproj
@@ -0,0 +1,46 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<TargetFrameworks>netstandard2.1;netstandard2.0;net46</TargetFrameworks>
<Description>A cross-platform memory efficient serialization library</Description>
<PackageVersion>2.0.8-beta.1</PackageVersion>
<Authors>Google LLC</Authors>
<PackageProjectUrl>https://github.com/google/flatbuffers</PackageProjectUrl>
<RepositoryUrl>https://github.com/google/flatbuffers</RepositoryUrl>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
<PackageIcon>flatbuffers.png</PackageIcon>
<PackageTags>Google;FlatBuffers;Serialization;Buffer;Binary;zero copy</PackageTags>
<Copyright>Copyright 2022 Google LLC</Copyright>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>flatbuffers.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
</PropertyGroup>

<PropertyGroup Condition="'$(UNSAFE_BYTEBUFFER)' == 'true'">
<DefineConstants>$(DefineConstants);UNSAFE_BYTEBUFFER</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(BYTEBUFFER_NO_BOUNDS_CHECK)' == 'true'">
<DefineConstants>$(DefineConstants);BYTEBUFFER_NO_BOUNDS_CHECK</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(ENABLE_SPAN_T)' == 'true'">
<DefineConstants>$(DefineConstants);ENABLE_SPAN_T</DefineConstants>
</PropertyGroup>

<ItemGroup Condition="('$(ENABLE_SPAN_T)' == 'true') And (('$(TargetFramework)' == 'netstandard2.0') Or ('$(TargetFramework)' == 'net46'))">
<PackageReference Include="System.Memory" Version="4.5.4" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<None Include="..\..\LICENSE.txt" Pack="true" PackagePath="" />
<None Include="flatbuffers.png" Pack="true" PackagePath="" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion net/FlatBuffers/IFlatbufferObject.cs
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

namespace FlatBuffers
namespace Google.FlatBuffers
{
/// <summary>
/// This is the base for both structs and tables.
Expand Down
2 changes: 1 addition & 1 deletion net/FlatBuffers/Offset.cs
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

namespace FlatBuffers
namespace Google.FlatBuffers
{
/// <summary>
/// Offset class for typesafe assignments.
Expand Down
52 changes: 0 additions & 52 deletions net/FlatBuffers/Properties/AssemblyInfo.cs

This file was deleted.

2 changes: 1 addition & 1 deletion net/FlatBuffers/Struct.cs
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

namespace FlatBuffers
namespace Google.FlatBuffers
{
/// <summary>
/// All structs in the generated code derive from this class, and add their own accessors.
Expand Down
2 changes: 1 addition & 1 deletion net/FlatBuffers/Table.cs
Expand Up @@ -18,7 +18,7 @@
using System.Text;
using System.Runtime.InteropServices;

namespace FlatBuffers
namespace Google.FlatBuffers
{
/// <summary>
/// All tables in the generated code derive from this struct, and add their own accessors.
Expand Down
Binary file added net/FlatBuffers/flatbuffers.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added net/FlatBuffers/flatbuffers.snk
Binary file not shown.
2 changes: 1 addition & 1 deletion scripts/generate_code.py
Expand Up @@ -226,7 +226,7 @@ def glob(path, pattern):
# For Rust we currently generate two independent schemas, with namespace_test2
# duplicating the types in namespace_test1
flatc(
RUST_OPTS,
RUST_OPTS + CS_OPTS,
prefix="namespace_test",
schema=[
"namespace_test/namespace_test1.fbs",
Expand Down
14 changes: 8 additions & 6 deletions src/idl_gen_csharp.cpp
Expand Up @@ -226,7 +226,7 @@ class CSharpGenerator : public BaseGenerator {
if (needs_includes) {
code += "using global::System;\n";
code += "using global::System.Collections.Generic;\n";
code += "using global::FlatBuffers;\n\n";
code += "using global::Google.FlatBuffers;\n\n";
}
code += classcode;
if (!namespace_name.empty()) { code += "\n}\n"; }
Expand Down Expand Up @@ -1307,9 +1307,9 @@ class CSharpGenerator : public BaseGenerator {
code += "Offset<" + struct_def.name + ">";
code += "[] offsets) {\n";
code += " Array.Sort(offsets,\n";
code += " (Offset<" + struct_def.name +
"> o1, Offset<" + struct_def.name + "> o2) =>\n";
code += " "+ GenKeyGetter(struct_def, key_field);
code += " (Offset<" + struct_def.name + "> o1, Offset<" +
struct_def.name + "> o2) =>\n";
code += " " + GenKeyGetter(struct_def, key_field);
code += ");\n";
code += " return builder.CreateVectorOfTables(offsets);\n }\n";

Expand Down Expand Up @@ -1463,8 +1463,10 @@ class CSharpGenerator : public BaseGenerator {
}
code += "\n";
// Pack()
code += " public static int Pack(FlatBuffers.FlatBufferBuilder builder, " +
union_name + " _o) {\n";
code +=
" public static int Pack(Google.FlatBuffers.FlatBufferBuilder "
"builder, " +
union_name + " _o) {\n";
code += " switch (_o.Type) {\n";
for (auto it = enum_def.Vals().begin(); it != enum_def.Vals().end(); ++it) {
auto &ev = **it;
Expand Down
2 changes: 1 addition & 1 deletion tests/FlatBuffers.Benchmarks/FlatBufferBuilderBenchmark.cs
Expand Up @@ -17,7 +17,7 @@
using BenchmarkDotNet.Attributes;
using MyGame.Example;

namespace FlatBuffers.Benchmarks
namespace Google.FlatBuffers.Benchmarks
{
//[EtwProfiler] - needs elevated privileges
[MemoryDiagnoser]
Expand Down
2 changes: 1 addition & 1 deletion tests/FlatBuffers.Benchmarks/Program.cs
Expand Up @@ -16,7 +16,7 @@

using BenchmarkDotNet.Running;

namespace FlatBuffers.Benchmarks
namespace Google.FlatBuffers.Benchmarks
{
public static class Program
{
Expand Down
2 changes: 1 addition & 1 deletion tests/FlatBuffers.Test/Assert.cs
Expand Up @@ -19,7 +19,7 @@
using System.Linq;
using System.Text;

namespace FlatBuffers.Test
namespace Google.FlatBuffers.Test
{

public class AssertFailedException : Exception
Expand Down
2 changes: 1 addition & 1 deletion tests/FlatBuffers.Test/ByteBufferTests.cs
Expand Up @@ -17,7 +17,7 @@
using System;
using System.Runtime.InteropServices;

namespace FlatBuffers.Test
namespace Google.FlatBuffers.Test
{
[FlatBuffersTestClass]
public class ByteBufferTests
Expand Down
2 changes: 1 addition & 1 deletion tests/FlatBuffers.Test/FlatBufferBuilderTests.cs
Expand Up @@ -16,7 +16,7 @@

using System;

namespace FlatBuffers.Test
namespace Google.FlatBuffers.Test
{
[FlatBuffersTestClass]
public class FlatBufferBuilderTests
Expand Down
2 changes: 1 addition & 1 deletion tests/FlatBuffers.Test/FlatBuffersExampleTests.cs
Expand Up @@ -21,7 +21,7 @@
using optional_scalars;
using KeywordTest;

namespace FlatBuffers.Test
namespace Google.FlatBuffers.Test
{
[FlatBuffersTestClass]
public class FlatBuffersExampleTests
Expand Down
2 changes: 1 addition & 1 deletion tests/FlatBuffers.Test/FlatBuffersFuzzTests.cs
Expand Up @@ -16,7 +16,7 @@

using System;

namespace FlatBuffers.Test
namespace Google.FlatBuffers.Test
{
[FlatBuffersTestClass]
public class FlatBuffersFuzzTests
Expand Down
2 changes: 1 addition & 1 deletion tests/FlatBuffers.Test/FlatBuffersTestClassAttribute.cs
Expand Up @@ -19,7 +19,7 @@
using System.Linq;
using System.Text;

namespace FlatBuffers.Test
namespace Google.FlatBuffers.Test
{
[AttributeUsage(AttributeTargets.Class)]
public class FlatBuffersTestClassAttribute : Attribute
Expand Down
2 changes: 1 addition & 1 deletion tests/FlatBuffers.Test/FlatBuffersTestMethodAttribute.cs
Expand Up @@ -16,7 +16,7 @@

using System;

namespace FlatBuffers.Test
namespace Google.FlatBuffers.Test
{
[AttributeUsage(AttributeTargets.Method)]
public class FlatBuffersTestMethodAttribute : Attribute
Expand Down
2 changes: 1 addition & 1 deletion tests/FlatBuffers.Test/FuzzTestData.cs
Expand Up @@ -16,7 +16,7 @@

using System;

namespace FlatBuffers.Test
namespace Google.FlatBuffers.Test
{
internal static class FuzzTestData
{
Expand Down
2 changes: 1 addition & 1 deletion tests/FlatBuffers.Test/Lcg.cs
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

namespace FlatBuffers.Test
namespace Google.FlatBuffers.Test
{
/// <summary>
/// Lcg Pseudo RNG
Expand Down
2 changes: 1 addition & 1 deletion tests/FlatBuffers.Test/Program.cs
Expand Up @@ -19,7 +19,7 @@
using System.Linq;
using System.Reflection;

namespace FlatBuffers.Test
namespace Google.FlatBuffers.Test
{
static class Program
{
Expand Down
2 changes: 1 addition & 1 deletion tests/FlatBuffers.Test/TestTable.cs
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

namespace FlatBuffers.Test
namespace Google.FlatBuffers.Test
{
/// <summary>
/// A test Table object that gives easy access to the slot data
Expand Down
2 changes: 1 addition & 1 deletion tests/KeywordTest/KeywordsInTable.cs
Expand Up @@ -7,7 +7,7 @@ namespace KeywordTest

using global::System;
using global::System.Collections.Generic;
using global::FlatBuffers;
using global::Google.FlatBuffers;

public struct KeywordsInTable : IFlatbufferObject
{
Expand Down
2 changes: 1 addition & 1 deletion tests/KeywordTest/KeywordsInUnion.cs
Expand Up @@ -28,7 +28,7 @@ public class KeywordsInUnionUnion {
public KeywordTest.KeywordsInTableT Asinternal() { return this.As<KeywordTest.KeywordsInTableT>(); }
public static KeywordsInUnionUnion Frominternal(KeywordTest.KeywordsInTableT _internal) { return new KeywordsInUnionUnion{ Type = KeywordsInUnion.@internal, Value = _internal }; }

public static int Pack(FlatBuffers.FlatBufferBuilder builder, KeywordsInUnionUnion _o) {
public static int Pack(Google.FlatBuffers.FlatBufferBuilder builder, KeywordsInUnionUnion _o) {
switch (_o.Type) {
default: return 0;
case KeywordsInUnion.@static: return KeywordTest.KeywordsInTable.Pack(builder, _o.Asstatic()).Value;
Expand Down
2 changes: 1 addition & 1 deletion tests/MyGame/Example/Ability.cs
Expand Up @@ -7,7 +7,7 @@ namespace MyGame.Example

using global::System;
using global::System.Collections.Generic;
using global::FlatBuffers;
using global::Google.FlatBuffers;

public struct Ability : IFlatbufferObject
{
Expand Down
2 changes: 1 addition & 1 deletion tests/MyGame/Example/Any.cs
Expand Up @@ -31,7 +31,7 @@ public class AnyUnion {
public MyGame.Example2.MonsterT AsMyGame_Example2_Monster() { return this.As<MyGame.Example2.MonsterT>(); }
public static AnyUnion FromMyGame_Example2_Monster(MyGame.Example2.MonsterT _mygame_example2_monster) { return new AnyUnion{ Type = Any.MyGame_Example2_Monster, Value = _mygame_example2_monster }; }

public static int Pack(FlatBuffers.FlatBufferBuilder builder, AnyUnion _o) {
public static int Pack(Google.FlatBuffers.FlatBufferBuilder builder, AnyUnion _o) {
switch (_o.Type) {
default: return 0;
case Any.Monster: return MyGame.Example.Monster.Pack(builder, _o.AsMonster()).Value;
Expand Down