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