Skip to content

Commit b6cf2eb

Browse files
cushonrules_java Copybara
authored andcommitted
Rename java_toolchain.oneversion_whitelist to oneversion_allowlist
PiperOrigin-RevId: 677839283 Change-Id: I45d2a914d1a10599fad9c2426564361bd5a29c03
1 parent 203ec02 commit b6cf2eb

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

java/common/rules/java_toolchain.bzl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ def _java_toolchain_impl(ctx):
9191
else:
9292
header_compiler_direct_data = []
9393
header_compiler_direct_jvm_opts = []
94+
if ctx.attr.oneversion_allowlist and ctx.attr.oneversion_whitelist:
95+
fail("oneversion_allowlist and oneversion_whitelist are mutually exclusive")
96+
oneversion_allowlist = ctx.file.oneversion_allowlist if ctx.file.oneversion_allowlist else ctx.file.oneversion_whitelist
9497
java_toolchain_info = _new_javatoolchaininfo(
9598
bootclasspath = bootclasspath_info.bootclasspath,
9699
ijar = ctx.attr.ijar.files_to_run if ctx.attr.ijar else None,
@@ -129,7 +132,7 @@ def _java_toolchain_impl(ctx):
129132
_jspecify_info = _get_jspecify_info(ctx),
130133
_local_java_optimization_config = ctx.files._local_java_optimization_configuration,
131134
_one_version_tool = ctx.attr.oneversion.files_to_run if ctx.attr.oneversion else None,
132-
_one_version_allowlist = ctx.file.oneversion_whitelist,
135+
_one_version_allowlist = oneversion_allowlist,
133136
_one_version_allowlist_for_tests = ctx.file.oneversion_allowlist_for_tests,
134137
_package_configuration = [dep[JavaPackageConfigurationInfo] for dep in ctx.attr.package_configuration],
135138
_reduced_classpath_incompatible_processors = depset(ctx.attr.reduced_classpath_incompatible_processors, order = "preorder"),
@@ -503,6 +506,10 @@ Label of the one-version enforcement binary.
503506
""",
504507
),
505508
"oneversion_whitelist": attr.label(
509+
allow_single_file = True,
510+
doc = """Deprecated: use oneversion_allowlist instead""",
511+
),
512+
"oneversion_allowlist": attr.label(
506513
allow_single_file = True,
507514
doc = """
508515
Label of the one-version allowlist.

java/docs/rules.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -499,10 +499,10 @@ java_toolchain(<a href="#java_toolchain-name">name</a>, <a href="#java_toolchain
499499
<a href="#java_toolchain-javac_supports_worker_multiplex_sandboxing">javac_supports_worker_multiplex_sandboxing</a>, <a href="#java_toolchain-javac_supports_workers">javac_supports_workers</a>, <a href="#java_toolchain-javacopts">javacopts</a>,
500500
<a href="#java_toolchain-jspecify_implicit_deps">jspecify_implicit_deps</a>, <a href="#java_toolchain-jspecify_javacopts">jspecify_javacopts</a>, <a href="#java_toolchain-jspecify_packages">jspecify_packages</a>, <a href="#java_toolchain-jspecify_processor">jspecify_processor</a>,
501501
<a href="#java_toolchain-jspecify_processor_class">jspecify_processor_class</a>, <a href="#java_toolchain-jspecify_stubs">jspecify_stubs</a>, <a href="#java_toolchain-jvm_opts">jvm_opts</a>, <a href="#java_toolchain-licenses">licenses</a>, <a href="#java_toolchain-misc">misc</a>, <a href="#java_toolchain-oneversion">oneversion</a>,
502-
<a href="#java_toolchain-oneversion_allowlist_for_tests">oneversion_allowlist_for_tests</a>, <a href="#java_toolchain-oneversion_whitelist">oneversion_whitelist</a>, <a href="#java_toolchain-package_configuration">package_configuration</a>,
503-
<a href="#java_toolchain-proguard_allowlister">proguard_allowlister</a>, <a href="#java_toolchain-reduced_classpath_incompatible_processors">reduced_classpath_incompatible_processors</a>, <a href="#java_toolchain-singlejar">singlejar</a>,
504-
<a href="#java_toolchain-source_version">source_version</a>, <a href="#java_toolchain-target_version">target_version</a>, <a href="#java_toolchain-timezone_data">timezone_data</a>, <a href="#java_toolchain-tools">tools</a>, <a href="#java_toolchain-turbine_data">turbine_data</a>, <a href="#java_toolchain-turbine_jvm_opts">turbine_jvm_opts</a>,
505-
<a href="#java_toolchain-xlint">xlint</a>)
502+
<a href="#java_toolchain-oneversion_allowlist">oneversion_allowlist</a>, <a href="#java_toolchain-oneversion_allowlist_for_tests">oneversion_allowlist_for_tests</a>, <a href="#java_toolchain-oneversion_whitelist">oneversion_whitelist</a>,
503+
<a href="#java_toolchain-package_configuration">package_configuration</a>, <a href="#java_toolchain-proguard_allowlister">proguard_allowlister</a>, <a href="#java_toolchain-reduced_classpath_incompatible_processors">reduced_classpath_incompatible_processors</a>,
504+
<a href="#java_toolchain-singlejar">singlejar</a>, <a href="#java_toolchain-source_version">source_version</a>, <a href="#java_toolchain-target_version">target_version</a>, <a href="#java_toolchain-timezone_data">timezone_data</a>, <a href="#java_toolchain-tools">tools</a>, <a href="#java_toolchain-turbine_data">turbine_data</a>,
505+
<a href="#java_toolchain-turbine_jvm_opts">turbine_jvm_opts</a>, <a href="#java_toolchain-xlint">xlint</a>)
506506
</pre>
507507

508508
<p>
@@ -571,8 +571,9 @@ java_toolchain(
571571
| <a id="java_toolchain-licenses"></a>licenses | - | List of strings | optional | `[]` |
572572
| <a id="java_toolchain-misc"></a>misc | Deprecated: use javacopts instead | List of strings | optional | `[]` |
573573
| <a id="java_toolchain-oneversion"></a>oneversion | Label of the one-version enforcement binary. | <a href="https://bazel.build/concepts/labels">Label</a> | optional | `None` |
574+
| <a id="java_toolchain-oneversion_allowlist"></a>oneversion_allowlist | Label of the one-version allowlist. | <a href="https://bazel.build/concepts/labels">Label</a> | optional | `None` |
574575
| <a id="java_toolchain-oneversion_allowlist_for_tests"></a>oneversion_allowlist_for_tests | Label of the one-version allowlist for tests. | <a href="https://bazel.build/concepts/labels">Label</a> | optional | `None` |
575-
| <a id="java_toolchain-oneversion_whitelist"></a>oneversion_whitelist | Label of the one-version allowlist. | <a href="https://bazel.build/concepts/labels">Label</a> | optional | `None` |
576+
| <a id="java_toolchain-oneversion_whitelist"></a>oneversion_whitelist | Deprecated: use oneversion_allowlist instead | <a href="https://bazel.build/concepts/labels">Label</a> | optional | `None` |
576577
| <a id="java_toolchain-package_configuration"></a>package_configuration | Configuration that should be applied to the specified package groups. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | `[]` |
577578
| <a id="java_toolchain-proguard_allowlister"></a>proguard_allowlister | Label of the Proguard allowlister. | <a href="https://bazel.build/concepts/labels">Label</a> | optional | `"@bazel_tools//tools/jdk:proguard_whitelister"` |
578579
| <a id="java_toolchain-reduced_classpath_incompatible_processors"></a>reduced_classpath_incompatible_processors | Internal API, do not use! | List of strings | optional | `[]` |

0 commit comments

Comments
 (0)