-
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
objective-c: Add default_objc_class_prefix
generation option.
#9476
objective-c: Add default_objc_class_prefix
generation option.
#9476
Conversation
objc_class_prefix
generation option.objc_class_prefix
generation option.
35540b8
to
9c65fcf
Compare
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.
The fact that developers have to edit the files for the prefix has always sorta bugged me, so I'm not opposed to this. Just want to make sure it is something we spec that can be supported long term.
I wonder if maybe we should tweak your proposed generation option name to be default_objc_class_prefix
to better indicate when/how it would be used?
src/google/protobuf/compiler/objectivec/objectivec_generator.cc
Outdated
Show resolved
Hide resolved
Yeah I did not like it myself either and I appreciate this take. I think we should change it to |
@thomasvl here's a thought: Should we actually make the If we do make it first, should not name it something like |
I was debating that after reading the issue and starting to look at your PR. We could continue with the current PR and making it a default, and that doesn't prevent us from later adding a I can see values for both, again, once it is officially provided, it has to be supported, so we'll need to think through if there are down sides to this… Since the prefixes can be needed to avoid type collisions, I can see something that is an override becoming a foot gun when some .proto author has two packages with a User message, and all languages using proto packages keep them unique, and that author might have even included ObjC prefixes to keep them unique, but this generation option can't be used because it completely defeats the proto authors work to help developers out. So yes, there are likely lots of cases it is safe and someone could use it, but then suddenly one day they get a new proto dependency or one gets updated, and they suddenly have to revise everything because we've lead them down a path that is sorta asking for this issue in the future. Again, not completely opposed, but as an override, it likely need to be thought about a bit longer compared to a default one. |
Sounds good! I will proceed with renaming it to default and update README etc. |
d5d9404
to
e4b508c
Compare
@thomasvl updated to use Please let me know if i should update anything else and thank you for the review and guidance! |
e5fc331
to
4a9bb4b
Compare
src/google/protobuf/compiler/objectivec/objectivec_generator.cc
Outdated
Show resolved
Hide resolved
4a9bb4b
to
914a714
Compare
@thomasvl I looked into adding some tests...it seems it should be possible, let me know if its a requirement |
Looks like one shard flaked? |
I'm ok without a specific test on this given the simplicity of it.
Yea, some issue not related to your PR. |
thank you! |
objc_class_prefix
generation option.default_objc_class_prefix
generation option.
@thomasvl this is actually causing issues. It turns out that Do you have a place to store this for each proto file options (but not real proto file options) |
I guess I can build it into |
updating this now. |
maybe this can be rearchitected into a file like |
Going to update this to be based from a file instead. The file can be :proto If one wants to use a "default" one they can just output the same prefix for all files. |
For #9469