Skip to content

Commit

Permalink
fix(gapic): generate gapic build on seeing service.yaml or grpc_servi…
Browse files Browse the repository at this point in the history
…ce_config.json (#37)
  • Loading branch information
miraleung committed Mar 26, 2021
1 parent bebd02b commit 1a62038
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ public FileVisitResult postVisitDirectory(Path dir, IOException e) throws IOExce
BazelBuildFileTemplate template = null;
String tmplType = "";
if (bp.getProtoPackage() != null) {
if (bp.getGapicYamlPath() != null) {
boolean isGapicLibrary =
bp.getServiceYamlPath() != null || bp.getServiceConfigJsonPath() != null;
if (isGapicLibrary) {
bp.injectFieldsFromTopLevel();
template = this.gapicApiTempl;
tmplType = "GAPIC_VERSIONED";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ class BazelBuildFileView {
tokens.put("go_proto_importpath", bp.getLangProtoPackages().get("go").split(";")[0]);
tokens.put("go_proto_deps", joinSetWithIndentation(mapGoProtoDeps(actualImports)));

if (bp.getGapicYamlPath() == null) {
boolean isGapicLibrary =
bp.getServiceYamlPath() != null || bp.getServiceConfigJsonPath() != null;
if (!isGapicLibrary) {
return;
}

Expand Down Expand Up @@ -209,7 +211,7 @@ private Set<String> mapJavaGapicDeps(Set<String> protoImports) {
private Set<String> mapJavaGapicTestDeps(Set<String> protoImports) {
Set<String> javaImports = new TreeSet<>();
for (String protoImport : protoImports) {
if (protoImport.endsWith(":iam_policy_proto")
if (protoImport.endsWith(":iam_policy_proto")
|| protoImport.endsWith(":policy_proto")
|| protoImport.endsWith(":options_proto")) {
javaImports.add(replaceLabelName(protoImport, ":iam_java_grpc"));
Expand Down

0 comments on commit 1a62038

Please sign in to comment.