diff --git a/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/BenchmarkServiceGrpc.java b/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/BenchmarkServiceGrpc.java index 9e2f2e677a..d0ecea4601 100644 --- a/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/BenchmarkServiceGrpc.java +++ b/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/BenchmarkServiceGrpc.java @@ -18,7 +18,7 @@ import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall; /** */ @javax.annotation.Generated( - value = "by gRPC proto compiler (version 1.7.0-SNAPSHOT)", + value = "by gRPC proto compiler", comments = "Source: services.proto") public final class BenchmarkServiceGrpc { diff --git a/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/ReportQpsScenarioServiceGrpc.java b/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/ReportQpsScenarioServiceGrpc.java index 8f3fefd472..184556ada9 100644 --- a/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/ReportQpsScenarioServiceGrpc.java +++ b/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/ReportQpsScenarioServiceGrpc.java @@ -18,7 +18,7 @@ import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall; /** */ @javax.annotation.Generated( - value = "by gRPC proto compiler (version 1.7.0-SNAPSHOT)", + value = "by gRPC proto compiler", comments = "Source: services.proto") public final class ReportQpsScenarioServiceGrpc { diff --git a/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/WorkerServiceGrpc.java b/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/WorkerServiceGrpc.java index 63296e1d66..314e1ba797 100644 --- a/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/WorkerServiceGrpc.java +++ b/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/WorkerServiceGrpc.java @@ -18,7 +18,7 @@ import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall; /** */ @javax.annotation.Generated( - value = "by gRPC proto compiler (version 1.7.0-SNAPSHOT)", + value = "by gRPC proto compiler", comments = "Source: services.proto") public final class WorkerServiceGrpc { diff --git a/build.gradle b/build.gradle index 469a269040..406efd3210 100644 --- a/build.gradle +++ b/build.gradle @@ -130,6 +130,7 @@ subprojects { // To generate deprecated interfaces and static bindService method, // turn the enable_deprecated option to true below: option 'enable_deprecated=false' + option 'noversion' } } } diff --git a/compiler/src/java_plugin/cpp/java_generator.cpp b/compiler/src/java_plugin/cpp/java_generator.cpp index a37f0692d2..b06d91cfc9 100644 --- a/compiler/src/java_plugin/cpp/java_generator.cpp +++ b/compiler/src/java_plugin/cpp/java_generator.cpp @@ -1023,14 +1023,16 @@ static void PrintService(const ServiceDescriptor* service, std::map* vars, Printer* p, ProtoFlavor flavor, - bool enable_deprecated) { + bool enable_deprecated, + bool disable_version) { (*vars)["service_name"] = service->name(); (*vars)["file_name"] = service->file()->name(); (*vars)["service_class_name"] = ServiceClassName(service); + (*vars)["grpc_version"] = ""; #ifdef GRPC_VERSION + if (!disable_version) { (*vars)["grpc_version"] = " (version " XSTR(GRPC_VERSION) ")"; - #else - (*vars)["grpc_version"] = ""; + } #endif // TODO(nmittler): Replace with WriteServiceDocComment once included by protobuf distro. GrpcWriteServiceDocComment(p, service); @@ -1168,7 +1170,8 @@ void PrintImports(Printer* p, bool generate_nano) { void GenerateService(const ServiceDescriptor* service, google::protobuf::io::ZeroCopyOutputStream* out, ProtoFlavor flavor, - bool enable_deprecated) { + bool enable_deprecated, + bool disable_version) { // All non-generated classes must be referred by fully qualified names to // avoid collision with generated classes. std::map vars; @@ -1212,7 +1215,7 @@ void GenerateService(const ServiceDescriptor* service, if (!vars["Package"].empty()) { vars["Package"].append("."); } - PrintService(service, &vars, &printer, flavor, enable_deprecated); + PrintService(service, &vars, &printer, flavor, enable_deprecated, disable_version); } string ServiceJavaPackage(const FileDescriptor* file, bool nano) { diff --git a/compiler/src/java_plugin/cpp/java_generator.h b/compiler/src/java_plugin/cpp/java_generator.h index f82805d8ce..f26628d654 100644 --- a/compiler/src/java_plugin/cpp/java_generator.h +++ b/compiler/src/java_plugin/cpp/java_generator.h @@ -50,7 +50,8 @@ string ServiceClassName(const google::protobuf::ServiceDescriptor* service); void GenerateService(const google::protobuf::ServiceDescriptor* service, google::protobuf::io::ZeroCopyOutputStream* out, ProtoFlavor flavor, - bool enable_deprecated); + bool enable_deprecated, + bool disable_version); } // namespace java_grpc_generator diff --git a/compiler/src/java_plugin/cpp/java_plugin.cpp b/compiler/src/java_plugin/cpp/java_plugin.cpp index 2fc246d373..7c70754bf6 100644 --- a/compiler/src/java_plugin/cpp/java_plugin.cpp +++ b/compiler/src/java_plugin/cpp/java_plugin.cpp @@ -38,6 +38,7 @@ class JavaGrpcGenerator : public google::protobuf::compiler::CodeGenerator { java_grpc_generator::ProtoFlavor::NORMAL; bool enable_deprecated = false; + bool disable_version = false; for (size_t i = 0; i < options.size(); i++) { if (options[i].first == "nano") { flavor = java_grpc_generator::ProtoFlavor::NANO; @@ -45,6 +46,8 @@ class JavaGrpcGenerator : public google::protobuf::compiler::CodeGenerator { flavor = java_grpc_generator::ProtoFlavor::LITE; } else if (options[i].first == "enable_deprecated") { enable_deprecated = options[i].second == "true"; + } else if (options[i].first == "noversion") { + disable_version = true; } } @@ -57,7 +60,8 @@ class JavaGrpcGenerator : public google::protobuf::compiler::CodeGenerator { + java_grpc_generator::ServiceClassName(service) + ".java"; std::unique_ptr output( context->Open(filename)); - java_grpc_generator::GenerateService(service, output.get(), flavor, enable_deprecated); + java_grpc_generator::GenerateService( + service, output.get(), flavor, enable_deprecated, disable_version); } return true; } diff --git a/grpclb/src/generated/main/grpc/io/grpc/grpclb/LoadBalancerGrpc.java b/grpclb/src/generated/main/grpc/io/grpc/grpclb/LoadBalancerGrpc.java index c87d2a563b..5f5406728d 100644 --- a/grpclb/src/generated/main/grpc/io/grpc/grpclb/LoadBalancerGrpc.java +++ b/grpclb/src/generated/main/grpc/io/grpc/grpclb/LoadBalancerGrpc.java @@ -18,7 +18,7 @@ import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall; /** */ @javax.annotation.Generated( - value = "by gRPC proto compiler (version 1.7.0-SNAPSHOT)", + value = "by gRPC proto compiler", comments = "Source: load_balancer.proto") public final class LoadBalancerGrpc { diff --git a/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/MetricsServiceGrpc.java b/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/MetricsServiceGrpc.java index 19c35b88b9..f80b096687 100644 --- a/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/MetricsServiceGrpc.java +++ b/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/MetricsServiceGrpc.java @@ -18,7 +18,7 @@ import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall; /** */ @javax.annotation.Generated( - value = "by gRPC proto compiler (version 1.7.0-SNAPSHOT)", + value = "by gRPC proto compiler", comments = "Source: io/grpc/testing/integration/metrics.proto") public final class MetricsServiceGrpc { diff --git a/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/ReconnectServiceGrpc.java b/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/ReconnectServiceGrpc.java index 433687e11b..911c55af2e 100644 --- a/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/ReconnectServiceGrpc.java +++ b/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/ReconnectServiceGrpc.java @@ -21,7 +21,7 @@ import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall; * */ @javax.annotation.Generated( - value = "by gRPC proto compiler (version 1.7.0-SNAPSHOT)", + value = "by gRPC proto compiler", comments = "Source: io/grpc/testing/integration/test.proto") public final class ReconnectServiceGrpc { diff --git a/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/TestServiceGrpc.java b/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/TestServiceGrpc.java index 642e64f56b..540630a566 100644 --- a/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/TestServiceGrpc.java +++ b/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/TestServiceGrpc.java @@ -22,7 +22,7 @@ import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall; * */ @javax.annotation.Generated( - value = "by gRPC proto compiler (version 1.7.0-SNAPSHOT)", + value = "by gRPC proto compiler", comments = "Source: io/grpc/testing/integration/test.proto") public final class TestServiceGrpc { diff --git a/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/UnimplementedServiceGrpc.java b/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/UnimplementedServiceGrpc.java index 4b53301a50..1d26f3d1ca 100644 --- a/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/UnimplementedServiceGrpc.java +++ b/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/UnimplementedServiceGrpc.java @@ -22,7 +22,7 @@ import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall; * */ @javax.annotation.Generated( - value = "by gRPC proto compiler (version 1.7.0-SNAPSHOT)", + value = "by gRPC proto compiler", comments = "Source: io/grpc/testing/integration/test.proto") public final class UnimplementedServiceGrpc { diff --git a/services/src/generated/main/grpc/io/grpc/health/v1/HealthGrpc.java b/services/src/generated/main/grpc/io/grpc/health/v1/HealthGrpc.java index f33d1bfde1..ebe9d42ba1 100644 --- a/services/src/generated/main/grpc/io/grpc/health/v1/HealthGrpc.java +++ b/services/src/generated/main/grpc/io/grpc/health/v1/HealthGrpc.java @@ -18,7 +18,7 @@ import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall; /** */ @javax.annotation.Generated( - value = "by gRPC proto compiler (version 1.7.0-SNAPSHOT)", + value = "by gRPC proto compiler", comments = "Source: health.proto") public final class HealthGrpc { diff --git a/services/src/generated/main/grpc/io/grpc/instrumentation/v1alpha/MonitoringGrpc.java b/services/src/generated/main/grpc/io/grpc/instrumentation/v1alpha/MonitoringGrpc.java index e046012f6c..f2b3ad2150 100644 --- a/services/src/generated/main/grpc/io/grpc/instrumentation/v1alpha/MonitoringGrpc.java +++ b/services/src/generated/main/grpc/io/grpc/instrumentation/v1alpha/MonitoringGrpc.java @@ -18,7 +18,7 @@ import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall; /** */ @javax.annotation.Generated( - value = "by gRPC proto compiler (version 1.7.0-SNAPSHOT)", + value = "by gRPC proto compiler", comments = "Source: grpc/instrumentation/v1alpha/monitoring.proto") public final class MonitoringGrpc { diff --git a/services/src/generated/main/grpc/io/grpc/reflection/v1alpha/ServerReflectionGrpc.java b/services/src/generated/main/grpc/io/grpc/reflection/v1alpha/ServerReflectionGrpc.java index 980d3f58e3..20291785f2 100644 --- a/services/src/generated/main/grpc/io/grpc/reflection/v1alpha/ServerReflectionGrpc.java +++ b/services/src/generated/main/grpc/io/grpc/reflection/v1alpha/ServerReflectionGrpc.java @@ -18,7 +18,7 @@ import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall; /** */ @javax.annotation.Generated( - value = "by gRPC proto compiler (version 1.7.0-SNAPSHOT)", + value = "by gRPC proto compiler", comments = "Source: io/grpc/reflection/v1alpha/reflection.proto") public final class ServerReflectionGrpc { diff --git a/services/src/generated/test/grpc/io/grpc/reflection/testing/AnotherDynamicServiceGrpc.java b/services/src/generated/test/grpc/io/grpc/reflection/testing/AnotherDynamicServiceGrpc.java index 8a78213436..3c65835f22 100644 --- a/services/src/generated/test/grpc/io/grpc/reflection/testing/AnotherDynamicServiceGrpc.java +++ b/services/src/generated/test/grpc/io/grpc/reflection/testing/AnotherDynamicServiceGrpc.java @@ -21,7 +21,7 @@ import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall; * */ @javax.annotation.Generated( - value = "by gRPC proto compiler (version 1.7.0-SNAPSHOT)", + value = "by gRPC proto compiler", comments = "Source: io/grpc/reflection/testing/dynamic_reflection_test.proto") public final class AnotherDynamicServiceGrpc { diff --git a/services/src/generated/test/grpc/io/grpc/reflection/testing/DynamicServiceGrpc.java b/services/src/generated/test/grpc/io/grpc/reflection/testing/DynamicServiceGrpc.java index 12ab2f8200..62fd094ae0 100644 --- a/services/src/generated/test/grpc/io/grpc/reflection/testing/DynamicServiceGrpc.java +++ b/services/src/generated/test/grpc/io/grpc/reflection/testing/DynamicServiceGrpc.java @@ -21,7 +21,7 @@ import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall; * */ @javax.annotation.Generated( - value = "by gRPC proto compiler (version 1.7.0-SNAPSHOT)", + value = "by gRPC proto compiler", comments = "Source: io/grpc/reflection/testing/dynamic_reflection_test.proto") public final class DynamicServiceGrpc { diff --git a/services/src/generated/test/grpc/io/grpc/reflection/testing/ReflectableServiceGrpc.java b/services/src/generated/test/grpc/io/grpc/reflection/testing/ReflectableServiceGrpc.java index f45b05a183..28e32badea 100644 --- a/services/src/generated/test/grpc/io/grpc/reflection/testing/ReflectableServiceGrpc.java +++ b/services/src/generated/test/grpc/io/grpc/reflection/testing/ReflectableServiceGrpc.java @@ -18,7 +18,7 @@ import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall; /** */ @javax.annotation.Generated( - value = "by gRPC proto compiler (version 1.7.0-SNAPSHOT)", + value = "by gRPC proto compiler", comments = "Source: io/grpc/reflection/testing/reflection_test.proto") public final class ReflectableServiceGrpc { diff --git a/testing-proto/src/generated/main/grpc/io/grpc/testing/protobuf/SimpleServiceGrpc.java b/testing-proto/src/generated/main/grpc/io/grpc/testing/protobuf/SimpleServiceGrpc.java index bb0b88f99a..c99afa2c08 100644 --- a/testing-proto/src/generated/main/grpc/io/grpc/testing/protobuf/SimpleServiceGrpc.java +++ b/testing-proto/src/generated/main/grpc/io/grpc/testing/protobuf/SimpleServiceGrpc.java @@ -21,7 +21,7 @@ import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall; * */ @javax.annotation.Generated( - value = "by gRPC proto compiler (version 1.7.0-SNAPSHOT)", + value = "by gRPC proto compiler", comments = "Source: io/grpc/testing/protobuf/simpleservice.proto") public final class SimpleServiceGrpc {