Merge pull request #9121 from haberman/rubyfix

Fix for descriptor_pb.rb: google/protobuf should be required first.
pull/9131/head
Joshua Haberman 3 years ago committed by GitHub
commit 912eb8b89e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      src/google/protobuf/compiler/ruby/ruby_generated_code_pb.rb
  2. 3
      src/google/protobuf/compiler/ruby/ruby_generated_code_proto2_pb.rb
  3. 11
      src/google/protobuf/compiler/ruby/ruby_generator.cc

@ -1,9 +1,10 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: ruby_generated_code.proto
require 'ruby_generated_code_proto2_import_pb'
require 'google/protobuf'
require 'ruby_generated_code_proto2_import_pb'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_file("ruby_generated_code.proto", :syntax => :proto3) do
add_message "A.B.C.TestMessage" do

@ -1,9 +1,10 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: ruby_generated_code_proto2.proto
require 'ruby_generated_code_proto2_import_pb'
require 'google/protobuf'
require 'ruby_generated_code_proto2_import_pb'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_file("ruby_generated_code_proto2.proto", :syntax => :proto2) do
add_message "A.B.C.TestMessage" do

@ -467,8 +467,6 @@ void EndPackageModules(int levels, io::Printer* printer) {
bool GenerateDslDescriptor(const FileDescriptor* file, io::Printer* printer,
std::string* error) {
printer->Print(
"require 'google/protobuf'\n\n");
printer->Print("Google::Protobuf::DescriptorPool.generated_pool.build do\n");
printer->Indent();
printer->Print("add_file(\"$filename$\", :syntax => :$syntax$) do\n",
@ -509,8 +507,13 @@ bool GenerateFile(const FileDescriptor* file, io::Printer* printer,
"\n",
"filename", file->name());
for (int i = 0; i < file->dependency_count(); i++) {
printer->Print("require '$name$'\n", "name", GetRequireName(file->dependency(i)->name()));
printer->Print("require 'google/protobuf'\n\n");
if (file->dependency_count() != 0) {
for (int i = 0; i < file->dependency_count(); i++) {
printer->Print("require '$name$'\n", "name", GetRequireName(file->dependency(i)->name()));
}
printer->Print("\n");
}
// TODO: Remove this when ruby supports extensions for proto2 syntax.

Loading…
Cancel
Save