From a75dfff9e997e3e62cd60c46c45cf9242b1c4ee9 Mon Sep 17 00:00:00 2001 From: Patrick Balestra Date: Mon, 9 Jan 2023 08:59:30 +0100 Subject: [PATCH] Generate gitignored bazelrc with version-specific flags --- .gitignore | 1 + bazel_6.bazelrc | 3 +++ shared.bazelrc | 3 +++ tools/bazel | 4 +++- 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index c77ef9d392..9a9efe893f 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ # Symlink to `$DEVELOPER_DIR/Toolchains/XcodeDefault.xctoolchain/usr/lib` **/*.xcodeproj/rules_xcodeproj/lib +generated.bazelrc user.bazelrc diff --git a/bazel_6.bazelrc b/bazel_6.bazelrc index 94307cd974..ae3b71b486 100644 --- a/bazel_6.bazelrc +++ b/bazel_6.bazelrc @@ -1 +1,4 @@ build:cache --experimental_remote_build_event_upload=minimal + +# Enable bzlmod under Bazel 6. +common --experimental_enable_bzlmod diff --git a/shared.bazelrc b/shared.bazelrc index ca8f0c192e..07f2595b81 100644 --- a/shared.bazelrc +++ b/shared.bazelrc @@ -1,3 +1,6 @@ +# Import Bazel version-specific bazelrc. +import %workspace%/generated.bazelrc + build --incompatible_disallow_empty_glob build --experimental_convenience_symlinks=ignore build --features=swift.use_global_module_cache diff --git a/tools/bazel b/tools/bazel index e08e5b34e1..cf74c8cd25 100755 --- a/tools/bazel +++ b/tools/bazel @@ -12,4 +12,6 @@ else readonly bazel_version_bazelrc="$root_dir/bazel_6.bazelrc" fi -exec "$BAZEL_REAL" "--bazelrc=$bazel_version_bazelrc" "$@" +echo "import $bazel_version_bazelrc" > "generated.bazelrc" + +exec "$BAZEL_REAL" "$@"