bazel: Add remote cache support
Bug: 312215590
Change-Id: Ibc4b542411f7facb5b4f0fa8af5c43bf5e04d5df
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/examples/+/216114
Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Ted Pudlik <tpudlik@google.com>
Lint: Lint 🤖 <android-build-ayeaye@system.gserviceaccount.com>
Reviewed-by: Taylor Cramer <cramertj@google.com>
diff --git a/.bazelrc b/.bazelrc
index f7097cb..91934e2 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -65,3 +65,17 @@
# Error output settings.
common --verbose_failures
test --test_output=errors
+
+# Use the remote cache. This will only work for users who have permission to access it.
+common:remote_cache --remote_cache=grpcs://remotebuildexecution.googleapis.com
+common:remote_cache --google_default_credentials=true
+common:remote_cache --remote_instance_name=projects/pigweed-rbe-open/instances/default-instance
+common:remote_cache --remote_upload_local_results=false
+
+# User bazelrc file; see
+# https://bazel.build/configure/best-practices#bazelrc-file
+#
+# Note: this should be at the bottom of the file, so that user-specified
+# options override anything in this file
+# (https://bazel.build/run/bazelrc#imports)
+try-import %workspace%/user.bazelrc
diff --git a/.gitignore b/.gitignore
index 66fb8a3..6e4c6a0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
.presubmit/
compile_commands.json
bazel-*
+user.bazelrc
# Environment
.environment
diff --git a/pigweed.json b/pigweed.json
index 006a0bc..076d642 100644
--- a/pigweed.json
+++ b/pigweed.json
@@ -1,8 +1,8 @@
{
"pw": {
"bazel_presubmit": {
- "remote_cache": false,
- "upload_local_results": false,
+ "remote_cache": true,
+ "upload_local_results": true,
"programs": {
"default": [
[