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

protoc support #1

Open
steeve opened this issue Nov 16, 2024 · 3 comments
Open

protoc support #1

steeve opened this issue Nov 16, 2024 · 3 comments
Assignees

Comments

@steeve
Copy link

steeve commented Nov 16, 2024

Hi,

First of all, congratulations, this looks great!
Would you be open to protoc support? It's mostly https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto on stdin and file contents on stdout.

This would ease support for other build systems, most notably regarding well known types.

Cheers,

@batsuev batsuev self-assigned this Nov 18, 2024
@batsuev
Copy link
Contributor

batsuev commented Nov 18, 2024

Thanks for the feedback! 👋
Just to break this down clearly - we're looking at two key pieces:

  • A protoc-style binary that handles proto -> zig
  • protobuf "stdlib" (for well-known types) in gremlin library module

@gwenzek
Copy link

gwenzek commented Nov 27, 2024

Hi, answering for @steeve since he's a bit busy.

We're talking about protoc plugins for a specific language.
What protoc does to handle all languages is that it convert a .proto file into a binary "FileDescriptorProto",
then it passes the "FileDescriptorProto" to a plugin responsible to generate source code.

This plugin is what zig-protobuf implements in https://github.com/Arwalk/zig-protobuf/blob/master/bootstrapped-generator/main.zig#L102-L110

We could contribute a similar plugin that take a FileDescriptorProto and output a .zig file similar to what gremlin generates already.

I've already forked https://github.com/gwenzek/zig-protobuf to make it generate one .zig file for each .proto, and use modules for imports instead of using relative imports, as well as simplifying a bit the generated code.
So I'm familiar with the problem.

Personally I prefer the API generated by gremlin, so that's why we consider switching to it, and we can contribute the missing piece. But if you feel this is beyond your original goals, we can also do this in a separate repository.

@batsuev
Copy link
Contributor

batsuev commented Dec 4, 2024

@gwenzek Thanks for the details. Yes, I think adding optional protoc support would be a valuable addition

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants