-
Notifications
You must be signed in to change notification settings - Fork 20
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
linker: support editions in linker descriptors #258
Conversation
open questions: * Is there a better way to resolve the options. At the moment we clone the parse result which feels extremely expensive. * Is generating the full google.golang.org/protobuf descriptors in the linker a performance issue? * Can we get rid of the noOpDescriptors completely or are there cases where the google.golang.org/protobuf descriptor validation is stricter than what protocompile allows? This commit does not yet work as it requires an update to google.golang.org/protobuf.
@jhump could you take a look and let me know what you think? |
@lfolger, maybe we can schedule a chat? I already have a lot of the work to support editions properly stubbed out. I was mostly awaiting the core runtime to be updated with changes to the interfaces so I can implement them here. My plan was to resurrect a lot of the code that I removed in #191, in order to implement new
I don't understand the necessity for cloning. The compiler already clones parse result and/or descriptor proto if necessary, in
Almost certainly. The process of building those will duplicate a decent bit of the work the linker has done and also allocate another full copy of the descriptor hierarchy.
We can't get rid of the embedded interfaces, to make sure this module can compile in the face of future interface additions to the And we can't just use "real" implementations instead of the no-op ones, like this PR proposes, because there is a key case where google.golang.org/protobuf descriptor validation is stricter: that package performs various checks on options to detect if things are valid. But at this point in time in the compilation process, we haven't interpreted options yet. However, we need a full implementation of |
Happy to schedule a chat. I prepared this pull request to find out what we (Google) need to support the use cases we have in Google. I'm happy for alternative solutions that cover the same use cases. |
@lfolger, I think #260 should do the trick. It implements feature resolution with defaults based on the version of Note that branch also adds a method to its Edition() descriptorpb.Edition Ideally, the protobuf-go runtime, the |
Thanks for the prompt response. Also thanks for adding the Edition() function. I think the signature of that function needs to change because we need to implement it in protobuf/internal/filedesc which cannot depend on the descriptor proto for bootstrapping reasons. I think the best alternative is to return and int32. I'm not a big fan that it lacks the type information but unless we want to introduce an extra package public package that defines these editions as constants, I don't think there is a much better way. |
Yep, that totally makes sense that you don't want a dependency on |
@lfolger, any chance you can easily test that other PR, to verify that it resolves any issues with protocompile in your codebase and corpus of protos? |
Let me give this a try. It might not be able to report results back today though. |
Thank you!
No worries. I'm working on some other things and can let that PR remain open for a bit if needed. I'd prefer to wait to merge it until I have confirmation from you that it will resolve any issues. Thanks again! |
It tested these changes and couldn't find any issue with it. |
Open questions:
This is very much work in progress and I would like to have feedback on how to move forward.
This commit does not yet work as it requires an update to google.golang.org/protobuf. Once we agreed on the direction of this change, I'm going to make the necessary changes to google.golang.org/protobuf.