Skip to content

Commit

Permalink
fix: downstream change from java bazel
Browse files Browse the repository at this point in the history
Prepare for changes to toolchain handling in java_common

This change is backwards compatible, after the next Bazel release
this code can be updated to use the approach described here:
bazelbuild/bazel#7186
  • Loading branch information
danielmoy-google committed Feb 19, 2019
1 parent 752037d commit 3b0aff7
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions tools/build_rules/verifier_test/java_verifier_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,21 @@ def _java_extract_kzip_impl(ctx):

# Actually compile the sources to be used as a dependency for other tests
jar = ctx.actions.declare_file(ctx.outputs.kzip.basename + ".jar", sibling = ctx.outputs.kzip)

# Use find_java_toolchain / find_java_runtime_toolchain after the next Bazel release,
# see: https://github.com/bazelbuild/bazel/issues/7186
if hasattr(java_common, "JavaToolchainInfo"):
java_toolchain = ctx.attr._java_toolchain[java_common.JavaToolchainInfo]
host_javabase = ctx.attr._host_javabase[java_common.JavaRuntimeInfo]
else:
java_toolchain = ctx.attr._java_toolchain
host_javabase = ctx.attr._host_javabase

java_info = java_common.compile(
ctx,
javac_opts = ctx.attr.opts,
java_toolchain = ctx.attr._java_toolchain,
host_javabase = ctx.attr._host_javabase,
java_toolchain = java_toolchain,
host_javabase = host_javabase,
source_jars = srcjars,
source_files = srcs,
output = jar,
Expand Down

0 comments on commit 3b0aff7

Please sign in to comment.