Bump Bazel version to release 5.0.0. In this new Bazel release,
--incompatible_use_toolchain_resolution_for_java_rules is flipped, that
means that the build must be adapted to toolchain resolution.
Specification toolchain resolution for java rules is here: [1]. Main
tracking Bazel issue is here: [2].
Given that new Bazel release also added support for remote JDK 17, add
experimental support for building with remote JDK 17 to produce major
byte code version 61.
Test Plan:
To build with remote JDK 11 run:
$ bazel build :all
To build with remote JDK 17 run:
$ bazel build --config java17 :all
[1] https://docs.google.com/document/d/1MVbBxbKVKRJJY7DnkptHpvz7ROhyAYy4a-TZ-n7Q0r4/edit?usp=sharing
[2] https://github.com/bazelbuild/bazel/issues/7849
Change-Id: I8d26dff722c6677ea7642913b61e416b23ea9041
To avoid JDK specific bugs in future, like Bug: 568950, and given that
upcoming Bazel release 4.0.0 added support to JDK 15 java toolchain,
add definition for remote JDK 15 to WORKSPACE file and add build and
test instructions.
To build and execute the tests with JDK 15 on Linux run:
$ bazelisk test \
--java_toolchain=@remote_java_tools_linux//:toolchain_jdk_15 \
--host_java_toolchain=@remote_java_tools_linux//:toolchain_jdk_15 \
--javabase=@openjdk15_linux_archive//:runtime \
--host_javabase=@openjdk15_linux_archive//:runtime \
//...
To build and execute the tests with JDK 15 on Mac Os X run:
$ bazelisk test \
--java_toolchain=@remote_java_tools_darwin//:toolchain_jdk_15 \
--host_java_toolchain=@remote_java_tools_darwin//:toolchain_jdk_15 \
--javabase=@openjdk15_darwin_archive//:runtime \
--host_javabase=@openjdk15_darwin_archive//:runtime \
//...
To skip the options on the command line, put them in ~/.bazelrc file:
build --java_toolchain=@remote_java_tools_linux//:toolchain_jdk_15
build --host_java_toolchain=@remote_java_tools_linux//:toolchain_jdk_15
build --javabase=@openjdk15_linux_archive//:runtime
build --host_javabase=@openjdk15_linux_archive//:runtime
Change-Id: I79d5e99f0c731847a82ce7d4c410855434d85f8d
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
This latest release includes cherry picks, a new feature and some
important changes [1].
[1] https://github.com/bazelbuild/bazel/releases/tag/3.5.0
Change-Id: Ie6966b0b56a351f98cb20b25daf3412740e68562
Signed-off-by: Marco Miller <marco.miller@ericsson.com>
Bazelisk is utility to switch to the right Bazel version, that we
used to have with Buck build tool: [1].
Bazelisk will download the right Bazel version only once and will use
it in subsequent calls:
$ bazelisk build :release
2019/06/06 16:22:15 Downloading \
https://releases.bazel.build/0.26.1/release/bazel-0.26.1-linux-x86_64...
Bazelisk is storing the binaries in user's cache directory: [2], e.g.
on Linux OS:
$ ls -1 ~/.cache/bazelisk/bin
bazel-0.26.1-linux-x86_64
* [1] https://github.com/bazelbuild/bazelisk
* [2] https://golang.org/pkg/os/#UserCacheDir
Change-Id: Ia9180fb75f8cc17a0a0232622cf33a13bfad6b60
Signed-off-by: David Ostrovsky <david@ostrovsky.org>