Support bzlmod-based builds
Bazel is adding a new (better) way to handle dependencies:
https://bazel.build/external/overview#bzlmod
This automatically handles recursive dependencies, resolves diamond dependencies, etc. And supports multiple registries of packages:
https://bazel.build/external/registry
With a default "global registry":
https://github.com/bazelbuild/bazel-central-registry
We need to figure out a number of things, and implement a number of things. This list is probably not exhaustive, it needs to be filled out:
- [x] We need to figure out how to have backup sources for our dependencies. Consider https://blog.aspect.build/configuring-bazels-downloader
- [x] The
curlmodule in BCR does not support HTTPs. Filed https://github.com/bazelbuild/bazel-central-registry/issues/2332 - [x] #14454
- [ ] We need to decide how to manage the
googleapismodule in BCR.- An override for development is fine, but does not work for downstream consumers.
- Maybe we can create a new version of
googleapisin BCR just before creating a new version ofgoogle-cloud-cppin BCR.
- [x] We would need at least one CI build using the bzlmod configuration
- [ ] We need to update the documentation for Bazel customers
- [ ] We need to decide if we recommend bzlmod in our quickstart files. Or more likely when we start doing so.
- These cannot change until there is a BCR module for
google-cloud-cpp.
Waiting for Bazel 7.0
I'll take a stab at some of the tasks this week.
The migration guide https://bazel.build/external/migration
I think we're gonna first just want to compile with bazel 7.0, and then we can tackle bazelmod.
Waiting to see if we can get that build working on Mac (https://github.com/bazelbuild/bazel/issues/20513) and Windows.
FYI timeline for support for Bazel 6 is until December 2025
Yes, but the support policy for the libraries is only 6 months:
https://opensource.google/documentation/policies/cplusplus-support#support_criteria_3
I will argue that we should only start the clock on Bazel 6 once Bazel 7 works.
Add this to 2024 planning.
As there is a working MODULE.bazel file already, I would appreciate this being available in BCR. The first uploads could be manually while future ones could be more automated. Do you plan on adding it yourself or should I go ahead an propose a first upload to BCR?
We're still waiting on several of our dependencies to be added to BCR. The Bazel team is aware of this and is working on it.