Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions compiler/src/dlang_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ static void GenerateService(const std::string &module , CodedOutputStream &cos,c
cos.WriteString("\n");

/// service's process
cos.WriteString("\tStatus process(string method , GrpcStream stream)\n");
cos.WriteString("\tStatus process(string method , GrpcStream stream, ubyte[] complete)\n");
cos.WriteString("\t{\n");
cos.WriteString("\t\tswitch(method)\n");
cos.WriteString("\t\t{\n");
Expand Down Expand Up @@ -229,9 +229,9 @@ class DlangGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
{
auto dep = file->dependency(i);
if(dep->package() != "")
cos.WriteString("import " + dep->package() + "." + grpc_generator::StripProto(dep->name()) + ";\n");
cos.WriteString("import " + dep->package() + "." + grpc_generator::StripProtoAndPath(dep->name()) + ";\n");
else
cos.WriteString("import " + grpc_generator::StripProto(dep->name()) + ";\n");
cos.WriteString("import " + grpc_generator::StripProtoAndPath(dep->name()) + ";\n");
}

cos.WriteString("\n\n");
Expand Down
14 changes: 14 additions & 0 deletions compiler/src/generator_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,20 @@ inline grpc::string StripProto(grpc::string filename) {
return filename;
}

inline grpc::string StripProtoAndPath(grpc::string filename) {
if (!StripSuffix(&filename, ".protodevel")) {
StripSuffix(&filename, ".proto");
}

for (size_t i = filename.size(); i > 0; --i) {
if (filename[i-1] == '\\' || filename[i-1] == '/') {
return filename.substr(i);
}
}

return filename;
}

inline grpc::string StringReplace(grpc::string str, const grpc::string& from,
const grpc::string& to, bool replace_all) {
size_t pos = 0;
Expand Down
2 changes: 1 addition & 1 deletion source/grpc/GrpcCode.d
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ string CMA(O , string service , string funcs = __FUNCTION__)()
string func = GetFunc(funcs);
string code =
`auto stream = _channel.createStream("/`~ service ~`/`~func~`");
stream.setCallBack(dele);
stream.setCallBack(cast(void delegate(ubyte[]))dele);
stream.write(request , false);`;
return code;
}
Expand Down