Communication between plugins

72 views
Skip to first unread message

Nadav Samet

unread,
Dec 17, 2020, 12:46:40 PM12/17/20
to Protocol Buffers
Are there any mechanisms provided by protoc that would allow one protoc plugin to provide data  (not file content) that can be consumed by a subsequent protoc plugin on the same protoc run? I want to be able to give users of my plugin a way to control the output of the main plugin based on logic that they would program into their own plugin. The output of that logic would be consumed by the main plugin and impact its behavior (for example, modify field names and types). Alternatives could be communicating through the filesystem/pipes, or developing a sub-plugin framework under my own plugin - which aren't ideal.

Thanks,
-Nadav

Adam Cozzette

unread,
Dec 21, 2020, 2:42:12 PM12/21/20
to Nadav Samet, Protocol Buffers
Custom options feel like the natural place to store data for consumption by another plugin. I'm not sure if the plugin interface will let you do this all in one protoc invocation, but maybe it would make sense to split up into multiple steps. You could generate the descriptors with --descriptor_set_out, then modify them to add whatever kind of special data you want via custom options, and then finally invoke protoc again by passing the modified descriptors in --descriptor_set_in.

--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/CANZcNEo1HD1W5V4-NQ8Jt0v%3DKy2Bif%2BuZOV%3DHPGxxaV_VYDnAQ%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages