Comments (3)
Hey there. I apologize for my delay. I did see your earlier message, but life happened this week and I didn't have time to respond.
So, you're close to the mark here. The problem is that you're telling FlatSharp to process everything twice. I suggest putting the shared schemas into their own folder and only including that in the common project:
<PropertyGroup>
<FlatSharpClassDefinitionsOnly>true</FlatSharpClassDefinitionsOnly>
</PropertyGroup>
<ItemGroup>
<FlatSharpSchema Include="Schemas\Shared\**\*.fbs">
<IncludePath>Schemas\</IncludePath>
</FlatSharpSchema>
</ItemGroup>
Then the specific schemas that reference those shared ones need their own folder as well:
<ItemGroup>
<ProjectReference Include="..\pkNX.Structures.FlatBuffers.Shared\pkNX.Structures.FlatBuffers.Shared.csproj" />
</ItemGroup>
<PropertyGroup>
<FlatSharpDeserializers>GreedyMutable</FlatSharpDeserializers>
<FlatSharpInputFilesOnly>true</FlatSharpInputFilesOnly>
</PropertyGroup>
<ItemGroup>
<FlatSharpSchema Include="Schemas\Specific\**\*.fbs">
<IncludePath>Schemas\</IncludePath>
<IncludePath>..\pkNX.Structures.FlatBuffers.Shared\Schemas\Shared\</IncludePath>
</FlatSharpSchema>
</ItemGroup>
This leads to the common project having the shared class definitions, but no serializers and the specific project having serializers for its types and the common types, but no class definitions for the common types.
Hope that makes sense. LMK if you need more help. I'm happy to share a fuller example.
from flatsharp.
So the files are already in a different physical folder, but I tried to use the method you layed out above and it's still not working. I think there may be a deeper underlaying issue. I will try with a simple setup to see if I can get this to work and then try to figure out what breaks it. I think it's caused by multi-layered includes
from flatsharp.
🎉 My mistake it's working perfectly fine. I had a duplicate flatbuffer in the main project. (so both main and shared had the same flatbuffer definition, but placed at a different physical disk location)
include "Math/Vec3f.fbs";
namespace pkNX.Structures.FlatBuffers;
table AABB {
Min: Vec3f;
Max: Vec3f;
}
Had a copy both in shared/Schemas/
and main/Schemas/
from flatsharp.
Related Issues (20)
- Compilation target fails when executable path (i.e. nuget cache path) contains spaces
- Namespace not found HOT 1
- Implementation of IInputBuffer for ReadOnlySequence<byte> HOT 6
- Share table HOT 2
- [Bug] Using the latest "Standalone" `FlatSharp` nuget in a .net6 project; generates a file that requires `IPoolableObject` HOT 2
- Reducing compiler generated file HOT 15
- Duplicate fbs filenames in different folders break compilation HOT 2
- Getting TypeLoadException when trying to access FlatSharp types HOT 9
- Shared fbs between multiple projects HOT 11
- [Bug] Flatsharp can't compile schemas on seperate drives HOT 7
- AOT exception when running a game built with Unity 2021.3 IL2CPP HOT 3
- Don't use Nullable properties for GreedyMutable only serializers HOT 4
- Allow fbs fs_serializer attribute to override global code gen settings HOT 2
- Serialization in V7 HOT 1
- Error generating model code when using namespace ending with FlatBuffer in .fbs file HOT 2
- flatsharp.compiler 7.x requires net6.0 SDK HOT 5
- Version conflict detected for Microsoft.CodeAnalysis.Common HOT 2
- Union does not support using the same type HOT 2
- Issue with init-only property when generating FlatSharp schema in .NET 6 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flatsharp.