From c0ecd3c8ccea85572a6e96d21cd014d0a2cb9f78 Mon Sep 17 00:00:00 2001 From: MTomBosch Date: Fri, 23 Jan 2026 16:25:10 +0100 Subject: [PATCH] Enable and configure Bazel disk cache Signed-off-by: MTomBosch --- .../.devcontainer/s-core-local/on_create_command.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/s-core-devcontainer/.devcontainer/s-core-local/on_create_command.sh b/src/s-core-devcontainer/.devcontainer/s-core-local/on_create_command.sh index d8de6ee..8ffaa13 100755 --- a/src/s-core-devcontainer/.devcontainer/s-core-local/on_create_command.sh +++ b/src/s-core-devcontainer/.devcontainer/s-core-local/on_create_command.sh @@ -18,9 +18,20 @@ if [ -d /var/cache/bazel ]; then echo "Bazel Cache: /var/cache/bazel is not owned by ${current_owner_group}. Setting ownership (this may take a few seconds) ..." sudo chown -R "${current_user_group}" /var/cache/bazel fi - echo "Bazel Cache: Configuring Bazel to use /var/cache/bazel as cache..." + echo "Bazel Cache: Configuring Bazel to use /var/cache/bazel as cache (=output user root)..." echo "startup --output_user_root=/var/cache/bazel" >> ~/.bazelrc + echo "Bazel Cache: Configuring Bazel disk cache to be in /var/cache/bazel/diskcache..." + echo "common --disk_cache=/var/cache/bazel/diskcache" >> ~/.bazelrc +else + echo "Bazel Cache: Configuring Bazel disk cache to be in /var/cache/bazel/diskcache..." + # Assuming the default location for the output user root folder is used + # Put disk cache folder within output user root folder + echo "common --disk_cache=~/.cache/bazel/_disk_cache" >> ~/.bazelrc fi +echo "Bazel Cache: Configuring Bazel disk cache retention time (60 days)..." +echo "common --experimental_disk_cache_gc_max_age=60d" >> ~/.bazelrc +echo "Bazel Cache: Configuring Bazel disk cache max size (50 GB)..." +echo "common --experimental_disk_cache_gc_max_size=50G" >> ~/.bazelrc # Configure clangd to remove the -fno-canonical-system-headers flag, which is # GCC-specific. If not done, there is an annoying error message on the first