Skip to content

Commit

Permalink
Add toolchain param to run_singlejar rule
Browse files Browse the repository at this point in the history
This fixes issue with Bazel downstream when building `@bazel_tools//tools/android:gen_java_base_extras_jar` with `--incompatible_auto_exec_groups` flag which enables AEGs in Bazel.

Since the rule needs to register java toolchain, I've also used that toolchain for the action's executable (`_java_toolchain` is not needed anymore and can be deleted).

PiperOrigin-RevId: 575139627
Change-Id: I60f0aae58aac8156cbf367c96297d7ad7227f655
  • Loading branch information
kotlaja authored and copybara-github committed Oct 20, 2023
1 parent f79ca02 commit e8700e3
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions tools/android/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ def _run_singlejar(ctx):
ctx.actions.run(
inputs = ctx.files.srcs,
outputs = [ctx.outputs.out],
executable = ctx.attr._java_toolchain[java_common.JavaToolchainInfo].single_jar,
executable = ctx.toolchains["@bazel_tools//tools/jdk:toolchain_type"].java.single_jar,
arguments = [args],
toolchain = "@bazel_tools//tools/jdk:toolchain_type",
)

return [DefaultInfo(files = depset([ctx.outputs.out]))]
Expand All @@ -59,9 +60,6 @@ run_singlejar = rule(
"srcs": attr.label_list(mandatory = True),
"out": attr.output(mandatory = True),
"include_prefixes": attr.string_list(),
"_java_toolchain": attr.label(
default = "//tools/jdk:current_java_toolchain",
providers = [java_common.JavaToolchainInfo],
),
},
toolchains = ["@bazel_tools//tools/jdk:toolchain_type"],
)

0 comments on commit e8700e3

Please sign in to comment.