Mark grpc generators for editions support.
Edition 2023 makes no changes to method/service descriptors, so these should be unaffected and already supported. PiperOrigin-RevId: 615832918
This commit is contained in:
parent
24be69b9bd
commit
db51a3f69a
|
|
@ -40,8 +40,14 @@
|
|||
#ifndef GRPC_CUSTOM_DESCRIPTOR
|
||||
#include <google/protobuf/descriptor.h>
|
||||
#include <google/protobuf/descriptor.pb.h>
|
||||
#if GOOGLE_PROTOBUF_VERSION >= 4025000
|
||||
#define GRPC_PROTOBUF_EDITION_SUPPORT
|
||||
#endif
|
||||
#define GRPC_CUSTOM_DESCRIPTOR ::google::protobuf::Descriptor
|
||||
#define GRPC_CUSTOM_DESCRIPTORPOOL ::google::protobuf::DescriptorPool
|
||||
#ifdef GRPC_PROTOBUF_EDITION_SUPPORT
|
||||
#define GRPC_CUSTOM_EDITION ::google::protobuf::Edition
|
||||
#endif
|
||||
#define GRPC_CUSTOM_FIELDDESCRIPTOR ::google::protobuf::FieldDescriptor
|
||||
#define GRPC_CUSTOM_FILEDESCRIPTOR ::google::protobuf::FileDescriptor
|
||||
#define GRPC_CUSTOM_FILEDESCRIPTORPROTO ::google::protobuf::FileDescriptorProto
|
||||
|
|
@ -85,6 +91,9 @@ typedef GRPC_CUSTOM_MESSAGELITE MessageLite;
|
|||
typedef GRPC_CUSTOM_DESCRIPTOR Descriptor;
|
||||
typedef GRPC_CUSTOM_DESCRIPTORPOOL DescriptorPool;
|
||||
typedef GRPC_CUSTOM_DESCRIPTORDATABASE DescriptorDatabase;
|
||||
#ifdef GRPC_PROTOBUF_EDITION_SUPPORT
|
||||
typedef GRPC_CUSTOM_EDITION Edition;
|
||||
#endif
|
||||
typedef GRPC_CUSTOM_FIELDDESCRIPTOR FieldDescriptor;
|
||||
typedef GRPC_CUSTOM_FILEDESCRIPTOR FileDescriptor;
|
||||
typedef GRPC_CUSTOM_FILEDESCRIPTORPROTO FileDescriptorProto;
|
||||
|
|
|
|||
|
|
@ -34,8 +34,20 @@ class CppGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
|
|||
virtual ~CppGrpcGenerator() {}
|
||||
|
||||
uint64_t GetSupportedFeatures() const override {
|
||||
return FEATURE_PROTO3_OPTIONAL;
|
||||
return FEATURE_PROTO3_OPTIONAL
|
||||
#ifdef GRPC_PROTOBUF_EDITION_SUPPORT
|
||||
| FEATURE_SUPPORTS_EDITIONS
|
||||
#endif
|
||||
;
|
||||
}
|
||||
#ifdef GRPC_PROTOBUF_EDITION_SUPPORT
|
||||
grpc::protobuf::Edition GetMinimumEdition() const override {
|
||||
return grpc::protobuf::Edition::EDITION_PROTO2;
|
||||
}
|
||||
grpc::protobuf::Edition GetMaximumEdition() const override {
|
||||
return grpc::protobuf::Edition::EDITION_2023;
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual bool Generate(const grpc::protobuf::FileDescriptor* file,
|
||||
const std::string& parameter,
|
||||
|
|
|
|||
|
|
@ -30,9 +30,22 @@ class CSharpGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
|
|||
~CSharpGrpcGenerator() {}
|
||||
|
||||
uint64_t GetSupportedFeatures() const override {
|
||||
return FEATURE_PROTO3_OPTIONAL;
|
||||
return FEATURE_PROTO3_OPTIONAL
|
||||
#ifdef GRPC_PROTOBUF_EDITION_SUPPORT
|
||||
| FEATURE_SUPPORTS_EDITIONS
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
||||
#ifdef GRPC_PROTOBUF_EDITION_SUPPORT
|
||||
grpc::protobuf::Edition GetMinimumEdition() const override {
|
||||
return grpc::protobuf::Edition::EDITION_PROTO2;
|
||||
}
|
||||
grpc::protobuf::Edition GetMaximumEdition() const override {
|
||||
return grpc::protobuf::Edition::EDITION_2023;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool Generate(const grpc::protobuf::FileDescriptor* file,
|
||||
const std::string& parameter,
|
||||
grpc::protobuf::compiler::GeneratorContext* context,
|
||||
|
|
|
|||
|
|
@ -81,9 +81,22 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
|
|||
|
||||
public:
|
||||
uint64_t GetSupportedFeatures() const override {
|
||||
return FEATURE_PROTO3_OPTIONAL;
|
||||
return FEATURE_PROTO3_OPTIONAL
|
||||
#ifdef GRPC_PROTOBUF_EDITION_SUPPORT
|
||||
| FEATURE_SUPPORTS_EDITIONS
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
||||
#ifdef GRPC_PROTOBUF_EDITION_SUPPORT
|
||||
grpc::protobuf::Edition GetMinimumEdition() const override {
|
||||
return grpc::protobuf::Edition::EDITION_PROTO2;
|
||||
}
|
||||
grpc::protobuf::Edition GetMaximumEdition() const override {
|
||||
return grpc::protobuf::Edition::EDITION_2023;
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual bool Generate(const grpc::protobuf::FileDescriptor* file,
|
||||
const ::std::string& parameter,
|
||||
grpc::protobuf::compiler::GeneratorContext* context,
|
||||
|
|
|
|||
|
|
@ -34,9 +34,22 @@ class PHPGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
|
|||
~PHPGrpcGenerator() {}
|
||||
|
||||
uint64_t GetSupportedFeatures() const override {
|
||||
return FEATURE_PROTO3_OPTIONAL;
|
||||
return FEATURE_PROTO3_OPTIONAL
|
||||
#ifdef GRPC_PROTOBUF_EDITION_SUPPORT
|
||||
| FEATURE_SUPPORTS_EDITIONS
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
||||
#ifdef GRPC_PROTOBUF_EDITION_SUPPORT
|
||||
grpc::protobuf::Edition GetMinimumEdition() const override {
|
||||
return grpc::protobuf::Edition::EDITION_PROTO2;
|
||||
}
|
||||
grpc::protobuf::Edition GetMaximumEdition() const override {
|
||||
return grpc::protobuf::Edition::EDITION_2023;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool Generate(const grpc::protobuf::FileDescriptor* file,
|
||||
const std::string& parameter,
|
||||
grpc::protobuf::compiler::GeneratorContext* context,
|
||||
|
|
|
|||
|
|
@ -944,10 +944,6 @@ static bool ParseParameters(const std::string& parameter,
|
|||
return true;
|
||||
}
|
||||
|
||||
uint64_t PythonGrpcGenerator::GetSupportedFeatures() const {
|
||||
return FEATURE_PROTO3_OPTIONAL;
|
||||
}
|
||||
|
||||
bool PythonGrpcGenerator::Generate(const FileDescriptor* file,
|
||||
const std::string& parameter,
|
||||
GeneratorContext* context,
|
||||
|
|
|
|||
|
|
@ -46,7 +46,22 @@ class PythonGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
|
|||
PythonGrpcGenerator(const GeneratorConfiguration& config);
|
||||
~PythonGrpcGenerator();
|
||||
|
||||
uint64_t GetSupportedFeatures() const override;
|
||||
uint64_t GetSupportedFeatures() const override {
|
||||
return FEATURE_PROTO3_OPTIONAL
|
||||
#ifdef GRPC_PROTOBUF_EDITION_SUPPORT
|
||||
| FEATURE_SUPPORTS_EDITIONS
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
||||
#ifdef GRPC_PROTOBUF_EDITION_SUPPORT
|
||||
grpc::protobuf::Edition GetMinimumEdition() const override {
|
||||
return grpc::protobuf::Edition::EDITION_PROTO2;
|
||||
}
|
||||
grpc::protobuf::Edition GetMaximumEdition() const override {
|
||||
return grpc::protobuf::Edition::EDITION_2023;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool Generate(const grpc::protobuf::FileDescriptor* file,
|
||||
const std::string& parameter,
|
||||
|
|
|
|||
|
|
@ -30,9 +30,22 @@ class RubyGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
|
|||
~RubyGrpcGenerator() {}
|
||||
|
||||
uint64_t GetSupportedFeatures() const override {
|
||||
return FEATURE_PROTO3_OPTIONAL;
|
||||
return FEATURE_PROTO3_OPTIONAL
|
||||
#ifdef GRPC_PROTOBUF_EDITION_SUPPORT
|
||||
| FEATURE_SUPPORTS_EDITIONS
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
||||
#ifdef GRPC_PROTOBUF_EDITION_SUPPORT
|
||||
grpc::protobuf::Edition GetMinimumEdition() const override {
|
||||
return grpc::protobuf::Edition::EDITION_PROTO2;
|
||||
}
|
||||
grpc::protobuf::Edition GetMaximumEdition() const override {
|
||||
return grpc::protobuf::Edition::EDITION_2023;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool Generate(const grpc::protobuf::FileDescriptor* file,
|
||||
const std::string& /*parameter*/,
|
||||
grpc::protobuf::compiler::GeneratorContext* context,
|
||||
|
|
|
|||
Loading…
Reference in New Issue