From a967ee567e24c998b45560ba3e32032d7791649b Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 25 Apr 2016 14:51:05 -0700 Subject: [PATCH] support custom parsegeneratorparameter --- src/compiler/config.h | 10 ++++++++++ src/compiler/csharp_plugin.cc | 3 +++ 2 files changed, 13 insertions(+) diff --git a/src/compiler/config.h b/src/compiler/config.h index fea976c3181..a31dc24f6de 100644 --- a/src/compiler/config.h +++ b/src/compiler/config.h @@ -68,6 +68,11 @@ #define GRPC_CUSTOM_PLUGINMAIN ::google::protobuf::compiler::PluginMain #endif +#ifndef GRPC_CUSTOM_PARSEGENERATORPARAMETER +#include +#define GRPC_CUSTOM_PARSEGENERATORPARAMETER ::google::protobuf::compiler::ParseGeneratorParameter +#endif + namespace grpc { namespace protobuf { typedef GRPC_CUSTOM_DESCRIPTOR Descriptor; @@ -81,6 +86,11 @@ static inline int PluginMain(int argc, char* argv[], const CodeGenerator* generator) { return GRPC_CUSTOM_PLUGINMAIN(argc, argv, generator); } +static inline void ParseGeneratorParameter(const string& parameter, + std::vector >* options) { + GRPC_CUSTOM_PARSEGENERATORPARAMETER(parameter, options); +} + } // namespace compiler namespace io { typedef GRPC_CUSTOM_PRINTER Printer; diff --git a/src/compiler/csharp_plugin.cc b/src/compiler/csharp_plugin.cc index 8b9395f9e2b..bc86fbd616d 100644 --- a/src/compiler/csharp_plugin.cc +++ b/src/compiler/csharp_plugin.cc @@ -48,6 +48,9 @@ class CSharpGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { const grpc::string ¶meter, grpc::protobuf::compiler::GeneratorContext *context, grpc::string *error) const { + std::vector > options; + grpc::protobuf::compiler::ParseGeneratorParameter(parameter, &options); + grpc::string code = grpc_csharp_generator::GetServices(file); if (code.size() == 0) { return true; // don't generate a file if there are no services