Bazel: Fix remote build execution for Java 17
Bazel build and test with remote17 configuration was actually executed
locally, and not remotely.
Rename common configuration setting between Java 11 and Java 17 language
level from remote to remote_shared and re-use the common configuration
options for remote (targeting Java 11) and remote17 (targeting Java 17)
configurations.
Test Plan:
Verify that the remote build for Java 17 is actually executed remotely:
$ bazel test --config=remote17 --remote_instance_name=$PROJECT_NAME \
javatests/...
Verify that the remote build for Java 17 is actually producing the major
byte version 61:
$ bazel build --config=remote17 --remote_instance_name=$PROJECT_NAME \
headless
$ javap -verbose -cp bazel-bin/headless.war Main | grep major
major version: 61
Release-Notes: skip
Change-Id: I44ebee2f62930f63420e03a746a8a63adfdf4d33
diff --git a/.bazelrc b/.bazelrc
index cf5403d..94df44e 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -20,12 +20,14 @@
build:remote --java_runtime_version=remotejdk_11
build:remote --tool_java_language_version=11
build:remote --tool_java_runtime_version=remotejdk_11
+build:remote --config=remote_shared
# Builds and executes on RBE using remotejdk_17
build:remote17 --java_language_version=17
build:remote17 --java_runtime_version=remotejdk_17
build:remote17 --tool_java_language_version=17
build:remote17 --tool_java_runtime_version=remotejdk_17
+build:remote17 --config=remote_shared
# Enable strict_action_env flag to. For more information on this feature see
# https://groups.google.com/forum/#!topic/bazel-discuss/_VmRfMyyHBk.
diff --git a/tools/remote-bazelrc b/tools/remote-bazelrc
index c9a83e4..d634133 100644
--- a/tools/remote-bazelrc
+++ b/tools/remote-bazelrc
@@ -25,37 +25,37 @@
# this higher can make builds faster by allowing more jobs to run in parallel.
# Setting it too high can result in jobs that timeout, however, while waiting
# for a remote machine to execute them.
-build:remote --jobs=200
-build:remote --disk_cache=
+build:remote_shared --jobs=200
+build:remote_shared --disk_cache=
# Set several flags related to specifying the platform, toolchain and java
# properties.
-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
+build:remote_shared --crosstool_top=@rbe_jdk11//cc:toolchain
+build:remote_shared --extra_toolchains=@rbe_jdk11//config:cc-toolchain
+build:remote_shared --extra_execution_platforms=@rbe_jdk11//config:platform
+build:remote_shared --host_platform=@rbe_jdk11//config:platform
+build:remote_shared --platforms=@rbe_jdk11//config:platform
+build:remote_shared --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
# 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 --define=EXECUTOR=remote
+build:remote_shared --define=EXECUTOR=remote
# Enable the remote cache so action results can be shared across machines,
# developers, and workspaces.
-build:remote --remote_cache=remotebuildexecution.googleapis.com
+build:remote_shared --remote_cache=remotebuildexecution.googleapis.com
# Enable remote execution so actions are performed on the remote systems.
-build:remote --remote_executor=remotebuildexecution.googleapis.com
+build:remote_shared --remote_executor=remotebuildexecution.googleapis.com
# Set a higher timeout value, just in case.
-build:remote --remote_timeout=3600
+build:remote_shared --remote_timeout=3600
# Enable authentication. This will pick up application default credentials by
# default. You can use --auth_credentials=some_file.json to use a service
# account credential instead.
-build:remote --google_default_credentials
+build:remote_shared --google_default_credentials
# The following flags enable the remote cache so action results can be shared
# across machines, developers, and workspaces.