Remove legacy configured target handling in Java toolchain alias rules
@@ -27,16 +27,6 @@ def _copy_default_info(info):
def _java_runtime_alias(ctx):
"""An experimental implementation of java_runtime_alias using toolchain resolution."""
toolchain = find_java_runtime_toolchain(ctx, target = ctx.attr._java_runtime)
-
- # find_java_runtime_toolchain returns a configured target if toolchain resolution is disabled
- # TODO(cushon): consolidate this with the branch below once JavaRuntimeInfo.files is released
- if type(toolchain) == "Target":
- return [
- toolchain[java_common.JavaRuntimeInfo],
- toolchain[platform_common.TemplateVariableInfo],
- _copy_default_info(toolchain[DefaultInfo]),
- ]
-
return [
toolchain,
platform_common.TemplateVariableInfo({
@@ -86,17 +76,12 @@ java_host_runtime_alias = rule(
def _java_toolchain_alias(ctx):
"""An experimental implementation of java_toolchain_alias using toolchain resolution."""
toolchain = find_java_toolchain(ctx, target = ctx.attr._java_toolchain)
-
- # find_java_runtime_toolchain returns a configured target if toolchain resolution is disabled
- if type(toolchain) == "Target":
return struct(
- providers = [toolchain[java_common.JavaToolchainInfo]],
+ providers = [toolchain],
# Use the legacy provider syntax for compatibility with the native rules.
- java_toolchain = toolchain[java_common.JavaToolchainInfo],
+ java_toolchain = toolchain,
)
- return toolchain
-
java_toolchain_alias = rule(
implementation = _java_toolchain_alias,
toolchains = ["@bazel_tools//tools/jdk:toolchain_type"],
