Skip to content
Snippets Groups Projects
Unverified Commit 64741b27 authored by Harsh Vardhan's avatar Harsh Vardhan
Browse files

Fix build issues

parent 93077aef
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
......
......@@ -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 == "") {
......
......
......@@ -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 {
......
......
......@@ -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 {
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment