-
Notifications
You must be signed in to change notification settings - Fork 384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Split googleapis into per-language modules #3472
base: main
Are you sure you want to change the base?
Conversation
Hello @bazelbuild/bcr-maintainers, modules without existing maintainers (googleapis-cc, googleapis-go, googleapis-java, googleapis-python, googleapis) have been updated in this PR. Please review the changes. |
dfcb309
to
0d8947f
Compare
8f7654a
to
c54877c
Compare
Hello @bazelbuild/bcr-maintainers, modules without existing maintainers (googleapis-cc, googleapis-go, googleapis-grpc-cc, googleapis-grpc-java, googleapis-java, googleapis-python, googleapis) have been updated in this PR. Please review the changes. |
4d80faa
to
979ea95
Compare
Hello @bazelbuild/bcr-maintainers, modules without existing maintainers (googleapis-cc, googleapis-go, googleapis-grpc-java, googleapis-java, googleapis-python, googleapis) have been updated in this PR. Please review the changes. |
60cfbd8
to
6617794
Compare
@@ -0,0 +1,7 @@ | |||
{ | |||
"integrity": "sha256-hznHbmgfkAkjuQDJ3w73XPQh05yrtUZQxLmtGbanbYU=", | |||
"url": "https://github.com/fmeum/bazel-central-registry/releases/download/v1.0.0/empty.zip", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Replace with a better source after #3474.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't we just allow url to be not set when overlay is used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could, but that would require raising the minimum Bazel version to at least 8.1.0 (the earliest we can ship this).
2ad8da5
to
432a13e
Compare
Another thing which just came to my mind: Uploading new versions will become much more work with this approach. This is especially relevant since we don't have active maintainers for this package and are even further away from release automation. So it will become less likely that people contribute version updates. |
We should avoid making updates more complicated, but I don't see why this would make it so. Instead of the patches, there are now a few overlay files, but that's the only change I see. The "flavor" modules only need new versions if the targets generated in googleapis change in a fundamental way. Do you see other downsides to this approach? I'm thinking of adding a tool to the repo that creates a new version of an existing module by symlinking over files that haven't changed and replacing the old version with the new version in module files, URLs and prefixes. That should make it very easy to update googleapis, regardless of which approach is used. What do you think about that? |
d7bf807
to
0398bd8
Compare
I raised everything which was on my mind for now in #3437 and here.
It would be great if such tool would also handle patches (at least in cases where it applies with somewhat larger fuzzing for moved lines and skip already applied patches). It could create a temporary git repo for this for example ( |
@meteorcloudy @Wyverald Friendly ping |
Looks good to me, but wait for @Wyverald to confirm this is the way to go. |
Sorry about the delay -- this slipped my radar and I've been distracted by other work. I'll take a look later today. |
While I really like this approach to the extensions, I'm actually wondering if it's better to make a bigger break to simplify things. What I mean by that is not having googleapis provide language-specific targets and only provide The main reason I see for having googleapis provide the language-specific targets at all is to ensure that there's no duplication of generated code. Language-specific proto library rules should all be implemented with aspects though, which inherently avoids the duplication problem. The downside of course is that there's a much bigger change for downstream users. Additionally, it would be best if the above change could be made on googleapis itself rather than having someone maintain that as patches to BCR. |
@SanjayVas As much as I would like that, it seems almost impossible without cooperation from upstream and as we have learned, they don't care about Bazel at all. |
Hey, I know I promised to take a look today, but this is quite a big change and I'd like to understand the context better before making a call -- I'll continue to read this (and @mering's previous PR) tomorrow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've finally caught up, I think. Overall, I really like this approach -- it strikes the perfect balance between working with what we have (the googleapis source repo) and ensuring future adaptability. Kudos! :D
A few more points I was thinking of:
- First off, just a comment: I had been working on a draft PR that had a similar idea, except that the "registration" of a rule was done by the ruleset itself. This is obviously not great in hindsight, especially compared to this PR :P
rules_java
shouldn't need to depend ongoogleapis
. On the other hand, this PR suffers a similar (minor) problem to that PR, in that there's no "strict deps" for registration: if my dep has a dependency ongoogleapis-java
, I get Java rules for free, which means that a version upgrade of my dep could break me. I don't think this is a solvable problem though, so no sweat. - There's a fair amount of code in this PR, all in overlay files. I think this is the sort of stuff that would benefit from being in an actual repo (easier to review, etc). Probably
bazel-contrib
could host this. The repo would contain sources for allgoogleapis-*
modules, and even agoogleapis-registry
module that contains nothing but theregister
extension definition. Then we wouldn't need any overlay in the BCR (except forgoogleapis
's MODULE.bazel file itself). - One of the requests from the protobuf team was support for a "nodep"
bazel_dep
; that is, specification for the minimal required version of a certain module, without actually introducing a dep on it (so the requesting module cannot use it, even if the dep is present in the dep graph). This would make it more feasible for them to split up theprotobuf
module. Similarly, it could probably help smooth the version requirements here: the "central"googleapis
(orgoogleapis-registry
) module could have a "nodep" spec for allgoogleapis-*
flavors, so that nobody ever has to worry about version skew. Obviously no action required for this PR, but I'm interested to hear your thoughts.
@@ -0,0 +1,19 @@ | |||
module( | |||
name = "googleapis", | |||
version = "0.0.0-20241220-5e258e33", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we increment the compatibility level here? IIUC this is a change that breaks almost everyone who uses the old googleapis
("almost" because those who only use proto_library
targets should be unaffected), so upping the compatibility level should be a win.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My rule of thumb for this is:
- Does it only break the root module (rather than transitive dependencies, that is, BCR modules)? If so, asking the root module to migrate to the new version typically doesn't require significantly more effort than setting up a
multiple_version_override
. - Would it be reasonable to have a project depend on two different versions of the module? If not, then
multiple_version_override
will impact maintainability of the root module.
In this particular case, the answers to these questions are "yes (and migrating just requires a few bazel_dep
s, so you won't need to touch files beyond MODULE.bazel
)" and "hell no (a single version of googleapis is already troublesome enough)".
modules/googleapis/0.0.0-20241220-5e258e33/overlay/private/extensions/switched_rules.bzl
Outdated
Show resolved
Hide resolved
modules/googleapis/0.0.0-20241220-5e258e33/overlay/private/extensions/switched_rules.bzl
Outdated
Show resolved
Hide resolved
modules/googleapis/0.0.0-20241220-5e258e33/overlay/private/extensions/switched_rules.bzl
Outdated
Show resolved
Hide resolved
modules/googleapis/0.0.0-20241220-5e258e33/overlay/private/extensions/constants.bzl
Outdated
Show resolved
Hide resolved
Yes, this is a caveat that is relevant, but I also don't see a way to avoid this.
I'm still not sure what I prefer, but this approach has an important drawback: It gets much harder to contribute new googleapis versions. Since upstream is not going to support this, we would need a dedicated If we keep the sources in the BCR, the users of the module are in more direct control over the module (assuming we always have sufficiently many maintainers). Since the overlays should change only very rarely (essentially someone adds a new
Yes, that's the missing piece to making this design maintainable in the long run - without it, we wouldn't have a way to force new |
To be clear, the |
540aafd
to
56d9a90
Compare
Hello @bazelbuild/bcr-maintainers, modules without existing maintainers (googleapis-cc, googleapis-go, googleapis-grpc-cc, googleapis-grpc-java, googleapis-java, googleapis-python, googleapis-rules-registry, googleapis) have been updated in this PR. |
This is now stacked on #3786, which adds the separate modules. |
Introduces new
googleapis-*
modules that contain the per-language module dependencies needed to support the individual rules used by the maingoogleapis
module. This allows BCR modules to declare dependencies on language-specific rules ingoogleapis
without requiring that module to depend on every possible language ruleset, which isn't sustainable.This results in a breaking change for root modules that previously used the
switched_rules
extensions. These modules now need to explicitly declare deps on thegoogleapis-*
flavors they need, but will be guided through the process by error messages.In the future, new flavors can be added in a backwards compatible way.