Skip to content

Commit fd88360

Browse files
authored
Advertise Zio symbols if the label includes "zio" (#385)
1 parent 3b147a8 commit fd88360

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

pkg/rule/rules_scala/scala_library.go

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -452,13 +452,26 @@ func provideScalaImports(files []*protoc.File, resolver protoc.ImportResolver, f
452452
resolver.Provide(lang, "service", name+"Client", from)
453453
resolver.Provide(lang, "service", name+"Handler", from)
454454
resolver.Provide(lang, "service", name+"Server", from)
455-
// TOOD: if this is configured on the proto_plugin, we won't know
456-
// about the plugin option. Advertise them anyway.
457-
// if options["server_power_apis"] {
458-
resolver.Provide(lang, "service", name+"PowerApi", from)
459-
resolver.Provide(lang, "service", name+"PowerApiHandler", from)
460-
resolver.Provide(lang, "service", name+"ClientPowerApi", from)
455+
456+
if strings.Contains(from.Name, "zio") {
457+
zioName := "Zio" + s.Name
458+
if pkgName != "" {
459+
zioName = pkgName + "." + zioName
460+
}
461+
// if the scala rule name includes the term 'zio', assume this is a
462+
// zio library and advertize the zio symbols as well.
463+
resolver.Provide(lang, "service", zioName, from)
464+
465+
} else {
466+
// options["server_power_apis"] may or may not be enabled and
467+
// it's difficult to know if the option is present. Advertize
468+
// them optimitically anyway.
469+
resolver.Provide(lang, "service", name+"PowerApi", from)
470+
resolver.Provide(lang, "service", name+"PowerApiHandler", from)
471+
resolver.Provide(lang, "service", name+"ClientPowerApi", from)
472+
}
461473
// }
474+
462475
}
463476
}
464477
}

rules/private/proto_repository_tools_srcs.bzl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ PROTO_REPOSITORY_TOOLS_SRCS = [
100100
"@build_stack_rules_proto//pkg/plugin/grpcecosystem/grpcgateway:protoc-gen-grpc-gateway.go",
101101
"@build_stack_rules_proto//pkg/plugin/scalapb/scalapb:BUILD.bazel",
102102
"@build_stack_rules_proto//pkg/plugin/scalapb/scalapb:protoc_gen_scala.go",
103+
"@build_stack_rules_proto//pkg/plugin/scalapb/zio_grpc:BUILD.bazel",
104+
"@build_stack_rules_proto//pkg/plugin/scalapb/zio_grpc:protoc_gen_zio_grpc.go",
103105
"@build_stack_rules_proto//pkg/plugin/stackb/grpc_js:BUILD.bazel",
104106
"@build_stack_rules_proto//pkg/plugin/stackb/grpc_js:protoc-gen-grpc-js.go",
105107
"@build_stack_rules_proto//pkg/plugin/stephenh/ts-proto:BUILD.bazel",
@@ -179,6 +181,7 @@ PROTO_REPOSITORY_TOOLS_SRCS = [
179181
"@build_stack_rules_proto//plugin/grpc/grpc-web:BUILD.bazel",
180182
"@build_stack_rules_proto//plugin/grpc-ecosystem/grpc-gateway:BUILD.bazel",
181183
"@build_stack_rules_proto//plugin/scalapb/scalapb:BUILD.bazel",
184+
"@build_stack_rules_proto//plugin/scalapb/zio-grpc:BUILD.bazel",
182185
"@build_stack_rules_proto//plugin/stackb/grpc_js:BUILD.bazel",
183186
"@build_stack_rules_proto//plugin/stephenh/ts-proto:BUILD.bazel",
184187
"@build_stack_rules_proto//rules:BUILD.bazel",

0 commit comments

Comments
 (0)