Skip to content

Commit 47b11ab

Browse files
ijliymvoidzcy
authored andcommitted
compiler: Use 'SERVICE_NAME' instead of duplicated '$Package$$service… (grpc#5943)
* compiler: Use 'SERVICE_NAME' instead of duplicated '$Package$$service_name$' * compiler: Align indentation * Fix typo * Add modified golden files and all re-generated code to meet Travis CI and Windows build requirements See PR grpc#5943 * Polishing
1 parent d7b9438 commit 47b11ab

File tree

27 files changed

+464
-531
lines changed

27 files changed

+464
-531
lines changed

alts/src/generated/main/grpc/io/grpc/alts/internal/HandshakerServiceGrpc.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,21 @@ io.grpc.alts.internal.HandshakerResp> getDoHandshakeMethod() {
4141
if ((getDoHandshakeMethod = HandshakerServiceGrpc.getDoHandshakeMethod) == null) {
4242
synchronized (HandshakerServiceGrpc.class) {
4343
if ((getDoHandshakeMethod = HandshakerServiceGrpc.getDoHandshakeMethod) == null) {
44-
HandshakerServiceGrpc.getDoHandshakeMethod = getDoHandshakeMethod =
44+
HandshakerServiceGrpc.getDoHandshakeMethod = getDoHandshakeMethod =
4545
io.grpc.MethodDescriptor.<io.grpc.alts.internal.HandshakerReq, io.grpc.alts.internal.HandshakerResp>newBuilder()
4646
.setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
47-
.setFullMethodName(generateFullMethodName(
48-
"grpc.gcp.HandshakerService", "DoHandshake"))
47+
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "DoHandshake"))
4948
.setSampledToLocalTracing(true)
5049
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
5150
io.grpc.alts.internal.HandshakerReq.getDefaultInstance()))
5251
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
5352
io.grpc.alts.internal.HandshakerResp.getDefaultInstance()))
54-
.setSchemaDescriptor(new HandshakerServiceMethodDescriptorSupplier("DoHandshake"))
55-
.build();
56-
}
53+
.setSchemaDescriptor(new HandshakerServiceMethodDescriptorSupplier("DoHandshake"))
54+
.build();
5755
}
58-
}
59-
return getDoHandshakeMethod;
56+
}
57+
}
58+
return getDoHandshakeMethod;
6059
}
6160

6261
/**

benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/BenchmarkServiceGrpc.java

Lines changed: 35 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,21 @@ io.grpc.benchmarks.proto.Messages.SimpleResponse> getUnaryCallMethod() {
4141
if ((getUnaryCallMethod = BenchmarkServiceGrpc.getUnaryCallMethod) == null) {
4242
synchronized (BenchmarkServiceGrpc.class) {
4343
if ((getUnaryCallMethod = BenchmarkServiceGrpc.getUnaryCallMethod) == null) {
44-
BenchmarkServiceGrpc.getUnaryCallMethod = getUnaryCallMethod =
44+
BenchmarkServiceGrpc.getUnaryCallMethod = getUnaryCallMethod =
4545
io.grpc.MethodDescriptor.<io.grpc.benchmarks.proto.Messages.SimpleRequest, io.grpc.benchmarks.proto.Messages.SimpleResponse>newBuilder()
4646
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
47-
.setFullMethodName(generateFullMethodName(
48-
"grpc.testing.BenchmarkService", "UnaryCall"))
47+
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "UnaryCall"))
4948
.setSampledToLocalTracing(true)
5049
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
5150
io.grpc.benchmarks.proto.Messages.SimpleRequest.getDefaultInstance()))
5251
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
5352
io.grpc.benchmarks.proto.Messages.SimpleResponse.getDefaultInstance()))
54-
.setSchemaDescriptor(new BenchmarkServiceMethodDescriptorSupplier("UnaryCall"))
55-
.build();
56-
}
53+
.setSchemaDescriptor(new BenchmarkServiceMethodDescriptorSupplier("UnaryCall"))
54+
.build();
5755
}
58-
}
59-
return getUnaryCallMethod;
56+
}
57+
}
58+
return getUnaryCallMethod;
6059
}
6160

6261
private static volatile io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest,
@@ -73,22 +72,21 @@ io.grpc.benchmarks.proto.Messages.SimpleResponse> getStreamingCallMethod() {
7372
if ((getStreamingCallMethod = BenchmarkServiceGrpc.getStreamingCallMethod) == null) {
7473
synchronized (BenchmarkServiceGrpc.class) {
7574
if ((getStreamingCallMethod = BenchmarkServiceGrpc.getStreamingCallMethod) == null) {
76-
BenchmarkServiceGrpc.getStreamingCallMethod = getStreamingCallMethod =
75+
BenchmarkServiceGrpc.getStreamingCallMethod = getStreamingCallMethod =
7776
io.grpc.MethodDescriptor.<io.grpc.benchmarks.proto.Messages.SimpleRequest, io.grpc.benchmarks.proto.Messages.SimpleResponse>newBuilder()
7877
.setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
79-
.setFullMethodName(generateFullMethodName(
80-
"grpc.testing.BenchmarkService", "StreamingCall"))
78+
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "StreamingCall"))
8179
.setSampledToLocalTracing(true)
8280
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
8381
io.grpc.benchmarks.proto.Messages.SimpleRequest.getDefaultInstance()))
8482
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
8583
io.grpc.benchmarks.proto.Messages.SimpleResponse.getDefaultInstance()))
86-
.setSchemaDescriptor(new BenchmarkServiceMethodDescriptorSupplier("StreamingCall"))
87-
.build();
88-
}
84+
.setSchemaDescriptor(new BenchmarkServiceMethodDescriptorSupplier("StreamingCall"))
85+
.build();
8986
}
90-
}
91-
return getStreamingCallMethod;
87+
}
88+
}
89+
return getStreamingCallMethod;
9290
}
9391

9492
private static volatile io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest,
@@ -105,22 +103,21 @@ io.grpc.benchmarks.proto.Messages.SimpleResponse> getStreamingFromClientMethod()
105103
if ((getStreamingFromClientMethod = BenchmarkServiceGrpc.getStreamingFromClientMethod) == null) {
106104
synchronized (BenchmarkServiceGrpc.class) {
107105
if ((getStreamingFromClientMethod = BenchmarkServiceGrpc.getStreamingFromClientMethod) == null) {
108-
BenchmarkServiceGrpc.getStreamingFromClientMethod = getStreamingFromClientMethod =
106+
BenchmarkServiceGrpc.getStreamingFromClientMethod = getStreamingFromClientMethod =
109107
io.grpc.MethodDescriptor.<io.grpc.benchmarks.proto.Messages.SimpleRequest, io.grpc.benchmarks.proto.Messages.SimpleResponse>newBuilder()
110108
.setType(io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING)
111-
.setFullMethodName(generateFullMethodName(
112-
"grpc.testing.BenchmarkService", "StreamingFromClient"))
109+
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "StreamingFromClient"))
113110
.setSampledToLocalTracing(true)
114111
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
115112
io.grpc.benchmarks.proto.Messages.SimpleRequest.getDefaultInstance()))
116113
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
117114
io.grpc.benchmarks.proto.Messages.SimpleResponse.getDefaultInstance()))
118-
.setSchemaDescriptor(new BenchmarkServiceMethodDescriptorSupplier("StreamingFromClient"))
119-
.build();
120-
}
115+
.setSchemaDescriptor(new BenchmarkServiceMethodDescriptorSupplier("StreamingFromClient"))
116+
.build();
121117
}
122-
}
123-
return getStreamingFromClientMethod;
118+
}
119+
}
120+
return getStreamingFromClientMethod;
124121
}
125122

126123
private static volatile io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest,
@@ -137,22 +134,21 @@ io.grpc.benchmarks.proto.Messages.SimpleResponse> getStreamingFromServerMethod()
137134
if ((getStreamingFromServerMethod = BenchmarkServiceGrpc.getStreamingFromServerMethod) == null) {
138135
synchronized (BenchmarkServiceGrpc.class) {
139136
if ((getStreamingFromServerMethod = BenchmarkServiceGrpc.getStreamingFromServerMethod) == null) {
140-
BenchmarkServiceGrpc.getStreamingFromServerMethod = getStreamingFromServerMethod =
137+
BenchmarkServiceGrpc.getStreamingFromServerMethod = getStreamingFromServerMethod =
141138
io.grpc.MethodDescriptor.<io.grpc.benchmarks.proto.Messages.SimpleRequest, io.grpc.benchmarks.proto.Messages.SimpleResponse>newBuilder()
142139
.setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
143-
.setFullMethodName(generateFullMethodName(
144-
"grpc.testing.BenchmarkService", "StreamingFromServer"))
140+
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "StreamingFromServer"))
145141
.setSampledToLocalTracing(true)
146142
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
147143
io.grpc.benchmarks.proto.Messages.SimpleRequest.getDefaultInstance()))
148144
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
149145
io.grpc.benchmarks.proto.Messages.SimpleResponse.getDefaultInstance()))
150-
.setSchemaDescriptor(new BenchmarkServiceMethodDescriptorSupplier("StreamingFromServer"))
151-
.build();
152-
}
146+
.setSchemaDescriptor(new BenchmarkServiceMethodDescriptorSupplier("StreamingFromServer"))
147+
.build();
153148
}
154-
}
155-
return getStreamingFromServerMethod;
149+
}
150+
}
151+
return getStreamingFromServerMethod;
156152
}
157153

158154
private static volatile io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest,
@@ -169,22 +165,21 @@ io.grpc.benchmarks.proto.Messages.SimpleResponse> getStreamingBothWaysMethod() {
169165
if ((getStreamingBothWaysMethod = BenchmarkServiceGrpc.getStreamingBothWaysMethod) == null) {
170166
synchronized (BenchmarkServiceGrpc.class) {
171167
if ((getStreamingBothWaysMethod = BenchmarkServiceGrpc.getStreamingBothWaysMethod) == null) {
172-
BenchmarkServiceGrpc.getStreamingBothWaysMethod = getStreamingBothWaysMethod =
168+
BenchmarkServiceGrpc.getStreamingBothWaysMethod = getStreamingBothWaysMethod =
173169
io.grpc.MethodDescriptor.<io.grpc.benchmarks.proto.Messages.SimpleRequest, io.grpc.benchmarks.proto.Messages.SimpleResponse>newBuilder()
174170
.setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
175-
.setFullMethodName(generateFullMethodName(
176-
"grpc.testing.BenchmarkService", "StreamingBothWays"))
171+
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "StreamingBothWays"))
177172
.setSampledToLocalTracing(true)
178173
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
179174
io.grpc.benchmarks.proto.Messages.SimpleRequest.getDefaultInstance()))
180175
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
181176
io.grpc.benchmarks.proto.Messages.SimpleResponse.getDefaultInstance()))
182-
.setSchemaDescriptor(new BenchmarkServiceMethodDescriptorSupplier("StreamingBothWays"))
183-
.build();
184-
}
177+
.setSchemaDescriptor(new BenchmarkServiceMethodDescriptorSupplier("StreamingBothWays"))
178+
.build();
185179
}
186-
}
187-
return getStreamingBothWaysMethod;
180+
}
181+
}
182+
return getStreamingBothWaysMethod;
188183
}
189184

190185
/**

benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/ReportQpsScenarioServiceGrpc.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,21 @@ io.grpc.benchmarks.proto.Control.Void> getReportScenarioMethod() {
4141
if ((getReportScenarioMethod = ReportQpsScenarioServiceGrpc.getReportScenarioMethod) == null) {
4242
synchronized (ReportQpsScenarioServiceGrpc.class) {
4343
if ((getReportScenarioMethod = ReportQpsScenarioServiceGrpc.getReportScenarioMethod) == null) {
44-
ReportQpsScenarioServiceGrpc.getReportScenarioMethod = getReportScenarioMethod =
44+
ReportQpsScenarioServiceGrpc.getReportScenarioMethod = getReportScenarioMethod =
4545
io.grpc.MethodDescriptor.<io.grpc.benchmarks.proto.Control.ScenarioResult, io.grpc.benchmarks.proto.Control.Void>newBuilder()
4646
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
47-
.setFullMethodName(generateFullMethodName(
48-
"grpc.testing.ReportQpsScenarioService", "ReportScenario"))
47+
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "ReportScenario"))
4948
.setSampledToLocalTracing(true)
5049
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
5150
io.grpc.benchmarks.proto.Control.ScenarioResult.getDefaultInstance()))
5251
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
5352
io.grpc.benchmarks.proto.Control.Void.getDefaultInstance()))
54-
.setSchemaDescriptor(new ReportQpsScenarioServiceMethodDescriptorSupplier("ReportScenario"))
55-
.build();
56-
}
53+
.setSchemaDescriptor(new ReportQpsScenarioServiceMethodDescriptorSupplier("ReportScenario"))
54+
.build();
5755
}
58-
}
59-
return getReportScenarioMethod;
56+
}
57+
}
58+
return getReportScenarioMethod;
6059
}
6160

6261
/**

benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/WorkerServiceGrpc.java

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,21 @@ io.grpc.benchmarks.proto.Control.ServerStatus> getRunServerMethod() {
4141
if ((getRunServerMethod = WorkerServiceGrpc.getRunServerMethod) == null) {
4242
synchronized (WorkerServiceGrpc.class) {
4343
if ((getRunServerMethod = WorkerServiceGrpc.getRunServerMethod) == null) {
44-
WorkerServiceGrpc.getRunServerMethod = getRunServerMethod =
44+
WorkerServiceGrpc.getRunServerMethod = getRunServerMethod =
4545
io.grpc.MethodDescriptor.<io.grpc.benchmarks.proto.Control.ServerArgs, io.grpc.benchmarks.proto.Control.ServerStatus>newBuilder()
4646
.setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
47-
.setFullMethodName(generateFullMethodName(
48-
"grpc.testing.WorkerService", "RunServer"))
47+
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "RunServer"))
4948
.setSampledToLocalTracing(true)
5049
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
5150
io.grpc.benchmarks.proto.Control.ServerArgs.getDefaultInstance()))
5251
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
5352
io.grpc.benchmarks.proto.Control.ServerStatus.getDefaultInstance()))
54-
.setSchemaDescriptor(new WorkerServiceMethodDescriptorSupplier("RunServer"))
55-
.build();
56-
}
53+
.setSchemaDescriptor(new WorkerServiceMethodDescriptorSupplier("RunServer"))
54+
.build();
5755
}
58-
}
59-
return getRunServerMethod;
56+
}
57+
}
58+
return getRunServerMethod;
6059
}
6160

6261
private static volatile io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Control.ClientArgs,
@@ -73,22 +72,21 @@ io.grpc.benchmarks.proto.Control.ClientStatus> getRunClientMethod() {
7372
if ((getRunClientMethod = WorkerServiceGrpc.getRunClientMethod) == null) {
7473
synchronized (WorkerServiceGrpc.class) {
7574
if ((getRunClientMethod = WorkerServiceGrpc.getRunClientMethod) == null) {
76-
WorkerServiceGrpc.getRunClientMethod = getRunClientMethod =
75+
WorkerServiceGrpc.getRunClientMethod = getRunClientMethod =
7776
io.grpc.MethodDescriptor.<io.grpc.benchmarks.proto.Control.ClientArgs, io.grpc.benchmarks.proto.Control.ClientStatus>newBuilder()
7877
.setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
79-
.setFullMethodName(generateFullMethodName(
80-
"grpc.testing.WorkerService", "RunClient"))
78+
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "RunClient"))
8179
.setSampledToLocalTracing(true)
8280
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
8381
io.grpc.benchmarks.proto.Control.ClientArgs.getDefaultInstance()))
8482
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
8583
io.grpc.benchmarks.proto.Control.ClientStatus.getDefaultInstance()))
86-
.setSchemaDescriptor(new WorkerServiceMethodDescriptorSupplier("RunClient"))
87-
.build();
88-
}
84+
.setSchemaDescriptor(new WorkerServiceMethodDescriptorSupplier("RunClient"))
85+
.build();
8986
}
90-
}
91-
return getRunClientMethod;
87+
}
88+
}
89+
return getRunClientMethod;
9290
}
9391

9492
private static volatile io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Control.CoreRequest,
@@ -105,22 +103,21 @@ io.grpc.benchmarks.proto.Control.CoreResponse> getCoreCountMethod() {
105103
if ((getCoreCountMethod = WorkerServiceGrpc.getCoreCountMethod) == null) {
106104
synchronized (WorkerServiceGrpc.class) {
107105
if ((getCoreCountMethod = WorkerServiceGrpc.getCoreCountMethod) == null) {
108-
WorkerServiceGrpc.getCoreCountMethod = getCoreCountMethod =
106+
WorkerServiceGrpc.getCoreCountMethod = getCoreCountMethod =
109107
io.grpc.MethodDescriptor.<io.grpc.benchmarks.proto.Control.CoreRequest, io.grpc.benchmarks.proto.Control.CoreResponse>newBuilder()
110108
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
111-
.setFullMethodName(generateFullMethodName(
112-
"grpc.testing.WorkerService", "CoreCount"))
109+
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "CoreCount"))
113110
.setSampledToLocalTracing(true)
114111
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
115112
io.grpc.benchmarks.proto.Control.CoreRequest.getDefaultInstance()))
116113
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
117114
io.grpc.benchmarks.proto.Control.CoreResponse.getDefaultInstance()))
118-
.setSchemaDescriptor(new WorkerServiceMethodDescriptorSupplier("CoreCount"))
119-
.build();
120-
}
115+
.setSchemaDescriptor(new WorkerServiceMethodDescriptorSupplier("CoreCount"))
116+
.build();
121117
}
122-
}
123-
return getCoreCountMethod;
118+
}
119+
}
120+
return getCoreCountMethod;
124121
}
125122

126123
private static volatile io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Control.Void,
@@ -137,22 +134,21 @@ io.grpc.benchmarks.proto.Control.Void> getQuitWorkerMethod() {
137134
if ((getQuitWorkerMethod = WorkerServiceGrpc.getQuitWorkerMethod) == null) {
138135
synchronized (WorkerServiceGrpc.class) {
139136
if ((getQuitWorkerMethod = WorkerServiceGrpc.getQuitWorkerMethod) == null) {
140-
WorkerServiceGrpc.getQuitWorkerMethod = getQuitWorkerMethod =
137+
WorkerServiceGrpc.getQuitWorkerMethod = getQuitWorkerMethod =
141138
io.grpc.MethodDescriptor.<io.grpc.benchmarks.proto.Control.Void, io.grpc.benchmarks.proto.Control.Void>newBuilder()
142139
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
143-
.setFullMethodName(generateFullMethodName(
144-
"grpc.testing.WorkerService", "QuitWorker"))
140+
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "QuitWorker"))
145141
.setSampledToLocalTracing(true)
146142
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
147143
io.grpc.benchmarks.proto.Control.Void.getDefaultInstance()))
148144
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
149145
io.grpc.benchmarks.proto.Control.Void.getDefaultInstance()))
150-
.setSchemaDescriptor(new WorkerServiceMethodDescriptorSupplier("QuitWorker"))
151-
.build();
152-
}
146+
.setSchemaDescriptor(new WorkerServiceMethodDescriptorSupplier("QuitWorker"))
147+
.build();
153148
}
154-
}
155-
return getQuitWorkerMethod;
149+
}
150+
}
151+
return getQuitWorkerMethod;
156152
}
157153

158154
/**

compiler/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ $ protoc --plugin=protoc-gen-grpc-java=build/exe/java_plugin/protoc-gen-grpc-jav
4646
## Installing the codegen to Maven local repository
4747
This will compile a codegen and put it under your ``~/.m2/repository``. This
4848
will make it available to any build tool that pulls codegens from Maven
49-
repostiories.
49+
repositories.
5050
```
5151
$ ../gradlew publishToMavenLocal
5252
```
5353

54-
## Creating a release of GRPC Java
54+
## Creating a release of gRPC Java
5555
Please follow the instructions in ``RELEASING.md`` under the root directory for
5656
details on how to create a new release.

0 commit comments

Comments
 (0)