Skip to content

Commit 795ab9d

Browse files
Introduce denylisted_protos as a preferred replacement for blacklisted_protos attribute.
Either attribute can still be set for now, with blacklisted marked deprecated. PiperOrigin-RevId: 774865199
1 parent e001d57 commit 795ab9d

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

bazel/private/proto_lang_toolchain_rule.bzl

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ load("//bazel/common:proto_lang_toolchain_info.bzl", "ProtoLangToolchainInfo")
1414
load("//bazel/private:toolchain_helpers.bzl", "toolchains")
1515

1616
def _rule_impl(ctx):
17-
provided_proto_sources = depset(transitive = [bp[ProtoInfo].transitive_sources for bp in ctx.attr.blacklisted_protos]).to_list()
17+
if ctx.attr.blacklisted_protos and ctx.attr.denylisted_protos:
18+
fail("Only one of 'denylisted_protos' and 'blacklisted_protos' can be set (prefer 'denylisted_protos').")
19+
denylisted_protos = ctx.attr.denylisted_protos or ctx.attr.blacklisted_protos
20+
provided_proto_sources = depset(transitive = [bp[ProtoInfo].transitive_sources for bp in denylisted_protos]).to_list()
1821

1922
flag = ctx.attr.command_line
2023
if flag.find("$(PLUGIN_OUT)") > -1:
@@ -121,13 +124,20 @@ passed to the proto-compiler:
121124
A language-specific library that the generated code is compiled against.
122125
The exact behavior is LANG_proto_library-specific.
123126
Java, for example, should compile against the runtime."""),
124-
"blacklisted_protos": attr.label_list(
127+
"denylisted_protos": attr.label_list(
125128
providers = [ProtoInfo],
126129
doc = """
127130
No code will be generated for files in the <code>srcs</code> attribute of
128-
<code>blacklisted_protos</code>.
131+
<code>denylisted_protos</code>.
129132
This is used for .proto files that are already linked into proto runtimes, such as
130133
<code>any.proto</code>.""",
134+
),
135+
# TODO: Remove this once it is safe to do so in OSS.
136+
"blacklisted_protos": attr.label_list(
137+
providers = [ProtoInfo],
138+
doc = """
139+
Deprecated. Alias for <code>denylisted_protos</code>. Will be removed in a future release.
140+
""",
131141
),
132142
# TODO: add doc
133143
"allowlist_different_package": attr.label(

0 commit comments

Comments
 (0)