mirror of https://github.com/grpc/grpc-java.git
Print compiler version number in generated files
This commit is contained in:
parent
511bea0568
commit
363e0f6cfc
|
|
@ -16,7 +16,7 @@ import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
|
|||
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
|
||||
|
||||
@javax.annotation.Generated(
|
||||
value = "by gRPC proto compiler",
|
||||
value = "by gRPC proto compiler (version 0.14.0-SNAPSHOT)",
|
||||
comments = "Source: services.proto")
|
||||
public class BenchmarkServiceGrpc {
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
|
|||
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
|
||||
|
||||
@javax.annotation.Generated(
|
||||
value = "by gRPC proto compiler",
|
||||
value = "by gRPC proto compiler (version 0.14.0-SNAPSHOT)",
|
||||
comments = "Source: services.proto")
|
||||
public class WorkerServiceGrpc {
|
||||
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ model {
|
|||
binaries {
|
||||
all {
|
||||
if (toolChain in Gcc || toolChain in Clang) {
|
||||
cppCompiler.define("GRPC_VERSION", version)
|
||||
cppCompiler.args "--std=c++0x"
|
||||
addEnvArgs("CXXFLAGS", cppCompiler.args)
|
||||
addEnvArgs("CPPFLAGS", cppCompiler.args)
|
||||
|
|
@ -95,6 +96,7 @@ model {
|
|||
}
|
||||
addEnvArgs("LDFLAGS", linker.args)
|
||||
} else if (toolChain in VisualCpp) {
|
||||
cppCompiler.define("GRPC_VERSION", version)
|
||||
cppCompiler.args "/EHsc", "/MT"
|
||||
if (rootProject.hasProperty('vcProtobufInclude')) {
|
||||
cppCompiler.args "/I${rootProject.vcProtobufInclude}"
|
||||
|
|
|
|||
|
|
@ -9,6 +9,15 @@
|
|||
#include <google/protobuf/io/printer.h>
|
||||
#include <google/protobuf/io/zero_copy_stream.h>
|
||||
|
||||
// Stringify helpers used solely to cast GRPC_VERSION
|
||||
#ifndef STR
|
||||
#define STR(s) #s
|
||||
#endif
|
||||
|
||||
#ifndef XSTR
|
||||
#define XSTR(s) STR(s)
|
||||
#endif
|
||||
|
||||
namespace java_grpc_generator {
|
||||
|
||||
using google::protobuf::FileDescriptor;
|
||||
|
|
@ -698,10 +707,15 @@ static void PrintService(const ServiceDescriptor* service,
|
|||
(*vars)["service_name"] = service->name();
|
||||
(*vars)["file_name"] = service->file()->name();
|
||||
(*vars)["service_class_name"] = ServiceClassName(service);
|
||||
#ifdef GRPC_VERSION
|
||||
(*vars)["grpc_version"] = " (version " XSTR(GRPC_VERSION) ")";
|
||||
#else
|
||||
(*vars)["grpc_version"] = "";
|
||||
#endif
|
||||
p->Print(
|
||||
*vars,
|
||||
"@$Generated$(\n"
|
||||
" value = \"by gRPC proto compiler\",\n"
|
||||
" value = \"by gRPC proto compiler$grpc_version$\",\n"
|
||||
" comments = \"Source: $file_name$\")\n"
|
||||
"public class $service_class_name$ {\n\n");
|
||||
p->Indent();
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
|
|||
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
|
||||
|
||||
@javax.annotation.Generated(
|
||||
value = "by gRPC proto compiler",
|
||||
value = "by gRPC proto compiler (version 0.14.0-SNAPSHOT)",
|
||||
comments = "Source: test.proto")
|
||||
public class TestServiceGrpc {
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
|
|||
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
|
||||
|
||||
@javax.annotation.Generated(
|
||||
value = "by gRPC proto compiler",
|
||||
value = "by gRPC proto compiler (version 0.14.0-SNAPSHOT)",
|
||||
comments = "Source: test.proto")
|
||||
public class TestServiceGrpc {
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
|
|||
import java.io.IOException;
|
||||
|
||||
@javax.annotation.Generated(
|
||||
value = "by gRPC proto compiler",
|
||||
value = "by gRPC proto compiler (version 0.14.0-SNAPSHOT)",
|
||||
comments = "Source: test.proto")
|
||||
public class TestServiceGrpc {
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
|
|||
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
|
||||
|
||||
@javax.annotation.Generated(
|
||||
value = "by gRPC proto compiler",
|
||||
value = "by gRPC proto compiler (version 0.14.0-SNAPSHOT)",
|
||||
comments = "Source: helloworld.proto")
|
||||
public class GreeterGrpc {
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
|
|||
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
|
||||
|
||||
@javax.annotation.Generated(
|
||||
value = "by gRPC proto compiler",
|
||||
value = "by gRPC proto compiler (version 0.14.0-SNAPSHOT)",
|
||||
comments = "Source: route_guide.proto")
|
||||
public class RouteGuideGrpc {
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
|
|||
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
|
||||
|
||||
@javax.annotation.Generated(
|
||||
value = "by gRPC proto compiler",
|
||||
value = "by gRPC proto compiler (version 0.14.0-SNAPSHOT)",
|
||||
comments = "Source: load_balancer.proto")
|
||||
public class LoadBalancerGrpc {
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
|
|||
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
|
||||
|
||||
@javax.annotation.Generated(
|
||||
value = "by gRPC proto compiler",
|
||||
value = "by gRPC proto compiler (version 0.14.0-SNAPSHOT)",
|
||||
comments = "Source: io/grpc/testing/integration/test.proto")
|
||||
public class ReconnectServiceGrpc {
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
|
|||
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
|
||||
|
||||
@javax.annotation.Generated(
|
||||
value = "by gRPC proto compiler",
|
||||
value = "by gRPC proto compiler (version 0.14.0-SNAPSHOT)",
|
||||
comments = "Source: io/grpc/testing/integration/test.proto")
|
||||
public class TestServiceGrpc {
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
|
|||
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
|
||||
|
||||
@javax.annotation.Generated(
|
||||
value = "by gRPC proto compiler",
|
||||
value = "by gRPC proto compiler (version 0.14.0-SNAPSHOT)",
|
||||
comments = "Source: io/grpc/testing/integration/test.proto")
|
||||
public class UnimplementedServiceGrpc {
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue