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

Support Bazel v7

Open coryan opened this issue 2 years ago • 0 comments

Supporting Bazel v7 (even without bzlmod) will require multiple steps. We will use this issue to discuss the ideas and then use it as a tracking bug.

Background

At a high-level, supporting Bazel v7 requires that all our direct and indirect dependencies support Bazel v7. Sadly, gRPC uses a version of rules_apple that is too old for Bazel v7. The targets in gRPC that we need do not really use these rules. However, the Bazel loading phase fails so we need this to be fixed.

Our quickstart WORKSPACE files need to work with the previous release and the upcoming release of google-cloud-cpp.

We can override the rules_apple dependency in our WORKSPACE file(s). That requires changes to all the quickstart WORKSPACE files.

The changes cannot be made compatible between two versions of google-cloud-cpp.

We expect that WORKSPACE files will eventually go away in favor of MODULE files. This transition may last a couple of years, and may spread over the Bazel v8 and Bazel v9 releases. Therefore, this may not be the last time we will need to make incompatible changes to the WORKSPACE files.

Proposal

Change our workspace functions so the quickstart files look like so:

workspace(name = "qs")

# load google-cloud-cpp using http_archive()

load("//bazel:workspace0.bzl", "gl_cpp_workspace0")
gl_cpp_workspace0()
load("//bazel:workspace1.bzl", "gl_cpp_workspace1")
gl_cpp_workspace1()
load("//bazel:workspace2.bzl", "gl_cpp_workspace2")
gl_cpp_workspace2()
load("//bazel:workspace3.bzl", "gl_cpp_workspace3")
gl_cpp_workspace3()
load("//bazel:workspace4.bzl", "gl_cpp_workspace4")
gl_cpp_workspace4()
load("//bazel:workspace5.bzl", "gl_cpp_workspace5")
gl_cpp_workspace5()

We can change the exact meaning of these functions over each release, inserting new dependencies and calling the *_deps() functions of each dependency as needed. The last 3 functions are empty, giving us some room to grow the number of phases over the next 2 years. Note that Bazel v7 may consume at least one more phase.


  • [x] Change our top-level WORKSPACE (and the associated helper functions) to use the gl_cpp_workspace${N} convention.
  • [x] Wait until the next release of google-cloud-cpp.
  • [x] Change all the quickstart/WORKSPACE files to use the gl_cpp_workspace${N} convention.
  • [x] Change the workspace functions to load any dependencies required for Bazel v7.
  • [x] Move the CI builds to use Bazel v7.

  • [ ] Use Bazel v7 with msan build
  • [ ] After the v2.21.0 release, use Bazel v7 with the bazel-quickstart build.

coryan avatar Dec 15 '23 17:12 coryan