Skip to content
This repository has been archived by the owner on Jun 28, 2022. It is now read-only.

Merge in gapic_config_v2 #2721

Merged
merged 34 commits into from
Apr 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
1f1f16e
Add Gapic config v2 (#2665)
andreamlin Mar 28, 2019
1484a09
Whittling down config_v2 (#2666)
andreamlin Mar 29, 2019
bbc19c5
comments
andreamlin Mar 28, 2019
fdaaeb1
same as master
andreamlin Mar 28, 2019
280e279
Merge branch 'master' into gapic_config_v2
andreamlin Mar 29, 2019
1214ae5
Merge branch 'master' into gapic_config_v2
andreamlin Mar 29, 2019
5ecc799
Add ConfigV2 Validator (#2672)
andreamlin Apr 1, 2019
1723337
Merge branch 'master' into gapic_config_v2
andreamlin Apr 1, 2019
c55139e
Merge branch 'gapic_config_v2' of github.com:googleapis/gapic-generat…
andreamlin Apr 1, 2019
63641b1
Merge branch 'master' into gapic_config_v2
andreamlin Apr 3, 2019
cfef04d
Merge branch 'master' into gapic_config_v2
andreamlin Apr 4, 2019
2a0c536
Merge branch 'master' into gapic_config_v2
andreamlin Apr 4, 2019
d1f2d09
Merge branch 'master' into gapic_config_v2
andreamlin Apr 6, 2019
268d4dc
move paging to paging file
andreamlin Apr 6, 2019
317edce
AutoValue LongRunningConfig; always use gapic config's polling settin…
andreamlin Apr 8, 2019
c0d214f
Merge branch 'master' into gapic_config_v2
andreamlin Apr 8, 2019
5ebeff4
Merge branch 'master' into gapic_config_v2
andreamlin Apr 8, 2019
ff5417c
Merge branch 'master' into gapic_config_v2
andreamlin Apr 8, 2019
5be1b6d
Merge remote-tracking branch 'origin/master' into gapic_config_v2
andreamlin Apr 8, 2019
28e8372
ResourceNameOneofConfig fixes (#2704)
andreamlin Apr 9, 2019
64669ab
Start parsing GAPIC config v2 (#2703)
andreamlin Apr 9, 2019
e55c15f
merge in master
andreamlin Apr 9, 2019
ad84303
Merge remote-tracking branch 'origin/master' into gapic_config_v2
andreamlin Apr 10, 2019
829a9ee
Bring back timeout millis in GAPIC config v2 (#2708)
andreamlin Apr 11, 2019
8d9788b
Merge branch 'master' into gapic_config_v2
andreamlin Apr 11, 2019
6a72227
Merge remote-tracking branch 'origin/master' into gapic_config_v2
andreamlin Apr 11, 2019
a2e9642
Resource names across different protofiles (#2711)
andreamlin Apr 11, 2019
e88e115
merge in master
andreamlin Apr 12, 2019
dffe03b
Merge branch 'master' into gapic_config_v2
michaelbausor Apr 15, 2019
70f22db
Fix missing default retries (#2718)
michaelbausor Apr 19, 2019
c3097f0
Bug fixes for gapic config v2 parsing (#2717)
michaelbausor Apr 19, 2019
33893f4
Merge branch 'master' into gapic_config_v2
andreamlin Apr 22, 2019
278512d
Merge branch 'gapic_config_v2' of github.com:googleapis/gapic-generat…
andreamlin Apr 22, 2019
12fe523
Merge branch 'master' into gapic_config_v2
andreamlin Apr 22, 2019
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
11 changes: 9 additions & 2 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ _COMPILE_DEPS = [
"@com_fasterxml_jackson_core_jackson_databind//jar",
"@com_google_api_api_common//jar",
"@com_google_api_api_compiler//jar",
"@com_google_api_api_compiler_testing//jar",
"@com_google_api_grpc_proto_google_common_protos__com_google_api_codegen//jar",
"@com_google_auto_value_auto_value//jar",
"@com_google_auto_value_auto_value_annotations//jar",
Expand All @@ -31,7 +32,6 @@ _COMPILE_DEPS = [
]

_TEST_COMPILE_DEPS = [
"@com_google_api_api_compiler_testing//jar",
"@com_google_truth_truth//jar",
"@junit_junit//jar",
"@pl_pragmatists_JUnitParams//jar",
Expand Down Expand Up @@ -60,9 +60,16 @@ proto_library(
deps = ["@com_google_protobuf//:wrappers_proto"],
)

proto_library(
name = "config_v2_proto",
srcs = ["src/main/proto/com/google/api/codegen/v2/config_v2.proto"],
deps = ["@com_google_protobuf//:wrappers_proto"],
)

java_proto_library(
name = "config_java_proto",
deps = [":config_proto"],
deps = [":config_proto",
":config_v2_proto"],
)

java_binary(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ static DiscoGapicInterfaceConfig createInterfaceConfig(
ResourceNameMessageConfigs messageConfigs,
ImmutableMap<String, ResourceNameConfig> resourceNameConfigs) {

RetryCodesConfig retryCodesConfig =
RetryCodesConfig.create(model.getDiagCollector(), interfaceConfigProto);
RetryCodesConfig retryCodesConfig = RetryCodesConfig.create(interfaceConfigProto);
ImmutableMap<String, RetryParamsDefinitionProto> retrySettingsDefinition =
RetryDefinitionsTransformer.createRetrySettingsDefinition(interfaceConfigProto);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public abstract class FixedResourceNameConfig implements ResourceNameConfig {

public abstract String getFixedValue();

@Nullable
@Override
public abstract ProtoFile getAssignedProtoFile();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
import javax.annotation.Nullable;

/**
Expand Down Expand Up @@ -118,7 +119,6 @@ static GapicInterfaceConfig createInterfaceConfig(

RetryCodesConfig retryCodesConfig =
RetryCodesConfig.create(
diagCollector,
interfaceConfigProto,
new ArrayList<>(interfaceInput.getMethodsToGenerate().keySet()),
protoParser);
Expand Down Expand Up @@ -164,19 +164,32 @@ static GapicInterfaceConfig createInterfaceConfig(
}

ImmutableList.Builder<SingleResourceNameConfig> resourcesBuilder = ImmutableList.builder();
for (CollectionConfigProto collectionConfigProto : interfaceConfigProto.getCollectionsList()) {
String entityName = collectionConfigProto.getEntityName();
ResourceNameConfig resourceName = resourceNameConfigs.get(entityName);
if (!(resourceName instanceof SingleResourceNameConfig)) {
diagCollector.addDiag(
Diag.error(
SimpleLocation.TOPLEVEL,
"Inconsistent configuration - single resource name %s specified for interface, "
+ " but was not found in GapicProductConfig configuration.",
entityName));
return null;
if (protoParser.isProtoAnnotationsEnabled()) {
resourceNameConfigs
.values()
.stream()
.filter(
r ->
r.getResourceNameType() == ResourceNameType.SINGLE
&& Objects.equals(r.getAssignedProtoFile(), apiInterface.getFile()))
.map(r -> (SingleResourceNameConfig) r)
.forEach(resourcesBuilder::add);
} else {
for (CollectionConfigProto collectionConfigProto :
interfaceConfigProto.getCollectionsList()) {
String entityName = collectionConfigProto.getEntityName();
ResourceNameConfig resourceName = resourceNameConfigs.get(entityName);
if (!(resourceName instanceof SingleResourceNameConfig)) {
diagCollector.addDiag(
Diag.error(
SimpleLocation.TOPLEVEL,
"Inconsistent configuration - single resource name %s specified for interface, "
+ " but was not found in GapicProductConfig configuration.",
entityName));
return null;
}
resourcesBuilder.add((SingleResourceNameConfig) resourceName);
}
resourcesBuilder.add((SingleResourceNameConfig) resourceName);
}
ImmutableList<SingleResourceNameConfig> singleResourceNames = resourcesBuilder.build();

Expand Down
Loading