Skip to content

Update ruby_generator.cc to allow proto2 imports in proto3#9003

Merged
zhangskz merged 6 commits intoprotocolbuffers:3.18.xfrom
zhangskz:ruby-proto2
Sep 22, 2021
Merged

Update ruby_generator.cc to allow proto2 imports in proto3#9003
zhangskz merged 6 commits intoprotocolbuffers:3.18.xfrom
zhangskz:ruby-proto2

Conversation

@zhangskz
Copy link
Copy Markdown
Member

No description provided.

@zhangskz zhangskz requested a review from haberman September 20, 2021 23:56
@zhangskz zhangskz changed the title Update ruby_generator.cc to allow proto2 imports in proto3, with updated unit tests Update ruby_generator.cc to allow proto2 imports in proto3 Sep 20, 2021
@haberman
Copy link
Copy Markdown
Member

This looks great. Could you also add a test in one of these protos, to ensure that the generated code can be successfully loaded into a Ruby process and used?

https://github.com/protocolbuffers/protobuf/tree/master/ruby/tests

I think this is a good candidate; you could make this file import one of the proto2 protos from this directory: https://github.com/protocolbuffers/protobuf/blob/master/ruby/tests/basic_test.proto

Then add a test in https://github.com/protocolbuffers/protobuf/blob/master/ruby/tests/basic.rb

@zhangskz zhangskz merged commit 740c4b0 into protocolbuffers:3.18.x Sep 22, 2021
bithium pushed a commit to bithium/protobuf that referenced this pull request Sep 4, 2023
…uffers#9003)

* Update ruby_generator.cc to allow proto2 imports in proto3, with updated unit tests

* Update Makefile.am with new ruby_generated_code_proto2_import.proto

* Fix ruby_generator unit test to use temporary test directory for imported protos

* Add test for imported proto2 to ruby/tests

* Fix proto_path, restore to ../src/protoc, and fix/cleanup unit test.

* Rename Proto2TestMessage to TestImportedMessage for consistency, for ruby compiler tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Protoc --ruby_out fails to generate a file with a message that contains a field of type google.protobuf.DescriptorProto

3 participants