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

Feat: Implement DIREGAPIC LRO annotations #832

Merged
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
570bb33
fix ServiceStub Goldens
GabrielGonzalezDiaz Aug 17, 2021
cdb67da
fix Stub golden
GabrielGonzalezDiaz Aug 17, 2021
2430989
fix Stub golden
GabrielGonzalezDiaz Aug 17, 2021
6b15e3b
fix CallableFactory golden
GabrielGonzalezDiaz Aug 17, 2021
9ed928a
fix java format
GabrielGonzalezDiaz Aug 17, 2021
edbe1a4
add annotation placement comments
GabrielGonzalezDiaz Aug 17, 2021
e1d5e83
only add machinery to methods that return operation
GabrielGonzalezDiaz Aug 20, 2021
703c123
add grpc file that contained method that was edited on abstract class
GabrielGonzalezDiaz Aug 20, 2021
67b42bd
update HttpJsonComplianceStub.golden
GabrielGonzalezDiaz Aug 20, 2021
703fc37
java format
GabrielGonzalezDiaz Aug 20, 2021
8dbd36b
add initial methods from annotations
GabrielGonzalezDiaz Aug 26, 2021
f9f9c66
add initial methods from annotations
GabrielGonzalezDiaz Aug 26, 2021
772ca7e
fix merge errors
GabrielGonzalezDiaz Aug 26, 2021
0657d8c
Implement annotations
GabrielGonzalezDiaz Aug 30, 2021
5c4c626
java format
GabrielGonzalezDiaz Aug 30, 2021
b02303c
fix package for Status
GabrielGonzalezDiaz Aug 30, 2021
f827fc6
fix CallableFactory generics
GabrielGonzalezDiaz Aug 31, 2021
50815a9
java format
GabrielGonzalezDiaz Aug 31, 2021
8867470
initialize new fields in message for parser test
GabrielGonzalezDiaz Aug 31, 2021
ae11f55
set default value for operation_polling_method
GabrielGonzalezDiaz Aug 31, 2021
045c6da
add brackets to if statement
GabrielGonzalezDiaz Aug 31, 2021
25bcb10
remove comments and invoke methods
GabrielGonzalezDiaz Aug 31, 2021
85ac40b
add brackets to if statements and remove invoke methods
GabrielGonzalezDiaz Sep 1, 2021
3fbb746
java formet
GabrielGonzalezDiaz Sep 1, 2021
85368d9
add longRunningClient
GabrielGonzalezDiaz Sep 3, 2021
2bb8199
callablefactory fixes
GabrielGonzalezDiaz Sep 3, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jvm_maven_import_external(
# gapic-generator-java dependencies to match the order in googleapis repository,
# which in its turn, prioritizes actual generated clients runtime dependencies
# over the generator dependencies.

_gax_java_version = "2.3.0"

http_archive(
Expand Down
9 changes: 9 additions & 0 deletions repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ def gapic_generator_java_repositories():
],
)

# local(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove

# http_archive,
# name = "com_google_googleapis_discovery",
## strip_prefix = "googleapis-discovery-2872d382ff767518e63d59ececf5d6f9224b21b4",
## urls = [
## "https://github.com/vam-google/googleapis-discovery/archive/2872d382ff767518e63d59ececf5d6f9224b21b4.zip",
## ],
# )

_maybe(
native.bind,
name = "guava",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package com.google.api.generator.gapic.composer.rest;

import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.httpjson.ApiMessage;
import com.google.api.gax.httpjson.HttpJsonCallableFactory;
import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable;
import com.google.api.gax.rpc.OperationCallable;
Expand Down Expand Up @@ -47,7 +46,7 @@ public class HttpJsonServiceCallableFactoryClassComposer
new HttpJsonServiceCallableFactoryClassComposer();

private static final TypeNode MESSAGE_TYPE =
TypeNode.withReference(ConcreteReference.withClazz(ApiMessage.class));
TypeNode.withReference(ConcreteReference.withClazz(Operation.class));
private static final TypeNode BACKGROUND_RESOURCE_TYPE =
TypeNode.withReference(ConcreteReference.withClazz(BackgroundResource.class));

Expand Down Expand Up @@ -121,11 +120,21 @@ protected MethodDefinition createOperationCallableMethod(TypeStore typeStore) {

List<Statement> createOperationCallableBody = new ArrayList<Statement>(2);

List<VariableExpr> arguments = method.arguments();
List<VariableExpr> arguments = new ArrayList<>(method.arguments());
// arguments.set(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove all comments like this (debugging artifacts)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still here...

// 0,
// arguments
// .get(0)
// .toBuilder()
// .setTemplateObjects(Arrays.asList(requestTemplateName, methodVariantName))
// .build()); // httpJsonCallSettings);
// method = method.toBuilder().setArguments(arguments).build();

// arguments = method.arguments();
Variable httpJsonCallSettingsVar = arguments.get(0).variable();
Variable callSettingsVar = arguments.get(1).variable();
Variable operationCallSettingsVar = arguments.get(1).variable();
Variable clientContextVar = arguments.get(2).variable();
Variable operationsStub = arguments.get(3).variable();
Variable operationsStubVar = arguments.get(3).variable();
// Generate innerCallable
VariableExpr innerCallableVarExpr =
VariableExpr.builder()
Expand All @@ -139,7 +148,7 @@ protected MethodDefinition createOperationCallableMethod(TypeStore typeStore) {
.build();
MethodInvocationExpr getInitialCallSettingsExpr =
MethodInvocationExpr.builder()
.setExprReferenceExpr(VariableExpr.withVariable(callSettingsVar))
.setExprReferenceExpr(VariableExpr.withVariable(operationCallSettingsVar))
.setMethodName("getInitialCallSettings")
.build();
MethodInvocationExpr createBaseUnaryCallableExpr =
Expand Down Expand Up @@ -209,7 +218,7 @@ protected MethodDefinition createOperationCallableMethod(TypeStore typeStore) {
// Generate return statement
MethodInvocationExpr longRunningClient =
MethodInvocationExpr.builder()
.setExprReferenceExpr(VariableExpr.withVariable(operationsStub))
.setExprReferenceExpr(VariableExpr.withVariable(operationsStubVar))
.setMethodName("longRunningClient")
.build();
MethodInvocationExpr createOperationCallable =
Expand All @@ -218,7 +227,7 @@ protected MethodDefinition createOperationCallableMethod(TypeStore typeStore) {
TypeNode.withReference(ConcreteReference.withClazz(HttpJsonCallableFactory.class)))
.setMethodName("createOperationCallable")
.setArguments(
VariableExpr.withVariable(callSettingsVar),
VariableExpr.withVariable(operationCallSettingsVar),
VariableExpr.withVariable(clientContextVar),
longRunningClient,
initialCallableVarExpr)
Expand Down