Create a Bazel BUILD file for BOLT.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Thanks for contributing the Bazel file :) It's probably best to split the atomic rename part to a separate patch.
Thank you for working on it. I was able to build llvm-bolt using the following:
llvm-project/utils/bazel$ bazel build --config=generic_gcc @llvm-project//bolt:llvm-bolt
Couple of questions:
- Do I understand it correctly that BUILD.bazel file need to be kept in sync with CMakeLists.txt?
- Is it possible to run check-bolt tests with bazel?
Yes. In general, there's no way to automatically get the Bazel configuration from the CMake one.
- Is it possible to run check-bolt tests with bazel?
Assuming that check-bolt runs lit tests, no. Support for lit tests is not available in the Bazel build. I prototyped something, but couldn't get it working with LLVM's peculiar layer on top of lit that is deeply intertwined with the CMake build. Some more discussion here: https://discourse.llvm.org/t/bazel-and-check-mlir-target-does-bazel-support-running-lit-tests/61898/6?u=gcmn
I see. I know that bazel build is enabled in pre-merge checks but they are flaky at times, and may not trigger for direct pushes. I may look into adding a buildbot configuration with bazel build. If you have any examples of using bazel in buildbot, please let me know.
- Is it possible to run check-bolt tests with bazel?
Assuming that check-bolt runs lit tests, no. Support for lit tests is not available in the Bazel build. I prototyped something, but couldn't get it working with LLVM's peculiar layer on top of lit that is deeply intertwined with the CMake build. Some more discussion here: https://discourse.llvm.org/t/bazel-and-check-mlir-target-does-bazel-support-running-lit-tests/61898/6?u=gcmn
Right, it invokes lit underneath. I would assume that you still use cmake build for LLVM testing?
I want to mention the Bazel build is an unofficial build system and keeping it work isn't the community's responsibility.
Keeping it work is appreciated by folks who use the Bazel build, though.
We have a Buildkite pipeline that builds every commit: https://buildkite.com/llvm-project/upstream-bazel. Alerts are sent to https://groups.google.com/g/llvm-bazel-alerts. See https://github.com/llvm/llvm-project/tree/main/utils/bazel#continuous-testing. You're welcome to build something with the buildbot infrastructure, but I would first look into why pre-merge tests use a different infra than post-merge and what the long-term plan is. There's currently an effort underway to move a bunch of the infra that's currently run by Google directly to instead be under the auspices of the LLVM foundation, Google having donated the necessary GCP credits to do so. See, e.g. https://github.com/llvm/llvm-iwg/issues/112
Yes, thanks for flagging that. @Amir, if you do anything with a build bot, you'd need to ensure it only notifies those that have opted in in some way. I think a patch editing utils/bazel would count as opting in if that patch was in the blame list. There's also the phabricator project people can join. Note how the Bazel pre-merge testing is enabled: https://github.com/llvm/llvm-project/tree/main/utils/bazel#pre-merge-testing