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

Prepare `google-cloud-cpp` for addition to BCR

Open dbolduc opened this issue 1 year ago • 3 comments

In order to add our repository to the Bazel Central Registry, we cannot have any patches. So says smart Bazel person, @mering.

The one offending patch is for googleapis: https://github.com/googleapis/google-cloud-cpp/blob/main/bazel/googleapis.modules.patch


#14771 removed half of the patch. We balked at accepting the PR though because we did not love that we would have less control over the googleapis SHA update.

However, when we frame the trade-off like this, it seems like the PR is a net positive: Con:

  • updating googleapis SHA takes up to a day and is out of our control Pro:
  • google-cloud-cpp can be added to BCR

Note that we should still be able to pin googleapis to any commit in our repo. We would just have to make sure that commit is on BCR first.


The other half of the patch is the system_includes bit. I don't know exactly what changes. If it is only about suppressing warnings, we were given the following tip:

We are using the following setting in our .bazelrc to hide warnings from external dependencies:

# Avoid warnings from third-party deps that we don't control.
build --per_file_copt=external/.*@-Wno-everything

dbolduc avatar Oct 25 '24 15:10 dbolduc

Quoting the documentation:

Only the root module's overrides take effect — if a module is used as a dependency, its overrides are ignored.

So it is important that google-cloud-cpp builds without the patch (which is specified in an override).

Edit: It is important that google-cloud-cpp builds with the same patches as on BCR when using overrides (specifically removing the system includes part).

mering avatar Oct 25 '24 16:10 mering

I noticed you are already ignoring warnings from external dependencies: https://github.com/googleapis/google-cloud-cpp/blob/bf3bf1c976ba9c71d4a4a99e839b28ae809fc5f0/.bazelrc#L56-L58

I tried adding my suggestion to .bazelrc as well and couldn't notice a difference in the shown warnings.

mering avatar Oct 25 '24 18:10 mering

The system includes part could be fixed by #14804.

mering avatar Oct 25 '24 19:10 mering

The system includes part was fixed by #15229.

mering avatar Jun 27 '25 10:06 mering

Fix for newer versions of googleapis on BCR: #15251

mering avatar Jul 03 '25 18:07 mering

Looks like the merge of this should've resolved this:

  • https://github.com/googleapis/google-cloud-cpp/pull/15263

Can we confirm?

methylDragon avatar Jul 18 '25 04:07 methylDragon

GHA for Windows + Bazel is failing. This task is tracked separately in https://github.com/googleapis/google-cloud-cpp/issues/15293.

jinseopkim0 avatar Jul 21 '25 15:07 jinseopkim0

Closing this issue, as googleapis.modules.patch is no longer used in prepare-for-v3.0.0.

jinseopkim0 avatar Jul 21 '25 15:07 jinseopkim0