-
-
Notifications
You must be signed in to change notification settings - Fork 668
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 protocopt option to protoc go compiler #2788
Add protocopt option to protoc go compiler #2788
Conversation
@bazelbuild/go-maintainers Please comment if you have any thoughts on this PR. |
LGTM, would it be possible to add a testcase that exercises this? |
Added test scenario for this PR. Thanks! |
Hrm... I triggered re-run on the windows break 3 times just to get more data. I have absolutely NO idea what that means... |
Maybe something to do with the update in protoc. I didn't test anything for windows :( |
Yeah, I don't really know what to do here. I don't have a windows box to test on. @jayconrod do you have a windows box for debugging? |
I think this is protocolbuffers/protobuf#8049: protoc 3.14 doesn't build with MinGW on Windows. We probably need to exclude this test on Windows in .bazelci/presubmit.yml (both in the |
@jayconrod I've seen a couple of projects tag as |
No strong opinion, but if a target fundamentally doesn't work on Windows (for example, if it tests At the moment, we basically don't have test coverage for |
This PR should no longer be required for field presence support since 3.15 (where "optional" is enabled by default). |
@ah-edg Excellent! Let's close this. Users of proto3 optional can update to protoc 3.5.0 or later. |
Just to clarify, I decided to close this since the experimental protoc flag was the use case to support this functionality. |
What type of PR is this?
Feature
What does this PR do? Why is it needed?
This PR allows for downstream projects to define a go proto compiler that requires additional protoc arguments.
Example usage:
Which issues(s) does this PR fix?
Fixes #2673
Other notes for review
Opening as a draft to solicit early review.
This is missing any form of tests would like to receive some feedback from maintainers before proceeding.
Ideally, this functionality would be better implemented if the
--protocopt
flag was exposed via the starlark API, i.e.--protocopt=--experimental_allow_proto3_optional
in the command line, however, it does not seem possible to access this flag in starlark. So, I have taken this approach to allow the arguments to be provided as target attributes on the go_proto_compiler rule.