Switch from bazeliskrc to bazelversion (#4612)

The only documentation I can find for `.bazelversion` is in
https://github.com/bazelbuild/bazelisk/blob/master/README.md. However,
`bazel` will error out if it doesn't match the `.bazelversion`. For
example:

```
╚╡/usr/bin/bazel build :all
ERROR: The project you're trying to build requires Bazel 7.3.0 (specified in [elided]/carbon-lang/.bazelversion), but it wasn't found in /usr/bin.
```

Switching to this because the `MODULE.bazel` requires tighter version
pinning in order to avoid churn, and this should help catch mistakes
early.

In `MODULE.bazel`, demote mention of the version issue because it should
only really occur now when the version is being deliberately changed, so
the connection should be more apparent.
This commit is contained in:
Jon Ross-Perkins
2024-12-03 17:52:20 +00:00
committed by GitHub
parent 74dcd1fd05
commit 0c2ed1b14e
4 changed files with 4 additions and 22 deletions
-7
View File
@@ -1,7 +0,0 @@
# Part of the Carbon Language project, under the Apache License v2.0 with LLVM
# Exceptions. See /LICENSE for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# Keep pinned to a recent release, listed at
# https://github.com/bazelbuild/bazel.
USE_BAZEL_VERSION=7.3.0
+1
View File
@@ -0,0 +1 @@
7.3.0
+2 -14
View File
@@ -7,24 +7,12 @@
`MODULE.bazel.lock` may change locally when `bazel` is executed. This means one
of:
1. `MODULE.bazel` is changing.
1. An input is changing, typically `MODULE.bazel` or `.bazelversion`.
- Running `bazel mod deps` provides a canonical update to
`MODULE.bazel.lock`; include the changes.
- GitHub test actions may also identify platform-specific lockfile
updates.
2. The `bazel` version doesn't match the version used to generate the
`MODULE.bazel.lock`.
- Bazel releases can change the lock file contents.
- We use Bazelisk in order to keep everyone using the same version:
https://bazel.build/install/bazelisk
- Developers are encouraged to alias `bazel` to `bazelisk` for
ease-of-use; some setups, like Homebrew, will include that with a
`bazelisk` install.
- Contribution tools documentation includes `bazelisk` setup:
https://github.com/carbon-language/carbon-lang/blob/trunk/docs/project/contribution_tools.md
- Make sure `bazelisk --version` (or `bazel --version`) matches the
version in `.bazeliskrc`.
3. The host platform hasn't yet been added to the lock file.
2. The host platform hasn't yet been added to the lock file.
- Platforms tested with GitHub actions are kept up-to-date. Other
platforms may fall out of sync due to `bazel` or dependency changes,
and should be updated with a PR the same way a platform is added.
+1 -1
View File
@@ -169,7 +169,7 @@ These tools are essential for work on Carbon.
- Main tools
- [Bazel](https://www.bazel.build/)
- [Bazelisk](https://docs.bazel.build/versions/master/install-bazelisk.html):
Downloads and runs the [configured Bazel version](/.bazeliskrc).
Downloads and runs the [configured Bazel version](/.bazelversion).
- [Clang](https://clang.llvm.org/) and [LLVM](https://llvm.org/)
- NOTE: Most LLVM 14+ installs should build Carbon. If you're having
issues, see