diff --git a/src/google/protobuf/compiler/ruby/BUILD.bazel b/src/google/protobuf/compiler/ruby/BUILD.bazel index 520b691943..2aee20e96e 100644 --- a/src/google/protobuf/compiler/ruby/BUILD.bazel +++ b/src/google/protobuf/compiler/ruby/BUILD.bazel @@ -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", ], ) diff --git a/src/google/protobuf/compiler/ruby/ruby_generator.cc b/src/google/protobuf/compiler/ruby/ruby_generator.cc index 70a6a837d1..f95ec09099 100644 --- a/src/google/protobuf/compiler/ruby/ruby_generator.cc +++ b/src/google/protobuf/compiler/ruby/ruby_generator.cc @@ -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;