Implement option retention for Ruby

PiperOrigin-RevId: 529096272
pull/12472/head
Adam Cozzette 2 years ago committed by Copybara-Service
parent 7b22c57cef
commit d96032d1a5
  1. 1
      src/google/protobuf/compiler/ruby/BUILD.bazel
  2. 4
      src/google/protobuf/compiler/ruby/ruby_generator.cc

@ -20,6 +20,7 @@ cc_library(
"//src/google/protobuf:descriptor_legacy",
"//src/google/protobuf:protobuf_nowkt",
"//src/google/protobuf/compiler:code_generator",
"//src/google/protobuf/compiler:retention",
],
)

@ -39,6 +39,7 @@
#include "absl/log/absl_log.h"
#include "absl/strings/escaping.h"
#include "google/protobuf/compiler/plugin.h"
#include "google/protobuf/compiler/retention.h"
#include "google/protobuf/descriptor.h"
#include "google/protobuf/descriptor.pb.h"
#include "google/protobuf/descriptor_legacy.h"
@ -238,8 +239,7 @@ void EndPackageModules(int levels, io::Printer* printer) {
}
std::string SerializedDescriptor(const FileDescriptor* file) {
FileDescriptorProto file_proto;
file->CopyTo(&file_proto);
FileDescriptorProto file_proto = StripSourceRetentionOptions(*file);
std::string file_data;
file_proto.SerializeToString(&file_data);
return file_data;

Loading…
Cancel
Save