-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Optional SourceCodeInfo #466
Conversation
@afking, how are you using this in Bazel? |
@achew22 custom rule similar too https://github.com/bazelbuild/rules_go/tree/master/proto . Rule generates from proto_library presumably for deterministic builds it removes optional info. |
@afking Have you seen https://github.com/pubref/rules_protobuf? That's what I have been using in my project where I use this. It doesn't seem to suffer from this. Can you maybe describe what your project is doing different that necessitates this change? I'm hesitant to remove the panic since it appears to detect a real invariant in protoc input that can make things difficult to deal with but would be open to suggestions on other ways we can solve this. What do you think? |
@achew22 I know about that project but don't use it. I'm using the inbuilt |
That's very exciting! Last I heard it wasn't possible to do that from Skylark yet. Do you have any references or sample code you could point me to so I can use that in my project? |
Can't point you at the code I'm using but here if you switch in the |
Yeah that makes sense. I was kind of hoping you would say "yeah proto_lang_toolchain is totally available from Skylark but it isn't documented". I actually have swapped it in just as you suggested and I'm not able to reproduce with the proto files in my repo. I want to understand the circumstances when this code path goes into what is currently an error state before deactivating it so that if it turns out to be problematic in the future I know how to detect it. I'm terribly sorry to be a stickler on this, I am just a little leery of removing error checking, especially when the majority of users of this code are manually invoking protoc, which is sometimes difficult to correctly invoke with all the knobs turned to the right place. |
Yep I'm just using |
How about this. I think there is a best of both worlds solution to this. What would you think about emitting a notice to stderr about this right before your return. What do you think? |
8a3c994
to
2a43ec7
Compare
Updated to print, do you want the original comment message? |
I think this is good. Thanks for contributing! |
Using this as a plugin for bazel breaks as the generated protobuffers don't include
SourceCodeInfo
. Its optional and shouldn't affect code generation: https://github.com/google/protobuf/blob/master/src/google/protobuf/descriptor.proto#L85