Fix toolchain definitions for bazel 0.17.1
Without this change, building fails with: $ bazel build tools:error_prone_warnings_toolchain ERROR: /usr/local/google/home/dborowitz/nobackup/c/gerrit-upstream/gerrit/tools/BUILD:45:1: no such target '@bazel_tools//tools/jdk:platformclasspath.jar': target 'platformclasspath.jar' not declared in package 'tools/jdk' (did you mean 'platformclasspath8.jar'?) defined by /usr/local/google/home/dborowitz/.cache/bazel/_bazel_` This target was renamed in 0.17.1: https://bazel.googlesource.com/bazel/+/3987300d6651cf0e6e91b395696afac6913a7d66 https://bazel.googlesource.com/bazel/+/35eaec4caae64af9077e7e614edfa62a09c3b0c4/CHANGELOG.md#release-0_17_1-2018_09_14 Change-Id: Ib1ade4041ecf3839e2755c21858882dca9dd30cb
This commit is contained in:
parent
57cf163527
commit
938398f9dc
44
tools/BUILD
44
tools/BUILD
@ -1,4 +1,8 @@
|
|||||||
load("@bazel_tools//tools/jdk:default_java_toolchain.bzl", "default_java_toolchain")
|
load(
|
||||||
|
"@bazel_tools//tools/jdk:default_java_toolchain.bzl",
|
||||||
|
"JDK9_JVM_OPTS",
|
||||||
|
"default_java_toolchain",
|
||||||
|
)
|
||||||
|
|
||||||
py_binary(
|
py_binary(
|
||||||
name = "merge_jars",
|
name = "merge_jars",
|
||||||
@ -7,44 +11,10 @@ py_binary(
|
|||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
# TODO(davido): remove this when minimum suported Bazel version >= 0.17
|
|
||||||
# Copied from tools/jdk/default_java_toolchain.bzl to make Bazel 0.16
|
|
||||||
# and later Bazel released to work as expected. See this issue for context:
|
|
||||||
# https://github.com/bazelbuild/bazel/issues/6009
|
|
||||||
JDK9_JVM_OPTS = [
|
|
||||||
# Allow JavaBuilder to access internal javac APIs.
|
|
||||||
"--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
|
|
||||||
"--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
|
|
||||||
"--add-exports=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED",
|
|
||||||
"--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
|
|
||||||
"--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED",
|
|
||||||
"--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
|
|
||||||
"--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
|
|
||||||
"--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
|
|
||||||
|
|
||||||
# override the javac in the JDK.
|
|
||||||
"--patch-module=java.compiler=$(location @bazel_tools//third_party/java/jdk/langtools:java_compiler_jar)",
|
|
||||||
"--patch-module=jdk.compiler=$(location @bazel_tools//third_party/java/jdk/langtools:jdk_compiler_jar)",
|
|
||||||
|
|
||||||
# quiet warnings from com.google.protobuf.UnsafeUtil,
|
|
||||||
# see: https://github.com/google/protobuf/issues/3781
|
|
||||||
"--add-opens=java.base/java.nio=ALL-UNNAMED",
|
|
||||||
]
|
|
||||||
|
|
||||||
# See https://github.com/bazelbuild/bazel/issues/3427 for more context
|
|
||||||
default_java_toolchain(
|
|
||||||
name = "error_prone_warnings_toolchain_bazel_0.16",
|
|
||||||
bootclasspath = ["@bazel_tools//tools/jdk:platformclasspath.jar"],
|
|
||||||
jvm_opts = JDK9_JVM_OPTS,
|
|
||||||
package_configuration = [
|
|
||||||
":error_prone",
|
|
||||||
],
|
|
||||||
visibility = ["//visibility:public"],
|
|
||||||
)
|
|
||||||
|
|
||||||
default_java_toolchain(
|
default_java_toolchain(
|
||||||
name = "error_prone_warnings_toolchain",
|
name = "error_prone_warnings_toolchain",
|
||||||
bootclasspath = ["@bazel_tools//tools/jdk:platformclasspath.jar"],
|
bootclasspath = ["@bazel_tools//tools/jdk:platformclasspath9.jar"],
|
||||||
|
jvm_opts = JDK9_JVM_OPTS,
|
||||||
package_configuration = [
|
package_configuration = [
|
||||||
":error_prone",
|
":error_prone",
|
||||||
],
|
],
|
||||||
|
Loading…
Reference in New Issue
Block a user