-
-
Notifications
You must be signed in to change notification settings - Fork 162
/
Copy pathjs_grpc_node_library.bzl
43 lines (38 loc) · 1.2 KB
/
js_grpc_node_library.bzl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
"""Generated definition of js_grpc_node_library."""
load("//js:js_grpc_node_compile.bzl", "js_grpc_node_compile")
load("//:defs.bzl", "bazel_build_rule_common_attrs", "proto_compile_attrs")
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
def js_grpc_node_library(name, **kwargs):
# Compile protos
name_pb = name + "_pb"
js_grpc_node_compile(
name = name_pb,
**{
k: v
for (k, v) in kwargs.items()
if k in proto_compile_attrs.keys() or
k in bazel_build_rule_common_attrs
} # Forward args
)
# Resolve deps
deps = [
dep.replace("@npm", kwargs.get("deps_repo", "@npm"))
for dep in GRPC_DEPS
]
# Create js library
js_library(
name = name,
srcs = [name_pb],
deps = deps + kwargs.get("deps", []),
package_name = kwargs.get("package_name", name),
strip_prefix = name_pb if not kwargs.get("legacy_path") else None,
**{
k: v
for (k, v) in kwargs.items()
if k in bazel_build_rule_common_attrs
} # Forward Bazel common args
)
GRPC_DEPS = [
"@npm//google-protobuf",
"@npm//@grpc/grpc-js",
]