From 5a198e9c10113639b806de0cddc0502786afdf66 Mon Sep 17 00:00:00 2001 From: Leonid Shalupov Date: Fri, 28 Feb 2025 19:50:03 +0100 Subject: [PATCH] bazel: common options between community and ultimate GitOrigin-RevId: dbdbfddcae08547a0029e8bcbe36bc6098e69878 --- .bazelrc | 54 +++++---------------------------------- common.bazelrc | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 47 deletions(-) create mode 100644 common.bazelrc diff --git a/.bazelrc b/.bazelrc index 924cd0936629..06d30dddad06 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1,52 +1,12 @@ -# https://bazel.build/docs/bazel-and-java#hermetic-testing -# The code is compiled for, executed, and tested on this JVM. +### Profiles ### -build --@rules_jvm//:default-kotlinc-opts=//:k17 +# ci — configuration tailored for CI -common --java_language_version=17 -common --java_runtime_version=remotejdk_21 - -# see https://bazel.build/external/lockfile -# use `bazel mod deps --lockfile_mode=refresh` to update lock file -common --lockfile_mode=error - -# https://bazel.build/docs/bazel-and-java#config-build-tools-java -# A second pair of JDK and JVM used to build and execute tools, which are used in the build process, but are not in the build results. -# That JDK and JVM are controlled using --tool_java_language_version and --tool_java_runtime_version -common --tool_java_language_version=21 -# Java runtime the tools should use -common --tool_java_runtime_version=remotejdk_21 - -# make sure you don't need to open file to read commpilation errors -common --experimental_ui_max_stdouterr_bytes=-1 - -# IDEA do not handle symlinks efficiently (freeze due to modal non-cancellable dialog) and no way to exclude directories by pattern bazel- -common --symlink_prefix=out/bazel- +### --- ### +import common.bazelrc # Disk Cache - build --experimental_disk_cache_gc_max_size=32G --experimental_disk_cache_gc_max_age=28d - -common --enable_platform_specific_config -build:macos --disk_cache=~/Library/Caches/JetBrains/bazel-ij -build:linux --disk_cache=~/.bazel-ij -build:windows --disk_cache=~/.bazel-ij - -# Remote Caching (https://bazel.build/remote/caching) - -# https://github.com/bazelbuild/bazel/issues/13378#issuecomment-869301764 -# https://github.com/buildfarm/buildfarm/issues/756#issuecomment-847890721 -# IJ Infrastruture team will setup Google OAuth instead of mTLS -# basic auth cannot be specified in URL for gRPC, so, please create ~/.netrc file (https://jb.gg/yp4kxq) - -build --bes_results_url=https://ij-build.labs.jb.gg/invocation/ -build --bes_backend=grpcs://ij-build-grpc.labs.jb.gg -build --remote_cache=grpcs://ij-build-grpc.labs.jb.gg - -# https://www.buildbuddy.io/blog/debugging-slow-bazel-builds/ -# check if `--remote_download_outputs=minimal` makes sense for CI or some local builds -build --nolegacy_important_outputs --remote_build_event_upload=minimal -# on CI, set remote_cache_async to false! set to false for local runs also, to investigate https://github.com/bazelbuild/bazel/issues/19273 -build --experimental_remote_cache_async=false --remote_cache_compression - -# build --remote_timeout=3600 \ No newline at end of file +common:macos --disk_cache=~/Library/Caches/JetBrains/community-bazel-disk-cache +common:linux --disk_cache=~/.cache/JetBrains/community-bazel-disk-cache +common:windows --disk_cache=~/AppData/Local/Temp/JetBrains/community-bazel-disk-cache diff --git a/common.bazelrc b/common.bazelrc new file mode 100644 index 000000000000..2fe92eae33c0 --- /dev/null +++ b/common.bazelrc @@ -0,0 +1,69 @@ +# Common bazel settings between open source community repository and the monorepo + +### Profiles ### + +# ci — configuration tailored for CI + +### --- ### + +common --@rules_jvm//:default-kotlinc-opts=@community//:k17 +common --@rules_jvm//:worker-impl=@rules_jvm//src/misc:worker-jvm +common --@rules_jvm//:koltin_inc_threshold=80 --@rules_jvm//:java_inc_threshold=200 + +# hide Java 8 deprecation warnings +common --javacopt=-Xlint:-options + +# https://bazel.build/docs/bazel-and-java#hermetic-testing +# The code is compiled for, executed, and tested on this JVM. +common --java_language_version=17 +common --java_runtime_version=remotejdk_21 + +# see https://bazel.build/external/lockfile +# use `bazel mod deps --lockfile_mode=refresh` to update lock file +common --lockfile_mode=error + +common --noenable_workspace + +common --nolegacy_external_runfiles --experimental_sibling_repository_layout + +# https://bazel.build/docs/bazel-and-java#config-build-tools-java +# A second pair of JDK and JVM used to build and execute tools, which are used in the build process, but are not in the build results. +# That JDK and JVM are controlled using --tool_java_language_version and --tool_java_runtime_version +common --tool_java_language_version=21 +# Java runtime the tools should use +common --tool_java_runtime_version=remotejdk_21 + +# make sure you don't need to open file to read compilation errors +common --experimental_ui_max_stdouterr_bytes=-1 + +# IDEA do not handle symlinks efficiently (freeze due to modal non-cancellable dialog) and no way to exclude directories by pattern bazel- +common --symlink_prefix=out/bazel- + +# FS Watch +build --watchfs +build --experimental_windows_watchfs +build:ci --nowatchfs + +common --enable_platform_specific_config + +common --incompatible_strict_action_env=true + +# Generally good remote cache tweaks +# on CI, set remote_cache_async to false! set to false for local runs also, to investigate https://github.com/bazelbuild/bazel/issues/19273 +common --remote_cache_async=false --remote_cache_compression=true +common:ci --remote_cache_async=false + +# https://www.buildbuddy.io/blog/debugging-slow-bazel-builds/ +# check if `--remote_download_outputs=minimal` makes sense for CI or some local builds +build --remote_build_event_upload=minimal +build --nolegacy_important_outputs + +# protobuf +common --incompatible_enable_proto_toolchain_resolution + +# More debug on CI +common:ci --announce_rc +common:ci --show_progress_rate_limit=30 + +# avoid creating a runfiles tree for binaries or tests until it is needed +build --nobuild_runfile_links