forked from stackb/rules_proto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathruby_proto_compile.bzl
46 lines (42 loc) · 1.26 KB
/
ruby_proto_compile.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
44
45
46
load("//:plugin.bzl", "ProtoPluginInfo")
load(
"//:aspect.bzl",
"ProtoLibraryAspectNodeInfo",
"proto_compile_aspect_attrs",
"proto_compile_aspect_impl",
"proto_compile_attrs",
"proto_compile_impl",
)
# "Aspects should be top-level values in extension files that define them."
ruby_proto_compile_aspect = aspect(
implementation = proto_compile_aspect_impl,
provides = ["proto_compile", ProtoLibraryAspectNodeInfo],
attr_aspects = ["deps"],
attrs = dict(
proto_compile_aspect_attrs,
_plugins = attr.label_list(
doc = "List of protoc plugins to apply",
providers = [ProtoPluginInfo],
default = [
str(Label("//ruby:ruby")),
],
),
),
)
_rule = rule(
implementation = proto_compile_impl,
attrs = dict(
proto_compile_attrs,
deps = attr.label_list(
mandatory = True,
providers = [ProtoInfo, "proto_compile", ProtoLibraryAspectNodeInfo],
aspects = [ruby_proto_compile_aspect],
),
),
)
def ruby_proto_compile(**kwargs):
_rule(
verbose_string = "%s" % kwargs.get("verbose", 0),
plugin_options_string = ";".join(kwargs.get("plugin_options", [])),
**kwargs
)