[bazel] Introduce grpc_web_toolchain#872
Conversation
This change adds a new rule `grpc_web_toolchain` which we will use to provide the generator/runtime to `closure_grpc_web_library`. Updates grpc#507 RELNOTES: [bazel] `closure_grpc_web_library` now uses toolchains to resolve the generator and runtime. To migrate, add the following snipped to your `WORKSPACE`: ```starlark load("@com_github_grpc_grpc_web//bazel:repositories.bzl", "grpc_web_toolchains") grpc_web_toolchains() ```
|
This is not ready for merging because the required change in Bazel has not been released yet. Requires Bazel@HEAD (> 3.3.x). |
|
This is ready for review now. PTAL, thanks! |
stanley-cheung
left a comment
There was a problem hiding this comment.
@Yannic Thanks for bringing this to the finish line! I know this is a long time coming.
I reviewed this to the best of my ability, although I must admit I don't fully understand some of the concepts like what exactly a toolchain is. I trust that these code will be exercised by https://github.com/grpc/grpc-web/blob/master/scripts/docker-run-tests.sh#L22, https://github.com/grpc/grpc-web/blob/master/net/grpc/gateway/docker/prereqs/Dockerfile#L54, and etc.
LGTM. Thanks again!
| name = "closure_toolchain_impl", | ||
| generator = "//javascript/net/grpc/web:protoc-gen-grpc-web", | ||
| runtime_library = "//javascript/net/grpc/web:closure_grpcweb_runtime", | ||
| ) |
There was a problem hiding this comment.
I guess my question here is that, do the attribute generator and runtime_library have special meaning here? Or it can be any string?
There was a problem hiding this comment.
Both attributes are Labels that have to point to targets (just like, e.g, cc_library's deps). generator also must be an executable target (e.g. {cc,go,java}_binary) and runtime_library must point to a closure_js_library (compatible) target.
| name = "closure_toolchain_impl", | ||
| generator = "//javascript/net/grpc/web:protoc-gen-grpc-web", | ||
| runtime_library = "//javascript/net/grpc/web:closure_grpcweb_runtime", | ||
| ) |
There was a problem hiding this comment.
Both attributes are Labels that have to point to targets (just like, e.g, cc_library's deps). generator also must be an executable target (e.g. {cc,go,java}_binary) and runtime_library must point to a closure_js_library (compatible) target.
This change adds a new rule
grpc_web_toolchainwhich we will use toprovide the generator/runtime to
closure_grpc_web_library.Updates #507
RELNOTES: [bazel]
closure_grpc_web_librarynow uses toolchains toresolve the generator and runtime. To migrate, add the following snipped
to your
WORKSPACE:RELNOTES: [bazel] gRPC-Web now follows best practices for exporting
rules and exports all public symbols in
@com_github_grpc_grpc_web//bazel:defs.bzl.We intend to remove the existing
closure_grpc_web_library.bzlin afuture release.