Bazel: Adapt RBE to produce Java 11 language level

In I79434c657bd language level was changed to Java 11 per default, but
in remote build configuration this switch was missed.

Switch RBE auto configuration to use JDK 11. The output generated is
major bytecode version 55 that won't run on Java 8.

Test Plan:

  $ bazel test \
      --config=remote \
      --remote_instance_name=<project-name> \
      javatests/...

Change-Id: Ifdabbea9517306ee48c3a85b1b04f6f01878597c
This commit is contained in:
David Ostrovsky
2020-12-20 21:36:25 +01:00
parent 6dce37ecbb
commit 001943db82
2 changed files with 12 additions and 41 deletions

View File

@@ -45,9 +45,11 @@ http_archive(
load("@bazel_toolchains//rules:rbe_repo.bzl", "rbe_autoconfig")
# Creates a default toolchain config for RBE.
# Use this as is if you are using the rbe_ubuntu16_04 container,
# otherwise refer to RBE docs.
rbe_autoconfig(name = "rbe_default")
rbe_autoconfig(
name = "rbe_jdk11",
java_home = "/usr/lib/jvm/11.29.3-ca-jdk11.0.2/reduced",
use_checked_in_confs = "Force",
)
http_archive(
name = "com_google_protobuf",

View File

@@ -30,36 +30,20 @@ build:remote --disk_cache=
# Set several flags related to specifying the platform, toolchain and java
# properties.
# These flags are duplicated rather than imported from (for example)
# %workspace%/configs/ubuntu16_04_clang/1.2/toolchain.bazelrc to make this
# bazelrc a standalone file that can be copied more easily.
# These flags should only be used as is for the rbe-ubuntu16-04 container
# and need to be adapted to work with other toolchain containers.
build:remote --host_javabase=@bazel_toolchains//configs/ubuntu16_04_clang/1.2:jdk8
build:remote --javabase=@bazel_toolchains//configs/ubuntu16_04_clang/1.2:jdk8
build:remote --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8
build:remote --java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8
build:remote --crosstool_top=@bazel_toolchains//configs/ubuntu16_04_clang/1.2/bazel_0.25.0/default:toolchain
build:remote --host_javabase=@rbe_jdk11//java:jdk
build:remote --javabase=@rbe_jdk11//java:jdk
build:remote --crosstool_top=@rbe_jdk11//cc:toolchain
build:remote --extra_toolchains=@rbe_jdk11//config:cc-toolchain
build:remote --extra_execution_platforms=@rbe_jdk11//config:platform
build:remote --host_platform=@rbe_jdk11//config:platform
build:remote --platforms=@rbe_jdk11//config:platform
build:remote --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
# Platform flags:
# The toolchain container used for execution is defined in the target indicated
# by "extra_execution_platforms", "host_platform" and "platforms".
# If you are using your own toolchain container, you need to create a platform
# target with "constraint_values" that allow for the toolchain specified with
# "extra_toolchains" to be selected (given constraints defined in
# "exec_compatible_with").
# More about platforms: https://docs.bazel.build/versions/master/platforms.html
build:remote --extra_toolchains=@bazel_toolchains//configs/ubuntu16_04_clang/1.2/bazel_0.25.0/cpp:cc-toolchain-clang-x86_64-default
build:remote --extra_execution_platforms=@bazel_toolchains//configs/ubuntu16_04_clang/1.2:rbe_ubuntu1604
build:remote --host_platform=@bazel_toolchains//configs/ubuntu16_04_clang/1.2:rbe_ubuntu1604
build:remote --platforms=@bazel_toolchains//configs/ubuntu16_04_clang/1.2:rbe_ubuntu1604
# Set various strategies so that all actions execute remotely. Mixing remote
# and local execution will lead to errors unless the toolchain and remote
# machine exactly match the host machine.
build:remote --spawn_strategy=remote,sandboxed
build:remote --strategy=Javac=remote
build:remote --strategy=Closure=remote
build:remote --strategy=Genrule=remote
build:remote --define=EXECUTOR=remote
@@ -78,20 +62,6 @@ build:remote --remote_timeout=3600
# account credential instead.
build:remote --auth_enabled=true
# The following flags are only necessary for local docker sandboxing
# with the rbe-ubuntu16-04 container. Use of these flags is still experimental.
build:docker-sandbox --host_javabase=@bazel_toolchains//configs/ubuntu16_04_clang/1.2:jdk8
build:docker-sandbox --javabase=@bazel_toolchains//configs/ubuntu16_04_clang/1.2:jdk8
build:docker-sandbox --crosstool_top=@bazel_toolchains//configs/ubuntu16_04_clang/1.2/bazel_0.25.0/default:toolchain
build:docker-sandbox --experimental_docker_image=gcr.io/cloud-marketplace/google/rbe-ubuntu16-04@sha256:da0f21c71abce3bbb92c3a0c44c3737f007a82b60f8bd2930abc55fe64fc2729
build:docker-sandbox --spawn_strategy=docker
build:docker-sandbox --strategy=Javac=docker
build:docker-sandbox --strategy=Closure=docker
build:docker-sandbox --strategy=Genrule=docker
build:docker-sandbox --define=EXECUTOR=remote
build:docker-sandbox --experimental_docker_verbose
build:docker-sandbox --experimental_enable_docker_sandbox
# The following flags enable the remote cache so action results can be shared
# across machines, developers, and workspaces.
build:remote-cache --remote_cache=remotebuildexecution.googleapis.com
@@ -100,5 +70,4 @@ build:remote-cache --remote_timeout=3600
build:remote-cache --auth_enabled=true
build:remote-cache --spawn_strategy=standalone
build:remote-cache --strategy=Javac=standalone
build:remote-cache --strategy=Closure=standalone
build:remote-cache --strategy=Genrule=standalone