[SDFAB-1196] Build ONOS with Bazel 6.0.0 pre-release
This was a quite big jump (3.7.2 -> 6.x.x) and we had
to face the deprecation of several components.
- javabase/host_javabase -> java_language_version and
java_runtime_version
- java_toolchain/host_java_toolchain -> java_language_version
and java_runtime_version
- Turnedoff "ReturnValueIgnored" related to ErrorProne
- Moved to bazelisk v1.11.0
- patched again the grpc code due to the deprecation of host_javabase
as java_toolcahin contains already this information.
- resource_jars are also handled as resources because java constructs
do not accept them anymore.
- Use the OSGIWrapper to fix the path of the resource_hars and untar them.
Additionally clean up the code and enable/disable logging through a param.
- Fix absolute_javabase in the Dockerfile by providing the absolute
path of the local jvm through local_java_repository. The latter is
appended to the WORKSPACE file on demand inside the Dockerfile.
Change-Id: I96e06fe52b3b49a1a34f01443eec583a95347323
(cherry picked from commit 846c8b167f3e3aa8086b3eab3df94154a75dc423)
diff --git a/.bazelrc b/.bazelrc
index 0d3b799..2b9ed65 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -1,20 +1,16 @@
# By default, we build and run ONOS using the Bazel-provided remote JDK. The
# specific JDK version is defined in tools/build/jdk/BUILD.
#
-# If you prefer to use your locally installed JDK, replace the --javabase and
-# --host_javabase arguments with the following lines. ABSOLUTE_JAVABASE should
-# point to the "JAVA_HOME" of your JDK.
+# If you prefer to use your locally installed JDK use local_java_repositoy
+# in the WORKSPACE file.
#
-# build --javabase=@bazel_tools//tools/jdk:absolute_javabase
-# build --host_javabase=@bazel_tools//tools/jdk:absolute_javabase
-# build --define=ABSOLUTE_JAVABASE=<path/to/jdk>
-# build --define=RUN_WITH_ABSOLUTE_JAVABASE=true
+# https://bazel.build/docs/bazel-and-java
-build --javabase=@org_onosproject_onos//tools/build/jdk:default_jdk
-build --host_javabase=@org_onosproject_onos//tools/build/jdk:default_jdk
-
-build --java_toolchain=@org_onosproject_onos//tools/build/jdk:default_toolchain
-build --host_java_toolchain=@org_onosproject_onos//tools/build/jdk:default_toolchain
+# Builds using remotejdk_11, executes using remotejdk_11 or local_jdk
+build --java_language_version=11
+build --java_runtime_version=remotejdk_11
+build --tool_java_language_version=11
+build --tool_java_runtime_version=remotejdk_11
build --host_force_python=PY2
@@ -22,7 +18,7 @@
build --experimental_strict_action_env
# For external/io_grpc_grpc_java/core/src/main/java/io/grpc/internal/RetriableStream.java
-build --javacopt="-Xep:GuardedBy:WARN -Xep:ComparableType:WARN"
+build --javacopt="-Xep:GuardedBy:WARN -Xep:ComparableType:WARN -Xep:ReturnValueIgnored:OFF"
# intellij-bazel plugin needs this
build --incompatible_new_actions_api=false