Skip to content

Commit 2df98cb

Browse files
cushoncopybara-github
authored andcommitted
Rename java_toolchain.oneversion_whitelist to oneversion_allowlist
PiperOrigin-RevId: 677839283 Change-Id: I60599ec17e31f038485e79bb68f67d67431eb9d7
1 parent ec190f4 commit 2df98cb

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/main/starlark/builtins_bzl/common/java/java_toolchain.bzl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ def _java_toolchain_impl(ctx):
9090
else:
9191
header_compiler_direct_data = []
9292
header_compiler_direct_jvm_opts = []
93+
if ctx.attr.oneversion_allowlist and ctx.attr.oneversion_whitelist:
94+
fail("oneversion_allowlist and oneversion_whitelist are mutually exclusive")
95+
oneversion_allowlist = ctx.file.oneversion_allowlist if ctx.file.oneversion_allowlist else ctx.file.oneversion_whitelist
9396
java_toolchain_info = _new_javatoolchaininfo(
9497
bootclasspath = bootclasspath_info.bootclasspath,
9598
ijar = ctx.attr.ijar.files_to_run if ctx.attr.ijar else None,
@@ -128,7 +131,7 @@ def _java_toolchain_impl(ctx):
128131
_jspecify_info = _get_jspecify_info(ctx),
129132
_local_java_optimization_config = ctx.files._local_java_optimization_configuration,
130133
_one_version_tool = ctx.attr.oneversion.files_to_run if ctx.attr.oneversion else None,
131-
_one_version_allowlist = ctx.file.oneversion_whitelist,
134+
_one_version_allowlist = oneversion_allowlist,
132135
_one_version_allowlist_for_tests = ctx.file.oneversion_allowlist_for_tests,
133136
_package_configuration = [dep[JavaPackageConfigurationInfo] for dep in ctx.attr.package_configuration],
134137
_reduced_classpath_incompatible_processors = depset(ctx.attr.reduced_classpath_incompatible_processors, order = "preorder"),
@@ -501,6 +504,10 @@ Label of the one-version enforcement binary.
501504
""",
502505
),
503506
"oneversion_whitelist": attr.label(
507+
allow_single_file = True,
508+
doc = """Deprecated: use oneversion_allowlist instead""",
509+
),
510+
"oneversion_allowlist": attr.label(
504511
allow_single_file = True,
505512
doc = """
506513
Label of the one-version allowlist.

src/test/shell/bazel/bazel_java_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2180,7 +2180,7 @@ default_java_toolchain(
21802180
name = "java_toolchain",
21812181
source_version = "17",
21822182
target_version = "17",
2183-
oneversion_whitelist = "//pkg:allowlist",
2183+
oneversion_allowlist = "//pkg:allowlist",
21842184
)
21852185
21862186
java_binary(

0 commit comments

Comments
 (0)