Fix for descriptor_pb.rb: google/protobuf should be required first.

pull/9121/head
Joshua Haberman 3 years ago
parent 53a1d66d9d
commit 4c445b1803
  1. 5
      src/google/protobuf/compiler/ruby/ruby_generator.cc

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

Loading…
Cancel
Save