Skip to content

Commit

Permalink
fix: exclude lcoation mixin from proto input (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
noahdietz committed Aug 25, 2021
1 parent bd44234 commit 6f9b0c7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ class BazelBuildFileView {

Set<String> extraImports = new TreeSet<>();
extraImports.add(COMMON_RESOURCES_PROTO);
if (bp.hasLocations() && !bp.getProtoPackage().equals("google.cloud.location")) {
extraImports.add("//google/cloud/location:location_proto");
}
tokens.put("extra_imports", joinSetWithIndentation(extraImports));

String packPrefix = bp.getProtoPackage().replace(".", "/") + '/';
Expand Down Expand Up @@ -127,6 +124,10 @@ class BazelBuildFileView {

// Remove common_resources.proto because it is only needed for the proto_library_with_info target.
extraImports.remove(COMMON_RESOURCES_PROTO);
// Add location_proto dependency for mix-in if individual language rules need it.
if (bp.hasLocations() && !bp.getProtoPackage().equals("google.cloud.location")) {
extraImports.add("//google/cloud/location:location_proto");
}
actualImports.addAll(extraImports);

tokens.put("java_tests", joinSetWithIndentation(javaTests));
Expand Down Expand Up @@ -337,6 +338,8 @@ private Set<String> mapGoGapicDeps(Set<String> protoImports) {
goImports.add(replaceLabelName(protoImport, ":monitoredres_go_proto"));
} else if (protoImport.endsWith(":metric_proto")) {
goImports.add(replaceLabelName(protoImport, ":metric_go_proto"));
} else if (protoImport.endsWith(":location_proto")) {
goImports.add(replaceLabelName(protoImport, ":location_go_proto"));
}
}
return goImports;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ proto_library_with_info(
name = "library_proto_with_info",
deps = [
":library_proto",
"//google/cloud/location:location_proto",
"//google/cloud:common_resources_proto",
],
)
Expand Down Expand Up @@ -137,6 +136,7 @@ go_gapic_library(
deps = [
":library_go_proto",
"//google/api:httpbody_go_proto",
"//google/cloud/location:location_go_proto",
],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ proto_library_with_info(
name = "library_proto_with_info",
deps = [
":library_proto",
"//google/cloud/location:location_proto",
"//google/cloud:common_resources_proto",
],
)
Expand Down Expand Up @@ -137,6 +136,7 @@ go_gapic_library(
deps = [
":library_go_proto",
"//google/api:httpbody_go_proto",
"//google/cloud/location:location_go_proto",
],
)

Expand Down

0 comments on commit 6f9b0c7

Please sign in to comment.