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: Support explicit dynamic routing header #887

Merged
merged 12 commits into from
Jan 28, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
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
4 changes: 2 additions & 2 deletions repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ def gapic_generator_java_repositories():
_maybe(
http_archive,
name = "com_google_googleapis",
strip_prefix = "googleapis-ba30d8097582039ac4cc4e21b4e4baa426423075",
strip_prefix = "googleapis-987192dfddeb79d3262b9f9f7dbf092827f931ac",
urls = [
"https://github.com/googleapis/googleapis/archive/ba30d8097582039ac4cc4e21b4e4baa426423075.zip",
"https://github.com/googleapis/googleapis/archive/987192dfddeb79d3262b9f9f7dbf092827f931ac.zip",
],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
import com.google.api.generator.engine.ast.VariableExpr;
import com.google.api.generator.gapic.composer.comment.StubCommentComposer;
import com.google.api.generator.gapic.composer.store.TypeStore;
import com.google.api.generator.gapic.composer.utils.ClassNames;
import com.google.api.generator.gapic.composer.utils.PackageChecker;
import com.google.api.generator.gapic.model.GapicClass;
import com.google.api.generator.gapic.model.GapicClass.Kind;
Expand Down Expand Up @@ -204,15 +203,15 @@ public GapicClass generate(GapicContext context, Service service) {
.setName(className)
.setExtendsType(
typeStore.get(getTransportContext().classNames().getServiceStubClassName(service)))
.setStatements(classStatements)
.setMethods(
createClassMethods(
context,
service,
typeStore,
classMemberVarExprs,
callableClassMemberVarExprs,
protoMethodNameToDescriptorVarExprs))
protoMethodNameToDescriptorVarExprs, classStatements))
.setStatements(classStatements)
.build();
return GapicClass.create(kind, classDef);
}
Expand Down Expand Up @@ -249,7 +248,8 @@ protected List<MethodDefinition> createOperationsStubGetterMethod(
}

protected abstract Expr createTransportSettingsInitExpr(
Method method, VariableExpr transportSettingsVarExpr, VariableExpr methodDescriptorVarExpr);
Method method, VariableExpr transportSettingsVarExpr, VariableExpr methodDescriptorVarExpr,
List<Statement> classStatements);

protected List<MethodDefinition> createGetMethodDescriptorsMethod(
Service service,
Expand Down Expand Up @@ -430,7 +430,8 @@ protected List<MethodDefinition> createClassMethods(
TypeStore typeStore,
Map<String, VariableExpr> classMemberVarExprs,
Map<String, VariableExpr> callableClassMemberVarExprs,
Map<String, VariableExpr> protoMethodNameToDescriptorVarExprs) {
Map<String, VariableExpr> protoMethodNameToDescriptorVarExprs,
List<Statement> classStatements) {
List<MethodDefinition> javaMethods = new ArrayList<>();
javaMethods.addAll(createStaticCreatorMethods(service, typeStore, "newBuilder"));
javaMethods.addAll(
Expand All @@ -440,7 +441,8 @@ protected List<MethodDefinition> createClassMethods(
typeStore,
classMemberVarExprs,
callableClassMemberVarExprs,
protoMethodNameToDescriptorVarExprs));
protoMethodNameToDescriptorVarExprs,
classStatements));
javaMethods.addAll(
createGetMethodDescriptorsMethod(service, typeStore, protoMethodNameToDescriptorVarExprs));
javaMethods.addAll(
Expand Down Expand Up @@ -541,7 +543,8 @@ protected List<MethodDefinition> createConstructorMethods(
TypeStore typeStore,
Map<String, VariableExpr> classMemberVarExprs,
Map<String, VariableExpr> callableClassMemberVarExprs,
Map<String, VariableExpr> protoMethodNameToDescriptorVarExprs) {
Map<String, VariableExpr> protoMethodNameToDescriptorVarExprs,
List<Statement> classStatements) {
TypeNode stubSettingsType =
typeStore.get(getTransportContext().classNames().getServiceStubSettingsClassName(service));
VariableExpr settingsVarExpr =
Expand Down Expand Up @@ -666,7 +669,7 @@ protected List<MethodDefinition> createConstructorMethods(
m,
javaStyleMethodNameToTransportSettingsVarExprs.get(
JavaStyle.toLowerCamelCase(m.name())),
protoMethodNameToDescriptorVarExprs.get(m.name())))
protoMethodNameToDescriptorVarExprs.get(m.name()), classStatements))
.collect(Collectors.toList()));
secondCtorStatements.addAll(
secondCtorExprs.stream().map(ExprStatement::withExpr).collect(Collectors.toList()));
Expand Down
Loading