google-cloud-cpp icon indicating copy to clipboard operation
google-cloud-cpp copied to clipboard

Support bzlmod-based builds

Open coryan opened this issue 2 years ago • 11 comments

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 curl module 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 googleapis module in BCR.
    • An override for development is fine, but does not work for downstream consumers.
    • Maybe we can create a new version of googleapis in BCR just before creating a new version of google-cloud-cpp in 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.

coryan avatar May 03 '23 14:05 coryan

Waiting for Bazel 7.0

coryan avatar Aug 30 '23 19:08 coryan

I'll take a stab at some of the tasks this week.

alevenberg avatar Dec 11 '23 21:12 alevenberg

The migration guide https://bazel.build/external/migration

alevenberg avatar Dec 11 '23 21:12 alevenberg

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.

alevenberg avatar Dec 13 '23 15:12 alevenberg

FYI timeline for support for Bazel 6 is until December 2025

alevenberg avatar Dec 13 '23 15:12 alevenberg

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.

coryan avatar Dec 13 '23 15:12 coryan

Add this to 2024 planning.

scotthart avatar May 22 '24 19:05 scotthart

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?

mering avatar Aug 19 '24 14:08 mering

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.

scotthart avatar Aug 19 '24 15:08 scotthart