Skip to content

Commit

Permalink
Make the bazel rules work with current rules_closure. (#368)
Browse files Browse the repository at this point in the history
* closure_js_library_impl --> create_closure_js_library
* [WORKSPACE] update closure rules to current
* _CloserWorker + _closure_library_base --> CLOSURE_JS_TOOLCHAIN_ATTRS
  • Loading branch information
danfabi authored and stanley-cheung committed Nov 13, 2018
1 parent 7f64402 commit e03f5dd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 22 deletions.
6 changes: 3 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ workspace(name = "com_github_grpc_grpc_web")

http_archive(
name = "io_bazel_rules_closure",
sha256 = "4463509e8f86c9b7726b6b7c751132f0ca14f907cba00759b21f8577c2dcf710",
strip_prefix = "rules_closure-acad96981d76b60844bf815d03043619714839ad",
sha256 = "a8ea3251a6fd05eb3dbd05aa443a12b04cb88d80480d821bee453b18db97afaa",
strip_prefix = "rules_closure-8ec740d0b77ca1fb4914c857dc67ccc3f9cb3ed4",
urls = [
"https://github.com/bazelbuild/rules_closure/archive/acad96981d76b60844bf815d03043619714839ad.zip",
"https://github.com/bazelbuild/rules_closure/archive/8ec740d0b77ca1fb4914c857dc67ccc3f9cb3ed4.zip",
],
)

Expand Down
25 changes: 6 additions & 19 deletions bazel/closure_grpc_web_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@

load(
"@io_bazel_rules_closure//closure/compiler:closure_js_library.bzl",
"closure_js_library_impl",
"create_closure_js_library",
)
load(
"@io_bazel_rules_closure//closure/private:defs.bzl",
"CLOSURE_WORKER_ATTR",
"CLOSURE_LIBRARY_BASE_ATTR",
"CLOSURE_JS_TOOLCHAIN_ATTRS",
"unfurl",
)
load(
Expand Down Expand Up @@ -124,22 +123,14 @@ def _closure_grpc_web_library_impl(ctx):
suppress = [
"misplacedTypeAnnotation",
"unusedPrivateMembers",
"strictDependencies",
]

library = closure_js_library_impl(
actions = ctx.actions,
label = ctx.label,
workspace_name = ctx.workspace_name,

library = create_closure_js_library(
ctx = ctx,
srcs = srcs,
deps = deps,
testonly = ctx.attr.testonly,
suppress = suppress,
lenient = False,

closure_library_base = ctx.files._closure_library_base,
_ClosureWorker = ctx.executable._ClosureWorker,
)
return struct(
exports = library.exports,
Expand All @@ -150,7 +141,7 @@ def _closure_grpc_web_library_impl(ctx):

closure_grpc_web_library = rule(
implementation = _closure_grpc_web_library_impl,
attrs = {
attrs = dict({
"deps": attr.label_list(
mandatory = True,
providers = ["proto", "closure_js_library"],
Expand All @@ -166,10 +157,6 @@ closure_grpc_web_library = rule(
values = ["grpcwebtext", "grpcweb"],
),

# Required for closure_js_library_impl
"_ClosureWorker": CLOSURE_WORKER_ATTR,
"_closure_library_base": CLOSURE_LIBRARY_BASE_ATTR,

# internal only
"_protoc": attr.label(
default = Label("@com_google_protobuf//:protoc"),
Expand All @@ -193,5 +180,5 @@ closure_grpc_web_library = rule(
"_grpc_web_grpcwebclientbase": attr.label(
default = Label("//javascript/net/grpc/web:grpcwebclientbase"),
),
},
}, **CLOSURE_JS_TOOLCHAIN_ATTRS),
)

0 comments on commit e03f5dd

Please sign in to comment.