diff options
author | Harsh Vardhan <harshvd95@gmail.com> | 2017-01-14 15:19:09 +0530 |
---|---|---|
committer | Harsh Vardhan <harshvd95@gmail.com> | 2017-03-28 21:01:51 +0530 |
commit | 64741b279e37ed5171d05719af921fcc8cb5ba0d (patch) | |
tree | 0c5a5f0bd254c66724c4ad96a87eb3d73df6d90d /src/compiler | |
parent | 93077aefbcb23bfd8df200db749ce6172a44844a (diff) |
Fix build issues
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/protobuf_plugin.h | 6 | ||||
-rw-r--r-- | src/compiler/python_generator.cc | 10 | ||||
-rw-r--r-- | src/compiler/python_generator_helpers.h | 10 | ||||
-rw-r--r-- | src/compiler/schema_interface.h | 3 |
4 files changed, 22 insertions, 7 deletions
diff --git a/src/compiler/protobuf_plugin.h b/src/compiler/protobuf_plugin.h index bcc3355db3..f9ce694d18 100644 --- a/src/compiler/protobuf_plugin.h +++ b/src/compiler/protobuf_plugin.h @@ -10,8 +10,6 @@ #include <vector> -using grpc::protobuf::Descriptor; - // Get leading or trailing comments in a string. template <typename DescriptorType> inline grpc::string GetCommentsHelper(const DescriptorType *desc, bool leading, @@ -93,6 +91,10 @@ class ProtoBufService : public grpc_generator::Service { return std::unique_ptr<const grpc_generator::Method>( new ProtoBufMethod(service_->method(i))); }; + std::unique_ptr<const grpc::protobuf::MethodDescriptor> get_method(int i) const { + return std::unique_ptr<const grpc::protobuf::MethodDescriptor>( + service_->method(i)); + }; grpc::string GetLeadingComments(const grpc::string prefix) const { return GetCommentsHelper(service_, true, prefix); diff --git a/src/compiler/python_generator.cc b/src/compiler/python_generator.cc index ff4a83e2a4..63210fdbee 100644 --- a/src/compiler/python_generator.cc +++ b/src/compiler/python_generator.cc @@ -49,7 +49,6 @@ #include "src/compiler/schema_interface.h" #include "src/compiler/generator_helpers.h" #include "src/compiler/protobuf_plugin.h" -#include "src/compiler/python_generator.h" #include "src/compiler/python_private_generator.h" #include "src/compiler/python_generator_helpers.h" @@ -75,6 +74,8 @@ using std::set; namespace grpc_python_generator { +grpc::string generator_file_name; + namespace { typedef vector<const Descriptor*> DescriptorVector; @@ -83,8 +84,6 @@ typedef vector<grpc::string> StringVector; typedef tuple<grpc::string, grpc::string> StringPair; typedef set<StringPair> StringPairSet; -grpc::string generator_file_name; - // Provides RAII indentation handling. Use as: // { // IndentScope raii_my_indent_var_name_here(my_py_printer); @@ -577,7 +576,7 @@ bool PrivateGenerator::PrintPreamble() { for (int i = 0; i < file->service_count(); ++i) { auto service = file->service(i).get(); for (int j = 0; j < service->method_count(); ++j) { - const MethodDescriptor* method = (MethodDescriptor*)service->method(j).get(); + const MethodDescriptor* method = service->get_method(j).get(); const Descriptor* types[2] = {method->input_type(), method->output_type()}; for (int k = 0; k < 2; ++k) { @@ -740,7 +739,8 @@ bool PythonGrpcGenerator::Generate(const FileDescriptor* file, } generator_file_name = file->name(); - PrivateGenerator generator(config_, file); + ProtoBufFile pbfile(file); + PrivateGenerator generator(config_, &pbfile); if (parameter == "grpc_2_0") { return GenerateGrpc(context, generator, pb2_grpc_file_name, true); } else if (parameter == "") { diff --git a/src/compiler/python_generator_helpers.h b/src/compiler/python_generator_helpers.h index a6cc285d26..1a5dde9d6b 100644 --- a/src/compiler/python_generator_helpers.h +++ b/src/compiler/python_generator_helpers.h @@ -40,6 +40,7 @@ #include <vector> #include "src/compiler/config.h" +#include "src/compiler/python_generator.h" #include "src/compiler/python_private_generator.h" #include "src/compiler/generator_helpers.h" @@ -48,6 +49,15 @@ using grpc_generator::StripProto; using grpc::protobuf::Descriptor; using std::vector; +using grpc::protobuf::FileDescriptor; +using grpc::protobuf::MethodDescriptor; +using grpc::protobuf::ServiceDescriptor; +using grpc::protobuf::compiler::GeneratorContext; +using grpc::protobuf::io::CodedOutputStream; +using grpc::protobuf::io::Printer; +using grpc::protobuf::io::StringOutputStream; +using grpc::protobuf::io::ZeroCopyOutputStream; + namespace grpc_python_generator { namespace { diff --git a/src/compiler/schema_interface.h b/src/compiler/schema_interface.h index ca4722bfe1..3530950bdf 100644 --- a/src/compiler/schema_interface.h +++ b/src/compiler/schema_interface.h @@ -34,6 +34,8 @@ #ifndef GRPC_INTERNAL_COMPILER_SCHEMA_INTERFACE_H #define GRPC_INTERNAL_COMPILER_SCHEMA_INTERFACE_H +#include "src/compiler/config.h" + #include <memory> #include <vector> @@ -89,6 +91,7 @@ namespace grpc_generator { virtual int method_count() const = 0; virtual std::unique_ptr<const Method> method(int i) const = 0; + virtual std::unique_ptr<const grpc::protobuf::MethodDescriptor> get_method(int i) const = 0; }; struct Printer { |