summaryrefslogtreecommitdiff
path: root/grpc
diff options
context:
space:
mode:
authorPanagiotis Gourgaris <pgourgaris@gmail.com>2021-12-19 04:23:28 +0200
committerGitHub <noreply@github.com>2021-12-18 18:23:28 -0800
commitb3edfdbfb76068f85cb18c81ddf245e90f3143e1 (patch)
treec30af2e2e6103cab63f6f8bf20472c0a73a31995 /grpc
parentb8aaccee8248059b2af032cca0eb1d2ddbdb6cdc (diff)
downloadflatbuffers-b3edfdbfb76068f85cb18c81ddf245e90f3143e1.tar.gz
flatbuffers-b3edfdbfb76068f85cb18c81ddf245e90f3143e1.tar.bz2
flatbuffers-b3edfdbfb76068f85cb18c81ddf245e90f3143e1.zip
Reverting grpc generated file suffix (#6995)
* Reverting grpc generated file suffix * - Setting the greeter sample as it was - Reverting the include of the generated message in grpc.cc file
Diffstat (limited to 'grpc')
-rw-r--r--grpc/samples/greeter/Makefile6
-rw-r--r--grpc/src/compiler/cpp_generator.cc2
2 files changed, 5 insertions, 3 deletions
diff --git a/grpc/samples/greeter/Makefile b/grpc/samples/greeter/Makefile
index 37467055..910483ca 100644
--- a/grpc/samples/greeter/Makefile
+++ b/grpc/samples/greeter/Makefile
@@ -4,11 +4,11 @@ LDFLAGS ?=
.PHONY: all
all: server client
-greeter_generated.h: greeter.fbs
+greeter_generated: greeter.fbs
flatc --grpc --cpp $<
-server: server.cpp greeter.grpc.fb.cc greeter_generated.h greeter.grpc.fb.h
+server: greeter_generated server.cpp greeter.grpc.fb.cc greeter.grpc.fb.h
g++ -std=c++11 -O2 $(CXXFLAGS) $(LDFLAGS) -lgpr -lgrpc -lgrpc++ server.cpp greeter.grpc.fb.cc -o $@
-client: client.cpp greeter.grpc.fb.cc greeter_generated.h greeter.grpc.fb.h
+client: greeter_generated client.cpp greeter.grpc.fb.cc greeter.grpc.fb.h
g++ -std=c++11 -O2 $(CXXFLAGS) $(LDFLAGS) -lgpr -lgrpc -lgrpc++ client.cpp greeter.grpc.fb.cc -o $@
diff --git a/grpc/src/compiler/cpp_generator.cc b/grpc/src/compiler/cpp_generator.cc
index 3f434258..5d3e9077 100644
--- a/grpc/src/compiler/cpp_generator.cc
+++ b/grpc/src/compiler/cpp_generator.cc
@@ -1155,6 +1155,7 @@ grpc::string GetSourcePrologue(grpc_generator::File *file,
vars["filename"] = file->filename();
vars["filename_base"] = file->filename_without_ext();
+ vars["message_header_ext"] = file->message_header_ext();
vars["service_header_ext"] = file->service_header_ext();
printer->Print(vars, "// Generated by the gRPC C++ plugin.\n");
@@ -1162,6 +1163,7 @@ grpc::string GetSourcePrologue(grpc_generator::File *file,
"// If you make any local change, they will be lost.\n");
printer->Print(vars, "// source: $filename$\n\n");
+ printer->Print(vars, "#include \"$filename_base$$message_header_ext$\"\n");
printer->Print(vars, "#include \"$filename_base$$service_header_ext$\"\n");
printer->Print(vars, "\n");
}