Bazel: Don't depend directly on @local_jdk in java_doc rule

To support alternative java_toolchains (e.g.: to activate all error
prone warnings) we should not directly depend on @local_jdk, but use
@bazel_tools//tools/jdk:current_java_runtime to get the configured JDK
instead.

See this issue for more context: [1].

[1] https://github.com/bazelbuild/bazel/issues/5997

Inspired-by: Liam Miller-Cushon <cushon@google.com>
Change-Id: I66e1215a01f98e435e514a5442533ab15eaebd35
This commit is contained in:
David Ostrovsky 2018-08-27 08:37:54 +02:00
parent b8970045e4
commit 1d89d6c3b3

View File

@ -36,7 +36,7 @@ def _impl(ctx):
"rm -rf %s" % dir,
"mkdir %s" % dir,
" ".join([
ctx.file._javadoc.path,
"%s/bin/javadoc" % ctx.attr._jdk[java_common.JavaRuntimeInfo].java_home,
"-Xdoclint:-missing",
"-protected",
"-encoding UTF-8",
@ -67,14 +67,10 @@ java_doc = rule(
"pkgs": attr.string_list(),
"title": attr.string(),
"external_docs": attr.string_list(),
"_javadoc": attr.label(
default = Label("@local_jdk//:bin/javadoc"),
single_file = True,
allow_files = True,
),
"_jdk": attr.label(
default = Label("@local_jdk//:jdk-default"),
default = Label("@bazel_tools//tools/jdk:current_java_runtime"),
allow_files = True,
providers = [java_common.JavaRuntimeInfo],
),
},
outputs = {"zip": "%{name}.zip"},