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
pull/36081/head
Mike Kruskal 9 months ago committed by Copybara-Service
parent 24be69b9bd
commit db51a3f69a
  1. 9
      include/grpcpp/impl/codegen/config_protobuf.h
  2. 14
      src/compiler/cpp_plugin.h
  3. 15
      src/compiler/csharp_plugin.cc
  4. 15
      src/compiler/objective_c_plugin.cc
  5. 15
      src/compiler/php_plugin.cc
  6. 4
      src/compiler/python_generator.cc
  7. 17
      src/compiler/python_generator.h
  8. 15
      src/compiler/ruby_plugin.cc

@ -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,8 +81,21 @@ 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,

@ -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…
Cancel
Save