Skip to content

Commit

Permalink
Update ruby_generator.cc to allow proto2 imports in proto3 (protocolb…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
zhangskz committed Sep 22, 2021
1 parent 1ab2297 commit 14809f5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions google/protobuf/compiler/ruby/ruby_generated_code.proto
Expand Up @@ -2,6 +2,8 @@ syntax = "proto3";

package A.B.C;

import "ruby_generated_code_proto2_import.proto";

message TestMessage {
int32 optional_int32 = 1;
int64 optional_int64 = 2;
Expand All @@ -14,6 +16,7 @@ message TestMessage {
bytes optional_bytes = 9;
TestEnum optional_enum = 10;
TestMessage optional_msg = 11;
TestImportedMessage optional_proto2_submessage = 12;

repeated int32 repeated_int32 = 21;
repeated int64 repeated_int64 = 22;
Expand Down
Expand Up @@ -2,6 +2,8 @@ syntax = "proto2";

package A.B.C;

import "ruby_generated_code_proto2_import.proto";

message TestMessage {
optional int32 optional_int32 = 1 [default = 1];
optional int64 optional_int64 = 2 [default = 2];
Expand All @@ -14,6 +16,7 @@ message TestMessage {
optional bytes optional_bytes = 9 [default = "\0\1\2\100fubar"];
optional TestEnum optional_enum = 10 [default = A];
optional TestMessage optional_msg = 11;
optional TestImportedMessage optional_proto2_submessage = 12;

repeated int32 repeated_int32 = 21;
repeated int64 repeated_int64 = 22;
Expand Down
@@ -0,0 +1,5 @@
syntax = "proto2";

package A.B.C;

message TestImportedMessage {}

0 comments on commit 14809f5

Please sign in to comment.