Skip to content
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

Make the bazel rules work with current rules_closure. #368

Merged
merged 5 commits into from
Nov 13, 2018
Merged
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
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),
)