Skip to content

Advertise Zio symbols if the label includes "zio" #385

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
25 changes: 19 additions & 6 deletions pkg/rule/rules_scala/scala_library.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,13 +452,26 @@ func provideScalaImports(files []*protoc.File, resolver protoc.ImportResolver, f
resolver.Provide(lang, "service", name+"Client", from)
resolver.Provide(lang, "service", name+"Handler", from)
resolver.Provide(lang, "service", name+"Server", from)
// TOOD: if this is configured on the proto_plugin, we won't know
// about the plugin option. Advertise them anyway.
// if options["server_power_apis"] {
resolver.Provide(lang, "service", name+"PowerApi", from)
resolver.Provide(lang, "service", name+"PowerApiHandler", from)
resolver.Provide(lang, "service", name+"ClientPowerApi", from)

if strings.Contains(from.Name, "zio") {
zioName := "Zio" + s.Name
if pkgName != "" {
zioName = pkgName + "." + zioName
}
// if the scala rule name includes the term 'zio', assume this is a
// zio library and advertize the zio symbols as well.
resolver.Provide(lang, "service", zioName, from)

} else {
// options["server_power_apis"] may or may not be enabled and
// it's difficult to know if the option is present. Advertize
// them optimitically anyway.
resolver.Provide(lang, "service", name+"PowerApi", from)
resolver.Provide(lang, "service", name+"PowerApiHandler", from)
resolver.Provide(lang, "service", name+"ClientPowerApi", from)
}
// }

}
}
}
Expand Down
3 changes: 3 additions & 0 deletions rules/private/proto_repository_tools_srcs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ PROTO_REPOSITORY_TOOLS_SRCS = [
"@build_stack_rules_proto//pkg/plugin/grpcecosystem/grpcgateway:protoc-gen-grpc-gateway.go",
"@build_stack_rules_proto//pkg/plugin/scalapb/scalapb:BUILD.bazel",
"@build_stack_rules_proto//pkg/plugin/scalapb/scalapb:protoc_gen_scala.go",
"@build_stack_rules_proto//pkg/plugin/scalapb/zio_grpc:BUILD.bazel",
"@build_stack_rules_proto//pkg/plugin/scalapb/zio_grpc:protoc_gen_zio_grpc.go",
"@build_stack_rules_proto//pkg/plugin/stackb/grpc_js:BUILD.bazel",
"@build_stack_rules_proto//pkg/plugin/stackb/grpc_js:protoc-gen-grpc-js.go",
"@build_stack_rules_proto//pkg/plugin/stephenh/ts-proto:BUILD.bazel",
Expand Down Expand Up @@ -179,6 +181,7 @@ PROTO_REPOSITORY_TOOLS_SRCS = [
"@build_stack_rules_proto//plugin/grpc/grpc-web:BUILD.bazel",
"@build_stack_rules_proto//plugin/grpc-ecosystem/grpc-gateway:BUILD.bazel",
"@build_stack_rules_proto//plugin/scalapb/scalapb:BUILD.bazel",
"@build_stack_rules_proto//plugin/scalapb/zio-grpc:BUILD.bazel",
"@build_stack_rules_proto//plugin/stackb/grpc_js:BUILD.bazel",
"@build_stack_rules_proto//plugin/stephenh/ts-proto:BUILD.bazel",
"@build_stack_rules_proto//rules:BUILD.bazel",
Expand Down
Loading