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

Add "CodeGeneratorRequest" access in BuildContext #72

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yinzara
Copy link

@yinzara yinzara commented Apr 1, 2020

While this plugin's abstraction of the CodeGeneratorRequest is the main purpose of the plugin, there are times it's necessary to get the original CodeGeneratorRequest that was parsed from stdin.

In regards to the https://github.com/srikrsna/protoc-gen-gotag project

The purpose of this project is to add functionality on top of the "protoc-gen-go" standard plugin by adding tags on to the generated go code. Because the original CodeGeneratorRequest is not available during the module execution, the generated code from the protoc-gen-go plugin must have already been written to disk. This means that you cannot both use the protoc-gen-go plugin and the protoc-gen-gotag plugin in the same execution of protoc. Even worse, if it is not in the current directory of the execution, the module.needs additional parameters to point to the output location.

This could be alleviated by having access to the original CodeGeneratorRequest. If that was available, we could use it to get the CodeGeneratorResponse from the official protoc-gen-go library then enhance it and output the results.

This pull request exposes the original CodeGeneratorRequest as part of the BuildContext

@bartsmykla
Copy link

That's exactly what we currently need. Is there any way have this functionality? :-)

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

Successfully merging this pull request may close these issues.

2 participants