-
Notifications
You must be signed in to change notification settings - Fork 15.6k
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 prefix_to_proto_package_mappings_path ObjC option. #9498
Add prefix_to_proto_package_mappings_path ObjC option. #9498
Conversation
677ff13
to
0e1ab8f
Compare
0e1ab8f
to
0b1f8c6
Compare
src/google/protobuf/compiler/objectivec/objectivec_generator.cc
Outdated
Show resolved
Hide resolved
0b1f8c6
to
41e2a26
Compare
41e2a26
to
d3e2d62
Compare
FYI I won't be able to really look until about the 22nd. Taking some time off. |
no worries, thank you so much for your time @thomasvl ! |
492f35b
to
7f993c2
Compare
6c19c25
to
72b485a
Compare
72b485a
to
697c45c
Compare
697c45c
to
7f747ff
Compare
@@ -140,6 +161,44 @@ PrefixModeStorage::PrefixModeStorage() { | |||
} | |||
} | |||
|
|||
std::string PrefixModeStorage::prefix_from_proto_package_mappings(const FileDescriptor* file) { | |||
if (!file) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We actually do need the file
here as we perform some logic below to figure out the package to use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I had commented not about the passing of file
, but the passing of it by reference so it can't be nullptr
.
@thomasvl I updated all logic! Let me know if there is anything else for me to change or address! |
Hey @thomasvl in the previous PR we introduced the
default_objc_class_prefix
objc_opt.However, upon using it it had a major flaw. We have protos that we generate this prefix for for namespacing and it is not always the same. Upon using this, we realized that objc class prefix passed was also used when generating code for dependencies which was causing compilation issues. In other words, it was applied globally. This might be OK if anyone decides to use the same prefix for all protos so maybe we can keep that option as well?
I figured anyone can generate a map with the same prefix across all proto files if they desire to do so.
This is basically a different solution to #9469