Skip to content

Add "CodeGeneratorRequest" access in BuildContext#72

Open
yinzara wants to merge 1 commit into
lyft:masterfrom
yinzara:master
Open

Add "CodeGeneratorRequest" access in BuildContext#72
yinzara wants to merge 1 commit into
lyft:masterfrom
yinzara:master

Conversation

@yinzara
Copy link
Copy Markdown

@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
Copy Markdown

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