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

Make it possible to combine/add plugins #236

Open
rfevang opened this issue Dec 29, 2022 · 1 comment
Open

Make it possible to combine/add plugins #236

rfevang opened this issue Dec 29, 2022 · 1 comment
Labels
enhancement New feature or request plugin Regarding external plugins

Comments

@rfevang
Copy link

rfevang commented Dec 29, 2022

Description

I'm trying to run a custom protoc plugin that modifies the output of a different (Java) plugin, using insertion points.

I first tried looking for an argument to java_proto_library or java_proto_compile that let me add my plugin. When I didn't see any I then tried making my own compile rule, specifying both plugins. This attempt was however met by errors saying that the insertion points were not found.

I looked at the source and spotted this:

# Each plugin is isolated to its own execution of protoc, as plugins may have differing
# exclusions that cannot be expressed in a single protoc execution for all plugins.

for plugin in plugins:

As far as I can tell this effectively makes it impossible to use insertion point based protoc plugins with rules-proto-grpc.

Is it possible to change this? It seems like the low level function should support multiple plugins in one call, and then leave it up to higher level functions to split plugins into multiple calls to the low level compile, if that is desired.

Ideally I'd like to see an argument to the high level functions where one could pass insertion point based plugins.

@aaliddell
Copy link
Member

Hi, do you have an example of such a plugin that depends on the outputs of prior plugins? I wasn't even aware these exist and would need one to test with.

Passing plugins at the top level used to be impossible to support due to the architecture of these rules, but actually since 4.0.0 dropped transitivity it may be feasible to implement a generic_compile rule that takes the plugin list (this already mostly exists in proto_compile_impl). There may be some constraint I am forgetting though...

As for running in a shared execution, that is supported by protoc just fine but the comment you copied about exclusions remains a concern. If the plugins share the same exclusions (which most do) then perhaps the execution could be merged 🤔

@aaliddell aaliddell added enhancement New feature or request plugin Regarding external plugins labels Mar 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request plugin Regarding external plugins
Projects
None yet
Development

No branches or pull requests

2 participants