Skip to content

Commit

Permalink
Automated rollback of commit 37268de.
Browse files Browse the repository at this point in the history
*** Reason for rollback ***

Broken `java_test` targets

*** Original change description ***

use the `one_version_allowlist_for_tests` instead of the `one_version_allowlist` for test targets

PiperOrigin-RevId: 557538825
Change-Id: Id46f659d3a3c90d473c0b562235cbd141833bbf5
  • Loading branch information
Googler authored and copybara-github committed Aug 16, 2023
1 parent 96c08ae commit baace69
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/main/starlark/builtins_bzl/common/java/java_binary.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def basic_java_binary(
transitive = [output_groups["_source_jars"]],
)

one_version_output = _create_one_version_check(ctx, java_attrs.runtime_classpath, is_test_rule_class) if (
one_version_output = _create_one_version_check(ctx, java_attrs.runtime_classpath) if (
ctx.fragments.java.one_version_enforcement_on_java_tests or not is_test_rule_class
) else None
validation_outputs = [one_version_output] if one_version_output else []
Expand Down Expand Up @@ -384,18 +384,12 @@ def _create_shared_archive(ctx, java_attrs):
)
return jsa

def _create_one_version_check(ctx, inputs, is_test_rule_class):
def _create_one_version_check(ctx, inputs):
one_version_level = ctx.fragments.java.one_version_enforcement_level
if one_version_level == "OFF":
return None
tool = helper.check_and_get_one_version_attribute(ctx, "one_version_tool")

if is_test_rule_class:
toolchain = semantics.find_java_toolchain(ctx)
allowlist = toolchain.one_version_allowlist_for_tests()
else:
allowlist = helper.check_and_get_one_version_attribute(ctx, "one_version_allowlist")

allowlist = helper.check_and_get_one_version_attribute(ctx, "one_version_allowlist")
if not tool or not allowlist: # On Mac oneversion tool is not available
return None

Expand Down

0 comments on commit baace69

Please sign in to comment.