Skip to content

java_grpc_library.bzl: Support alternative javac toolchains#5844

Merged
ejona86 merged 1 commit intogrpc:masterfrom
ejona86:bazel-java-toolchain
Jun 6, 2019
Merged

java_grpc_library.bzl: Support alternative javac toolchains#5844
ejona86 merged 1 commit intogrpc:masterfrom
ejona86:bazel-java-toolchain

Conversation

@ejona86
Copy link
Copy Markdown
Member

@ejona86 ejona86 commented Jun 6, 2019

Depending on jdk:toolchain causes java_grpc_library to always use the
default toolchain, even if the user tried to override it. Changing to
:current_java_toolchain allows the rule to use the user-selected
toolchain when overridden.

Tested by adding to BUILD:

load("@bazel_tools//tools/jdk:default_java_toolchain.bzl", "default_java_toolchain")
default_java_toolchain(
    name = "mychain",
    misc = ["-Amy=flag"],
    visibility = ["//visibility:public"],
)

And then verifying -Amy=flag is in the output of:

bazel aquery --java_toolchain=:mychain services:_reflection_java_grpc

Fixes #5841

Depending on jdk:toolchain causes java_grpc_library to always use the
_default_ toolchain, even if the user tried to override it. Changing to
:current_java_toolchain allows the rule to use the user-selected
toolchain when overridden.

Tested by adding to BUILD:
load("@bazel_tools//tools/jdk:default_java_toolchain.bzl", "default_java_toolchain")
default_java_toolchain(
    name = "mychain",
    misc = ["-Amy=flag"],
    visibility = ["//visibility:public"],
)

And then verifying -Amy=flag is in the output of:
bazel aquery --java_toolchain=:mychain services:_reflection_java_grpc

Fixes grpc#5841
@ejona86 ejona86 added the TODO:backport PR needs to be backported. Removed after backport complete label Jun 6, 2019
@ejona86 ejona86 requested a review from carl-mastrangelo June 6, 2019 20:59
Copy link
Copy Markdown
Contributor

@carl-mastrangelo carl-mastrangelo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ejona86 ejona86 merged commit 5d0c283 into grpc:master Jun 6, 2019
@ejona86 ejona86 deleted the bazel-java-toolchain branch June 6, 2019 22:31
@lock lock bot locked as resolved and limited conversation to collaborators Sep 4, 2019
@ejona86 ejona86 removed the TODO:backport PR needs to be backported. Removed after backport complete label Oct 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bazel] java_rpc_toolchain does not respect Java toolchain flags

2 participants