Skip to content

Commit

Permalink
fix(bazel): include gapic_yaml in java if present (#65)
Browse files Browse the repository at this point in the history
There are some cases where the `gapic.yaml` file are still in use for Java:
- LRO polling config override
- Java package override
- batching settings (for logging & pubsub)

To simplify things, whenever there is a `gapic.yaml` present, it will be included on the java target, because such files should only exist for the above reasons.
  • Loading branch information
noahdietz committed Aug 19, 2021
1 parent 91736cb commit 2b6fc8e
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ java_grpc_library(
java_gapic_library(
name = "{{name}}_java_gapic",
srcs = [":{{name}}_proto_with_info"],
gapic_yaml = {{gapic_yaml}},
grpc_service_config = {{grpc_service_config}},
service_yaml = {{service_yaml}},
test_deps = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,15 @@ class BazelBuildFileView {
}
tokens.put("service_yaml", serviceYaml);

// We need to continue to supply the gapic_yaml to Java targets when the
// gapic_yaml is available, because that means it was added for some override.
String gapicYaml = "None";
String gapicYamlPath = bp.getGapicYamlPath();
if (gapicYamlPath != null && !gapicYamlPath.isEmpty()) {
gapicYaml = "\""+convertPathToLabel(bp.getProtoPackage(), gapicYamlPath)+"\"";
}
tokens.put("gapic_yaml", gapicYaml);

Set<String> javaTests = new TreeSet<>();
for (String service : bp.getServices()) {
// Prioritize the language override in gapic.yaml if it is present.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ java_grpc_library(
java_gapic_library(
name = "library_java_gapic",
srcs = [":library_proto_with_info"],
gapic_yaml = None,
grpc_service_config = "library_example_grpc_service_config.json",
service_yaml = "//google/example/library:library_example_v1.yaml",
test_deps = [
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ java_grpc_library(
java_gapic_library(
name = "library_java_gapic",
srcs = [":library_proto_with_info"],
gapic_yaml = "library_example_gapic.yaml",
grpc_service_config = "library_example_grpc_service_config.json",
service_yaml = "//google/example/library:library_example_v1.yaml",
test_deps = [
Expand Down

0 comments on commit 2b6fc8e

Please sign in to comment.