mzaks / FlatBuffersSwift

This project brings FlatBuffers (an efficient cross platform serialization library) to Swift.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

support compile fbs with include statement?

navigator117 opened this issue · comments

eg.
B.fbs
...
some definations
...
A.fbs
include "B.fbs"
...
other definations
...

how about add a "-I" option to cmd line?

Hi, the semantics of the include statements are a bit more complex, because they open up many edge cases. E.g. you have A.fbs and B.fbs which both include C.fbs as C.fbs contain the basic/reusable definitions. Then if you generate A.fbs and B.fbs you would end up with double declarations in A.swift and B.swift this is where namespacing comes handy. But this feature is also not implemented as Swift does not really have namespacing, except for wrapping things in an enum.
So in order to solve it you could provide a list of definition names which should be ignored while generating. I am actually almost finished with code_gen branch (https://github.com/mzaks/FlatBuffersSwift/tree/code_gen) where the FBS parser and code generator is written in Swift. It would make sense to put flexible support for include statement there, but sadly I can't give you any time frame as I don't use FlatBuffersSwift in my current project. It's one of my side projects now, this is why the activity is not that high.