-
Notifications
You must be signed in to change notification settings - Fork 57
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
Import results in new type definitions #251
Comments
Hey @tuckermcclure. You are right -- the current way of including each generated "package" results in shared dependencies being re-defined in each of them, making them incompatible. This was supposed to be fixed by generating proper Julia packages (with the expected file structure and One workaround would be to put all of these into the same package:
This way only a single package would be generated, Sorry for this not being finished. Maybe the pre-1.0 version of this package worked better in this regard? |
Thank you, @Drvi ! Let me give this workaround a try.
I'm very thankful for this project as it stands today! |
Just to follow up, if I go modify
However, the actual proto files I'm working with are part of a large, shared code base. The Julia part is a very small piece. I can't force everyone to change all of the .proto files to pull things from some new top-level package. I don't see another work-around right now. |
It seems to me that generating "real Julia packages" is not totally required to solve this problem (thought perhaps there are other things you were hoping to solve that way?). Potentially the generated code for a package could look in the parent module for the definitions it needs. E.g., instead of:
you could have:
For this simple example, if I make this change manually on both This implies that there is a new generated file that includes all of these things like so:
such that the application code is just:
This clearly requires the code generator to figure out the hierarchy of imports so that the files can be included in the generated top-level file ( |
When generating Julia definitions for multiple .proto files that each import a common .proto file, each of the generated modules gets its own definition of the "common" type. This makes it so that ProtoBuf definitions are very clumsy in Julia. Perhaps I'm misunderstanding how this is supposed to go.
Here's an example.
proto/common.proto
proto/a.proto
proto/b.proto
script.jl
Is there anything you can do to truly have common types? Have I misunderstood something fundamental either about ProtoBuf or about ProtoBuf.jl?
The text was updated successfully, but these errors were encountered: