I would like to add MLIR lit tests to the bazel build (see ⚙ D133416 [lit] Test changes to make it work with bazel), which either requires fiddling with the buildbot’s python paths or updating to bazel 5 (see Bazel build fails with msg "env: python: No such file or directory" (macOS Monterey) - Stack Overflow).
IMHO, the best approach that might make this a little easier down the road is to install bazelisk on the buildbots and add a utils/bazel/.bazelversion file, which then also documents which bazel version we intend to support.
This doesn’t enforce a specific bazel version (in particular for downstream projects, which likely don’t want to run the lit tests and would be OK with bazel 4 still), that’s what bazel-skylib/versions_doc.md at main · bazelbuild/bazel-skylib · GitHub would be for.
Does this sound reasonable?
On the presubmit and postsubmit bazel bots I’ve uninstalled the bazel from apt and installed a recent bazelisk.
We already have a
utils/bazel/.bazelversion that points to 4.0.0. If we’re ok with losing bazel 4.0.0 coverage then changing
.bazelversion to 5.0.0 (or whatever version) should be fine. And that should be testable via the bazel presubmit bots.
If anybody is depending specifically on bazel 4.0.0 to build LLVM, please chime in.
I reran the presubmit on ⚙ D133455 [Bazel] Add lit tests to bazel builds. with .bazelversion = 5.0 and it now passes.
The log says
bazel query //... + @llvm-project//... | xargs bazel test --config=ci
2022/09/11 06:58:23 Downloading https://releases.bazel.build/5.0.0/release/bazel-5.0.0-linux-x86_64...
I assume you symlinked bazel to bazelisk to keep the existing build script working?
Yes, bazelisk is installed as
/usr/local/bin/bazel on the bots which matches the installation recommendation.