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/examples/integration/.bazelrc b/examples/integration/.bazelrc index f20e2c31ae..879cb53f50 100644 --- a/examples/integration/.bazelrc +++ b/examples/integration/.bazelrc @@ -1,6 +1,9 @@ # Import parent workspace settings import %workspace%/../../shared.bazelrc +# This example doesn't support bzlmod yet. +common --noexperimental_enable_bzlmod + # Exercise the extra flags feature build:rules_xcodeproj --@com_github_buildbuddy_io_rules_xcodeproj//xcodeproj:extra_common_flags='--verbose_failures' diff --git a/examples/sanitizers/.bazelrc b/examples/sanitizers/.bazelrc index ccac6fa145..d8f0a049d7 100644 --- a/examples/sanitizers/.bazelrc +++ b/examples/sanitizers/.bazelrc @@ -1,5 +1,8 @@ # Import parent workspace settings import %workspace%/../../shared.bazelrc +# This example doesn't support bzlmod yet. +common --noexperimental_enable_bzlmod + # Use a user.bazelrc if it exists try-import %workspace%/user.bazelrc 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" "$@"