forked from rules-proto-grpc/rules_proto_grpc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrust_grpc_library.bzl
41 lines (37 loc) · 1.09 KB
/
rust_grpc_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
load("//rust:rust_grpc_compile.bzl", "rust_grpc_compile")
load("//rust:rust_proto_lib.bzl", "rust_proto_lib")
load("@io_bazel_rules_rust//rust:rust.bzl", "rust_library")
def rust_grpc_library(**kwargs):
# Compile protos
name_pb = kwargs.get("name") + "_pb"
name_lib = kwargs.get("name") + "_lib"
rust_grpc_compile(
name = name_pb,
**{k: v for (k, v) in kwargs.items() if k in ("deps", "verbose")} # Forward args
)
# Create lib file
rust_proto_lib(
name = name_lib,
compilation = name_pb,
grpc = True,
)
# Create rust library
rust_library(
name = kwargs.get("name"),
srcs = [name_pb, name_lib],
deps = GRPC_DEPS,
visibility = kwargs.get("visibility"),
)
GRPC_DEPS = [
Label("//rust/raze:futures"),
Label("//rust/raze:grpcio"),
Label("//rust/raze:protobuf"),
Label("//rust:grpc_wrap"),
Label("//rust:address_sorting"),
Label("//rust:grpc"),
Label("//rust:gpr"),
Label("//rust:z"),
Label("//rust:cares"),
Label("//rust:crypto"),
Label("//rust:ssl"),
]