Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ggj][codegen] fix: ServiceStubSettings batching request type #332

Merged
merged 33 commits into from
Sep 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
fd218de
feat: add protobuf comment parser util
miraleung Sep 15, 2020
8c792e3
fix: add basic proto build rules
miraleung Sep 15, 2020
d6ee068
feat: add header comments to ServiceClient
miraleung Sep 15, 2020
82aa0b6
fix: build protoc at test time
miraleung Sep 15, 2020
c8f2233
Merge branch 'gp/g0' of github.com:googleapis/gapic-generator-java in…
miraleung Sep 15, 2020
2405b1a
fix!: wrap protobuf location and process comments
miraleung Sep 15, 2020
a59fd3f
feat: add comment parsing to methods and fields
miraleung Sep 16, 2020
66dec11
fix: test
miraleung Sep 16, 2020
8325450
feat: add protobuf comments to ServiceClient
miraleung Sep 16, 2020
5acc151
fix: solidify codegen method order with TypeNode/MethodArg and Compar…
miraleung Sep 16, 2020
97e780a
fix: clean up tests
miraleung Sep 16, 2020
5508e67
fix: merge gp/g2_5
miraleung Sep 17, 2020
0b7288e
fix: merge
miraleung Sep 17, 2020
c6ca60b
fix: ServiceClient member variables and method calls
miraleung Sep 18, 2020
ac89e12
fix: ServiceStubSettings builder type
miraleung Sep 18, 2020
b5e6585
fix: ServiceSettings Builder construction
miraleung Sep 18, 2020
1e10b6b
fix: ServiceStub callable types
miraleung Sep 18, 2020
006aff4
feat: java_gapic_library rule impl
miraleung Sep 18, 2020
f25274f
fix: remove debugging comments
miraleung Sep 18, 2020
76d26d8
feat: add gradle assembly Bazel rules
miraleung Sep 18, 2020
c56271f
feat: add java_gapic_test Bazel rule
miraleung Sep 18, 2020
98ccc00
fix: use Java packages for resname codegen
miraleung Sep 18, 2020
5eed26a
fix: build resnames separately and extract into proto/ dir
miraleung Sep 18, 2020
3b238ff
fix: remove debug printf
miraleung Sep 18, 2020
1ea3899
feat: add ServiceClient.MethodPagedResponse inner class
miraleung Sep 19, 2020
798bd05
feat: add ServiceClient.MethodPage inner class
miraleung Sep 19, 2020
501bddf
feat: add ServiceClient.MethodFixedSizeCollection innser class
miraleung Sep 19, 2020
d25868a
fix: clean up resname codegen, lower_snake varnames
miraleung Sep 19, 2020
88374c0
fix: init remaining resname tokenVars to null
miraleung Sep 19, 2020
197e9a9
fix: ServiceStubSettings paged descriptor rep. field getter name
miraleung Sep 19, 2020
0b5cc91
fix: handle map/list args in ServiceClient
miraleung Sep 19, 2020
5ca6218
fix: ServiceSTubSettings batching request type
miraleung Sep 19, 2020
f4a9fd1
Merge branch 'master' into gp/g21
miraleung Sep 19, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import com.google.api.generator.engine.ast.TypeNode;
import com.google.api.generator.engine.ast.UnaryOperationExpr;
import com.google.api.generator.engine.ast.ValueExpr;
import com.google.api.generator.engine.ast.VaporReference;
import com.google.api.generator.engine.ast.Variable;
import com.google.api.generator.engine.ast.VariableExpr;
import com.google.api.generator.gapic.model.Field;
Expand Down Expand Up @@ -149,7 +150,14 @@ private static MethodDefinition createGetBatchPartitionKeyMethod(

private static MethodDefinition createGetRequestBuilderMethod(
Method method, GapicBatchingSettings batchingSettings) {
TypeNode builderType = toType(REQUEST_BUILDER_REF, method.inputType());
TypeNode builderType =
TypeNode.withReference(
VaporReference.builder()
.setEnclosingClassName(method.inputType().reference().name())
.setName("Builder")
.setPakkage(method.inputType().reference().pakkage())
.build());

VariableExpr builderVarExpr =
VariableExpr.withVariable(
Variable.builder().setType(builderType).setName("builder").build());
Expand Down Expand Up @@ -220,9 +228,10 @@ private static MethodDefinition createGetRequestBuilderMethod(
.build())
.build();

TypeNode anonClassType = toType(REQUEST_BUILDER_REF, method.inputType());
AnonymousClassExpr requestBuilderAnonClassExpr =
AnonymousClassExpr.builder()
.setType(builderType)
.setType(anonClassType)
.setStatements(
Arrays.asList(
ExprStatement.withExpr(
Expand All @@ -237,7 +246,7 @@ private static MethodDefinition createGetRequestBuilderMethod(
return MethodDefinition.builder()
.setIsOverride(true)
.setScope(ScopeNode.PUBLIC)
.setReturnType(builderType)
.setReturnType(anonClassType)
.setName("getRequestBuilder")
.setReturnExpr(requestBuilderAnonClassExpr)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public void batchingDescriptor_hasSubresponseField() {
"@Override\n",
"public RequestBuilder<PublishRequest> getRequestBuilder() {\n",
"return new RequestBuilder<PublishRequest>() {\n",
"private RequestBuilder<PublishRequest> builder;\n",
"private PublishRequest.Builder builder;\n",
"@Override\n",
"public void appendRequest(PublishRequest request) {\n",
"if (Objects.isNull(builder)) {\n",
Expand Down Expand Up @@ -234,7 +234,7 @@ public void batchingDescriptor_noSubresponseField() {
"@Override\n",
"public RequestBuilder<WriteLogEntriesRequest> getRequestBuilder() {\n",
"return new RequestBuilder<WriteLogEntriesRequest>() {\n",
"private RequestBuilder<WriteLogEntriesRequest> builder;\n",
"private WriteLogEntriesRequest.Builder builder;\n",
"@Override\n",
"public void appendRequest(WriteLogEntriesRequest request) {\n",
"if (Objects.isNull(builder)) {\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1063,7 +1063,7 @@ private static List<Service> parseServices(
+ " @Override\n"
+ " public RequestBuilder<WriteLogEntriesRequest> getRequestBuilder() {\n"
+ " return new RequestBuilder<WriteLogEntriesRequest>() {\n"
+ " private RequestBuilder<WriteLogEntriesRequest> builder;\n"
+ " private WriteLogEntriesRequest.Builder builder;\n"
+ "\n"
+ " @Override\n"
+ " public void appendRequest(WriteLogEntriesRequest request) {\n"
Expand Down Expand Up @@ -1793,7 +1793,7 @@ private static List<Service> parseServices(
+ " @Override\n"
+ " public RequestBuilder<PublishRequest> getRequestBuilder() {\n"
+ " return new RequestBuilder<PublishRequest>() {\n"
+ " private RequestBuilder<PublishRequest> builder;\n"
+ " private PublishRequest.Builder builder;\n"
+ "\n"
+ " @Override\n"
+ " public void appendRequest(PublishRequest request) {\n"
Expand Down