protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

Protoc Plugin support should allow custom parameters before other parameters

Open marner2 opened this issue 2 years ago • 2 comments

This applies only to the protoc CLI.

With some code generator toolchains (such as dotnet nuget), local tools get installed in a way that requires a call to a framework binary with the tool as the first parameter. For example, dotnet protoc-gen-fsharp. However, you currently cannot tell protoc to put a custom argument before the others. It would be nice to be able to call such a command with leading arguments directly as the plugin input to protoc.

For dotnet nuget, we can install the tool globally which removes the need for dotnet at the beginning, which is undesirable but the currently recommended solution. We could also deliver shell scripts, but that locks you into a specific shell dependency on the client. We could also deliver the plugin as a full fat executable, but that would involve shipping every possible runtime that people might use, greatly increasing the size of the package.

Here is an issue describing some more context and alternatives in Arshia001's FSharp.GrpcCodeGenerator

marner2 avatar Oct 07 '22 17:10 marner2

@marner2 Can you please include an example of a commandline that you run today and the improved version you'd like to write?

googleberg avatar Oct 07 '22 20:10 googleberg

@googleberg current command line command (requires global tool install from nuget): protoc-gen-fsharp --out=x ...[other args]

Improved version we'd like to write (can be installed locally): dotnet protoc-gen-fsharp --out=x ...[other args]

From https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.compiler.command_line_interface#CommandLineInterface.AllowPlugins.details it says that the expected usage of the plugin is: plugin [[]--out=OUTDIR] [[]--parameter=PARAMETER] PROTO_FILES < DESCRIPTORS

What we'd like is some way to specify additional args immediately after plugin such as: plugin PLUGIN_ARGS [[]--out=OUTDIR] [[]--parameter=PARAMETER] PROTO_FILES < DESCRIPTORS

marner2 avatar Oct 08 '22 22:10 marner2

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.

This issue is labeled inactive because the last activity was over 90 days ago.

github-actions[bot] avatar Jan 01 '24 10:01 github-actions[bot]

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please reopen it.

This issue was closed and archived because there has been no new activity in the 14 days since the inactive label was added.

github-actions[bot] avatar Jan 16 '24 10:01 github-actions[bot]