Tips for debugging custom Java Protobuf plugin

209 views
Skip to first unread message

Zachary Moore

unread,
Feb 2, 2023, 1:40:04 PM2/2/23
to Protocol Buffers
Hello all,

We are working on a custom java protoc plugin.

We are invoking this via a gradle task that runs the generated binary with protoc.
One of the issues that we are currently struggling with is what is the best way to go about developing and debugging our plugin?  Since we are invoking this via a gradle task that calls protoc, the only way we have thought to do this is via trying to hook into the java process once protoc spins it up.

One of the hacks we have done is sleeping the code long enough that allows us to hook in but doing this, as well as lazy print statements is not scaling.

Wondering if there are any tips that can be shared here that anyone who has worked on a custom java plugin before could share on development flows.

Thanks all

Florian Enner

unread,
Feb 19, 2023, 1:33:13 PM2/19/23
to Protocol Buffers
I created a second plugin that creates a binary file containing the raw request message. The generated files can then easily be loaded in unit tests.

The code is in ParserPlugin. The tests files generated as part of the build. I hope that helps.
Reply all
Reply to author
Forward
0 new messages