From efa90cec730a3bc2880e30936a7abfb4f3a9bae0 Mon Sep 17 00:00:00 2001 From: David Ostrovsky Date: Sat, 25 Nov 2023 13:27:00 +0100 Subject: [PATCH] Bazel: Clean up configuration options De-duplicate options for local and remote build configurations. Note, though, that we don't re-use build_shared configuration for default build configuration, e.g.: build --config=build_shared to avoid these confusing warnings during the build, when building non default configurations, e.g.: $ bazel build --config=java11 java/com/google/gerrit/common:server [...] WARNING: option '--java_language_version' was expanded to from both option '--config=build_shared' (source /home/davido/projects/gerrit2/.bazelrc) and option '--config=java11' (source command line options) Also remove unused remote-cache configuration options. Release-Notes: skip Change-Id: Ia557c949227b3038cbd62e4a0a3bad0f17d42218 --- .bazelrc | 44 ++++++++++++++++++++++++-------------------- tools/remote-bazelrc | 7 ------- 2 files changed, 24 insertions(+), 27 deletions(-) diff --git a/.bazelrc b/.bazelrc index 6828f9ee234c..04735bb0e630 100644 --- a/.bazelrc +++ b/.bazelrc @@ -3,31 +3,35 @@ build --repository_cache=~/.gerritcodereview/bazel-cache/repository build --action_env=PATH build --disk_cache=~/.gerritcodereview/bazel-cache/cas -# Builds using remotejdk_11, executes using remotejdk_11 or local_jdk -build:java11 --java_language_version=11 -build:java11 --java_runtime_version=remotejdk_11 -build:java11 --tool_java_language_version=11 -build:java11 --tool_java_runtime_version=remotejdk_11 +# Define configuration using remotejdk_11, executes using remotejdk_11 or local_jdk +build:build_shared --java_language_version=11 +build:build_shared --java_runtime_version=remotejdk_11 +build:build_shared --tool_java_language_version=11 +build:build_shared --tool_java_runtime_version=remotejdk_11 -# Builds using remotejdk_17, executes using remotejdk_17 or local_jdk -build --java_language_version=17 -build --java_runtime_version=remotejdk_17 -build --tool_java_language_version=17 -build --tool_java_runtime_version=remotejdk_17 +# Builds using remotejdk_11, executes using remotejdk_11 or local_jdk +# Avoid warnings for non default configurations: +# build --config=build_shared +build --java_language_version=11 +build --java_runtime_version=remotejdk_11 +build --tool_java_language_version=11 +build --tool_java_runtime_version=remotejdk_11 # Builds and executes on RBE using remotejdk_11 -build:remote11 --java_language_version=11 -build:remote11 --java_runtime_version=remotejdk_11 -build:remote11 --tool_java_language_version=11 -build:remote11 --tool_java_runtime_version=remotejdk_11 -build:remote11 --config=remote_shared +build:remote --config=remote_shared +build:remote --config=build_shared + +# Define configuration using remotejdk_17, executes using remotejdk_17 or local_jdk +build:build_java17_shared --java_language_version=17 +build:build_java17_shared --java_runtime_version=remotejdk_17 +build:build_java17_shared --tool_java_language_version=17 +build:build_java17_shared --tool_java_runtime_version=remotejdk_17 + +build:java17 --config=build_java17_shared # Builds and executes on RBE using remotejdk_17 -build:remote --java_language_version=17 -build:remote --java_runtime_version=remotejdk_17 -build:remote --tool_java_language_version=17 -build:remote --tool_java_runtime_version=remotejdk_17 -build:remote --config=remote_shared +build:remote17 --config=remote_shared +build:remote17 --config=build_java11_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 d634133f81da..9f11965e6664 100644 --- a/tools/remote-bazelrc +++ b/tools/remote-bazelrc @@ -56,10 +56,3 @@ build:remote_shared --remote_timeout=3600 # default. You can use --auth_credentials=some_file.json to use a service # account credential instead. build:remote_shared --google_default_credentials - -# 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 -build:remote-cache --tls_enabled=true -build:remote-cache --remote_timeout=3600 -build:remote-cache --auth_enabled=true