mirror of https://github.com/grpc/grpc-java.git
Populate the pb::java feature extension to gprc proto plugin (#11885)
Populate the pb::java feature extension to the protoc plugins that require Protobuf Java feature resolution for the edition.
This commit is contained in:
parent
fca1d3cf43
commit
b69bd64ce7
|
|
@ -23,6 +23,9 @@
|
||||||
|
|
||||||
#include "java_generator.h"
|
#include "java_generator.h"
|
||||||
#include <google/protobuf/compiler/code_generator.h>
|
#include <google/protobuf/compiler/code_generator.h>
|
||||||
|
#if GOOGLE_PROTOBUF_VERSION >= 5027000
|
||||||
|
#include <google/protobuf/compiler/java/java_features.pb.h>
|
||||||
|
#endif
|
||||||
#include <google/protobuf/compiler/plugin.h>
|
#include <google/protobuf/compiler/plugin.h>
|
||||||
#include <google/protobuf/descriptor.h>
|
#include <google/protobuf/descriptor.h>
|
||||||
#include <google/protobuf/io/zero_copy_stream.h>
|
#include <google/protobuf/io/zero_copy_stream.h>
|
||||||
|
|
@ -57,6 +60,10 @@ class JavaGrpcGenerator : public protobuf::compiler::CodeGenerator {
|
||||||
protobuf::Edition GetMaximumEdition() const override {
|
protobuf::Edition GetMaximumEdition() const override {
|
||||||
return protobuf::Edition::EDITION_2023;
|
return protobuf::Edition::EDITION_2023;
|
||||||
}
|
}
|
||||||
|
std::vector<const protobuf::FieldDescriptor*> GetFeatureExtensions()
|
||||||
|
const override {
|
||||||
|
return {GetExtensionReflection(pb::java)};
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
uint64_t GetSupportedFeatures() const override {
|
uint64_t GetSupportedFeatures() const override {
|
||||||
return Feature::FEATURE_PROTO3_OPTIONAL;
|
return Feature::FEATURE_PROTO3_OPTIONAL;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue