-
Notifications
You must be signed in to change notification settings - Fork 790
Upgrade protobuf to 27.1 and modernize codegen using new APIs (e.g. has_presence()
)
#1445
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
Conversation
@benjaminp Wow thanks so much for help working on this! I just ran our CI and ran into this error tho: Not sure if it's directly related (or related to our CI setup or our other dependencies in general) though. I could try take a closer look later. |
I've noticed that older GCC versions give a false deprecation warning in part of protobuf, which then explodes because protobuf passes |
oh wow! good to note!! Thanks for the suggestion! Do you think |
Hmm CI still showing same errors it seems: |
Should work, yes.
Okay, maybe I need to also pass |
Thanks for the update!! Still same error tho... the bazel flag might not have been working.. Does it make things build for you? When running this local command (on my Mac) shows me the same error as in shown in CI:
|
Aha got it!! You need to add an extra line:
below this line:
Then it should work :) And then i think you don't need |
Nice find. done |
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.
Thank you SO MUCH for this contribution.. This is wonderful.. such a great simplification across the board and I much appreciate you help us make our lives easier using these new APIs.. Thank you 😊
Only one request — to remove the --host_copt
— other comments are all just thoughts :)
Thank you again :)
@@ -0,0 +1 @@ | |||
build --copt=-Wno-error=deprecated-declarations --host_copt=-Wno-error=deprecated-declarations |
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 --host_copt=-Wno-error=deprecated-declarations
is no longer necessary.
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.
@benjaminp Could you update this file? I'll re-run CI and merge this PR afterwards.. Thanks! 😊
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 it's probably safest to keep this, and there's minimal downside. If any protobuf code ends up in the Bazel exec configuration, the compilation problem will reappear.
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.
Ok! Sure! I think you understand bazel (and protobuf for the matter) way more than me so I trust your judgement here :)
if (field->has_optional_keyword() || | ||
(field->type() == FieldDescriptor::TYPE_MESSAGE && | ||
!field->is_repeated() && !field->is_map())) { | ||
if (field->has_presence()) { |
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.
what a simplification! 😊
for (int i = 0; i < desc->real_oneof_decl_count(); i++) { | ||
const OneofDescriptor *oneof = desc->real_oneof_decl(i); |
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.
nice! 😊
@@ -904,8 +900,7 @@ void PrintProtoDtsMessage(Printer* printer, const Descriptor* desc, | |||
} | |||
vars["js_field_name"] = js_field_name; | |||
vars["js_field_type"] = AsObjectFieldType(field, file); | |||
if ((field->type() != FieldDescriptor::TYPE_MESSAGE && !field->has_optional_keyword()) || |
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.
Trying to understand all the cases is literally giving me a headache.. 😅
so I asked ChatGPT if the before and after is equivalent and it says yet — so i trust it (and you) :D
I honestly wouldn't be surprised if the code before has bugs which would be fixed by the new code.
thanks so much for the simplification.. so much nicer :)
has_presence()
)
@benjaminp Thank you SO much for the wonderful contribution here again :) Let me know if you need a new release to be cut to be able to leverage some of the change here, and if so i'd be happy to do one soon (after July 4th tho) :) |
FYI i think this has broken the Can be built by:
Error logs (internal):
Maybe somehow the |
I've temporarily Would like to have that fixed soon tho! @benjaminp If you could help take a look it'll be appreciated too! My macbook is showing some unrelated errors but i think this error can probably be reproduced by:
UPDATE: This will (probably) be fixed by #1446 :):) |
Fixes #1437.