Skip to content

Commit

Permalink
Implement option retention for Ruby
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 529096272
  • Loading branch information
acozzette authored and copybara-github committed May 3, 2023
1 parent 7b22c57 commit d96032d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/google/protobuf/compiler/ruby/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
],
)

Expand Down
4 changes: 2 additions & 2 deletions src/google/protobuf/compiler/ruby/ruby_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit d96032d

Please sign in to comment.