Skip to content

Commit

Permalink
java_grpc_library.bzl: Pre-migrate for Bazel incompatible_use_toolcha…
Browse files Browse the repository at this point in the history
…in_providers_in_java_common

This doesn't actually yet work with
--incompatible_use_toolchain_providers_in_java_common, as Bazel 0.23 didn't
include enough pieces. But this will work in 0.24 with the flag flipped. In
both cases it will continue working if the flag is not specified.

See grpc#5383 (comment) and
bazelbuild/bazel#7186
  • Loading branch information
ejona86 committed Mar 8, 2019
1 parent 2f50d88 commit 9822882
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions java_grpc_library.bzl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@bazel_tools//tools/jdk:toolchain_utils.bzl", "find_java_runtime_toolchain", "find_java_toolchain")

# "repository" here is for Bazel builds that span multiple WORKSPACES.
def _path_ignoring_repository(f):
if len(f.owner.workspace_root) == 0:
Expand Down Expand Up @@ -40,8 +42,8 @@ def _java_rpc_library_impl(ctx):

java_info = java_common.compile(
ctx,
java_toolchain = ctx.attr._java_toolchain,
host_javabase = ctx.attr._host_javabase,
java_toolchain = find_java_toolchain(ctx, ctx.attr._java_toolchain),
host_javabase = find_java_runtime_toolchain(ctx, ctx.attr._host_javabase),
source_jars = [srcjar],
output_source_jar = ctx.outputs.srcjar,
output = ctx.outputs.jar,
Expand Down

0 comments on commit 9822882

Please sign in to comment.