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

Cannot build js generator with latest protobuf (v26.0+ not supported) #206

Closed
kgreenek opened this issue Jun 12, 2024 · 2 comments · Fixed by #208
Closed

Cannot build js generator with latest protobuf (v26.0+ not supported) #206

kgreenek opened this issue Jun 12, 2024 · 2 comments · Fixed by #208
Assignees
Labels
bug Something isn't working triaged Issue has been triaged

Comments

@kgreenek
Copy link

Using the latest version of protobuf (v27.1), I see the following compiler errors when trying to compile the javascript generator:

external/com_google_protobuf_javascript/generator/js_generator.cc:457:7: error: 'OneofDescriptorLegacy' was not declared in this scope; did you mean 'FileDescriptorLegacy'?
  457 |   if (OneofDescriptorLegacy(oneof).is_synthetic()) return true;
      |       ^~~~~~~~~~~~~~~~~~~~~
      |       FileDescriptorLegacy
external/com_google_protobuf_javascript/generator/js_generator.cc: In function 'std::string google::protobuf::compiler::js::{anonymous}::JSOneofIndex(const google::protobuf::OneofDescriptor*)':
external/com_google_protobuf_javascript/generator/js_generator.cc:566:9: error: 'OneofDescriptorLegacy' was not declared in this scope; did you mean 'FileDescriptorLegacy'?
  566 |     if (OneofDescriptorLegacy(o).is_synthetic()) continue;
      |         ^~~~~~~~~~~~~~~~~~~~~
      |         FileDescriptorLegacy
external/com_google_protobuf_javascript/generator/js_generator.cc: In function 'bool google::protobuf::compiler::js::{anonymous}::InRealOneof(const google::protobuf::FieldDescriptor*)':
external/com_google_protobuf_javascript/generator/js_generator.cc:787:11: error: 'OneofDescriptorLegacy' was not declared in this scope; did you mean 'FileDescriptorLegacy'?
  787 |          !OneofDescriptorLegacy(field->containing_oneof()).is_synthetic();
      |           ^~~~~~~~~~~~~~~~~~~~~
      |           FileDescriptorLegacy
external/com_google_protobuf_javascript/generator/js_generator.cc: In function 'bool google::protobuf::compiler::js::{anonymous}::DeclaredReturnTypeIsNullable(const google::protobuf::compiler::js::GeneratorOptions&, const google::protobuf::FieldDescriptor*)':
external/com_google_protobuf_javascript/generator/js_generator.cc:987:43: error: 'class google::protobuf::FileDescriptorLegacy' has no member named 'syntax'
  987 |   if (FileDescriptorLegacy(field->file()).syntax() == FileDescriptorLegacy::Syntax::SYNTAX_PROTO3 &&
      |                                           ^~~~~~
external/com_google_protobuf_javascript/generator/js_generator.cc:987:77: error: 'google::protobuf::FileDescriptorLegacy::Syntax' has not been declared
  987 |   if (FileDescriptorLegacy(field->file()).syntax() == FileDescriptorLegacy::Syntax::SYNTAX_PROTO3 &&
      |                                                                             ^~~~~~
external/com_google_protobuf_javascript/generator/js_generator.cc: In member function 'void google::protobuf::compiler::js::Generator::GenerateClassFieldToObject(const google::protobuf::compiler::js::GeneratorOptions&, google::protobuf::io::Printer*, const google::protobuf::FieldDescriptor*) const':
external/com_google_protobuf_javascript/generator/js_generator.cc:2350:45: error: 'class google::protobuf::FileDescriptorLegacy' has no member named 'syntax'
 2350 |     if (FileDescriptorLegacy(field->file()).syntax() == FileDescriptorLegacy::Syntax::SYNTAX_PROTO3 &&
      |                                             ^~~~~~
external/com_google_protobuf_javascript/generator/js_generator.cc:2350:79: error: 'google::protobuf::FileDescriptorLegacy::Syntax' has not been declared
 2350 |     if (FileDescriptorLegacy(field->file()).syntax() == FileDescriptorLegacy::Syntax::SYNTAX_PROTO3 &&
      |                                                                               ^~~~~~
external/com_google_protobuf_javascript/generator/js_generator.cc: In member function 'void google::protobuf::compiler::js::Generator::GenerateClassField(const google::protobuf::compiler::js::GeneratorOptions&, google::protobuf::io::Printer*, const google::protobuf::FieldDescriptor*) const':
external/com_google_protobuf_javascript/generator/js_generator.cc:2758:45: error: 'class google::protobuf::FileDescriptorLegacy' has no member named 'syntax'
 2758 |     if (FileDescriptorLegacy(field->file()).syntax() == FileDescriptorLegacy::Syntax::SYNTAX_PROTO3 &&
      |                                             ^~~~~~
external/com_google_protobuf_javascript/generator/js_generator.cc:2758:79: error: 'google::protobuf::FileDescriptorLegacy::Syntax' has not been declared
 2758 |     if (FileDescriptorLegacy(field->file()).syntax() == FileDescriptorLegacy::Syntax::SYNTAX_PROTO3 &&
      | 

It looks like perhaps the latest version might have removed some legacy classes.

@dibenede dibenede added bug Something isn't working triaged Issue has been triaged labels Jun 12, 2024
@dibenede
Copy link
Contributor

Thank you for reporting this. I think your assessment is correct and we are falling behind protobuf's developments.

@kgreenek
Copy link
Author

Can confirm the syntax() method was removed in this commit, which was part of release v26.0 (protocolbuffers/protobuf@cf2d696#diff-faab3ee51729cba39d00c0691c6b9905ec3eca43da31dcd09af3e4ffd0d1a6a3L1860).

Relevant comment:

  // With the upcoming release of editions, syntax should not be used for
  // business logic.  Instead, the various feature helpers defined in this file
  // should be used to query more targeted behaviors.  For example:
  // has_presence, is_closed, requires_utf8_validation.

I think this PR removed the Legacy class used in js_generator.cc. That change was also was released in protobuf v26.0 (protocolbuffers/protobuf#15709).

@kgreenek kgreenek changed the title Cannot build js generator with latest protobuf Cannot build js generator with latest protobuf (v26.0+ not supported) Jun 12, 2024
@dibenede dibenede self-assigned this Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triaged Issue has been triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants