Skip to content
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
33 changes: 16 additions & 17 deletions docs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ genrule(
],
)

# These `proto_srcs` need to match the srcs in //tools/protodoc:api_v3_protodoc
# TODO: figure a way to automate these queries from the `protodoc_rule`
genquery(
name = "v3_proto_srcs",
expression = "labels(srcs, labels(deps, @envoy_api//:v3_protos))",
Expand All @@ -84,6 +86,18 @@ genquery(
scope = ["@envoy_api//:xds_protos"],
)

genrule(
name = "proto_srcs",
outs = ["proto_srcs.txt"],
cmd = """
cat $(location :v3_proto_srcs) $(location :xds_proto_srcs) > $@
""",
tools = [
":v3_proto_srcs",
":xds_proto_srcs",
],
)

genrule(
name = "empty_protos_rst",
srcs = [":empty_extensions.json"],
Expand All @@ -99,26 +113,12 @@ genrule(
name = "api_rst",
srcs = [
"//tools/protodoc:api_v3_protodoc",
":v3_proto_srcs",
":proto_srcs",
],
outs = ["api_rst.tar"],
cmd = """
$(location //tools/docs:generate_api_rst) \\
$(location v3_proto_srcs) $(locations //tools/protodoc:api_v3_protodoc) $@
""",
tools = ["//tools/docs:generate_api_rst"],
)

genrule(
name = "xds_rst",
srcs = [
"//tools/protodoc:xds_protodoc",
":xds_proto_srcs",
],
outs = ["xds_rst.tar"],
cmd = """
$(location //tools/docs:generate_api_rst) \\
$(location xds_proto_srcs) $(locations //tools/protodoc:xds_protodoc) $@
$(location proto_srcs) $(locations //tools/protodoc:api_v3_protodoc) $@
""",
tools = ["//tools/docs:generate_api_rst"],
)
Expand Down Expand Up @@ -206,7 +206,6 @@ pkg_tar(
":extensions_security_rst",
":external_deps_rst",
":version_history_rst",
":xds_rst",
],
)

Expand Down
10 changes: 4 additions & 6 deletions tools/protodoc/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,8 @@ py_binary(

protodoc_rule(
name = "api_v3_protodoc",
deps = ["@envoy_api//:v3_protos"],
)

protodoc_rule(
name = "xds_protodoc",
deps = ["@envoy_api//:xds_protos"],
deps = [
"@envoy_api//:v3_protos",
"@envoy_api//:xds_protos",
],
)
17 changes: 11 additions & 6 deletions tools/protodoc/protodoc.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,21 @@ def _protodoc_impl(target, ctx):
protodoc_aspect = api_proto_plugin_aspect("//tools/protodoc", _protodoc_impl)

def _protodoc_rule_impl(ctx):
deps = []
for dep in ctx.attr.deps:
for path in dep[OutputGroupInfo].rst.to_list():
envoy_api = (
path.short_path.startswith("../envoy_api") or
path.short_path.startswith("../com_github_cncf_udpa")
)
if envoy_api:
deps.append(path)

return [
DefaultInfo(
files = depset(
transitive = [
depset([
x
for x in ctx.attr.deps[0][OutputGroupInfo].rst.to_list()
if (x.short_path.startswith("../envoy_api") or
x.short_path.startswith("../com_github_cncf_udpa"))
]),
depset(deps),
],
),
),
Expand Down