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

Optional SourceCodeInfo #466

Merged
merged 1 commit into from
Oct 29, 2017
Merged

Conversation

emcfarlane
Copy link
Contributor

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

@achew22
Copy link
Collaborator

achew22 commented Oct 3, 2017

@afking, how are you using this in Bazel?

@emcfarlane
Copy link
Contributor Author

emcfarlane commented Oct 4, 2017

@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.

@achew22
Copy link
Collaborator

achew22 commented Oct 28, 2017

@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?

@emcfarlane
Copy link
Contributor Author

@achew22 I know about that project but don't use it. I'm using the inbuilt proto_library(...) rules which I don't think that project utilises. I then declare a custom macro that selects a bunch of plugin binaries to generate many outputs. I still think SourceCodeInfo is optional and shouldn't cause panics as that is intended behaviour.

@achew22
Copy link
Collaborator

achew22 commented Oct 29, 2017

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?

@emcfarlane
Copy link
Contributor Author

Can't point you at the code I'm using but here if you switch in the protoc-gen-swagger as a plugin you will hit that panic!

@achew22
Copy link
Collaborator

achew22 commented Oct 29, 2017

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.

@emcfarlane
Copy link
Contributor Author

Yep I'm just using proto_library and not the toolchain rule. No problem, feel free to close.

@achew22
Copy link
Collaborator

achew22 commented Oct 29, 2017

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?

@emcfarlane
Copy link
Contributor Author

Updated to print, do you want the original comment message?

@achew22
Copy link
Collaborator

achew22 commented Oct 29, 2017

I think this is good. Thanks for contributing!

@achew22 achew22 merged commit 82b83c7 into grpc-ecosystem:master Oct 29, 2017
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