forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
api_binding.bzl
40 lines (37 loc) · 1.33 KB
/
api_binding.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
def _default_envoy_api_impl(ctx):
ctx.file("WORKSPACE", "")
api_dirs = [
"BUILD",
"bazel",
"envoy",
"examples",
"test",
"tools",
"versioning",
"contrib",
"buf.yaml",
]
for d in api_dirs:
ctx.symlink(ctx.path(ctx.attr.envoy_root).dirname.get_child(ctx.attr.reldir).get_child(d), d)
ctx.symlink(ctx.path(ctx.attr.envoy_root).dirname.get_child("bazel").get_child("utils.bzl"), "utils.bzl")
_default_envoy_api = repository_rule(
implementation = _default_envoy_api_impl,
attrs = {
"envoy_root": attr.label(default = "@envoy//:BUILD"),
"reldir": attr.string(),
},
)
def envoy_api_binding():
# Treat the data plane API as an external repo, this simplifies exporting
# the API to https://github.com/envoyproxy/data-plane-api.
if "envoy_api" not in native.existing_rules().keys():
_default_envoy_api(name = "envoy_api", reldir = "api")
# TODO(https://github.com/envoyproxy/envoy/issues/7719) need to remove both bindings and use canonical rules
native.bind(
name = "api_httpbody_protos",
actual = "@com_google_googleapis//google/api:httpbody_cc_proto",
)
native.bind(
name = "http_api_protos",
actual = "@com_google_googleapis//google/api:annotations_cc_proto",
)