-
Notifications
You must be signed in to change notification settings - Fork 553
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
Dependency on rules_kotlin (due to protobuf and stardoc) #2498
Comments
To help isolating the issue, here's the output of graph.0.38.0.txt One thing to highlight is that rules_python (0.38.0 -> 0.39.0) means stardoc (0.6.2 -> 0.7.1) and protobuf (24.4 -> 29.0-rc2), which in turn means rules_jvm_external (5.2 -> 6.3), which adds the rules_kotlin@1.9.6 dependency. |
Could you explain why this can be a problem, please? |
This is in the end of the first comment:
In other words, the core issues are the following:
|
This is a good observation. That said, keep in mind we have limited control over this because we can only control our direct dependencies. Similarly, a module can't control over what toolchains are registered by other modules. Stated another way: I suspect this will be an ongoing issue for you because bzlmod makes it easier to register toolchains and take on dependencies. To be clear, IMHO, Bazel is lacking something to better handle this situation -- this isn't the first time I've seen users have to deal with toolchains registered somewhere that they didn't want. Language rule authors are in a catch-22 because, if they don't register something by default, then things don't Just Work. If they do register something by default, then it can easily incur an expensive dependency/operate when users (like yourself) are going through extra steps to explicitly avoid that cost. Another thing to try is move rules_python earlier in your module dependency graph. This will make its toolchain registrations come before e.g. rules_kotlin, which might side-step the issue. Otherwise, patching MODULE files is probably your best alternative. re: non-dev stardoc dependency: As mentioned in internal chat, I, too, would like to remove this as a non-dev dependency. Unfortunately, the code in re: protobuf dependency: As mentioned in internal chat, this dependency can't be removed for the time being. The long term plan is to move py_proto_library out of rules_python, but, last I heard, some work in protobuf is still needed (not sure what). So, unfortunately, not much can be done about this part.
I understand your point, but, well, this came across a bit rude. I'd appreciate a less proscribing tone :). |
Thanks for your explanation. I apologize for the offensive tone. I did not mean to be condescending or authoratative here. Sorry. With trial and error, the following is the best workaround for us. It is written below in case anyone else come across a similar issue.
I am closing this bug now because we (Android kernel team) don't need any changes from rules_python at this moment, but feel free to reopen/refer to this bug if necessary! |
Thank you for the update here. I will create a separate ticket for splitting out the |
🐞 bug report
Affected Rule
Dependency on stardoc & protobuf cause this issue.
Is this a regression?
Yes, the previous version in which this bug was not present was: 0.38.0
Description
Due to stardoc 0.7.x and protobuf 29.0 dependency, rules_kotlin is fetched. Even though there are no targets directly depending on rules_kotlin, I think it is fetched probably because rules_kotlin contains a toolchain declaration.
🔬 Minimal Reproduction
Set up the workspace like the following:
A tarball is also attached for quick repo:
workspace.tar.gz
With Bazel 7.4.0 (see explanation below), run the following:
We can see that rules_kotlin is fetched.
Now open the root MODULE.bazel file and make the following edits, then re-run the aforementioned commands.
dev_dependency = True
, then rules_kotlin is not fetched.🌍 Your Environment
Operating System:
Output of
bazel version
:Note: I intentionally pick 7.4.0 not the latest 8.0.0 because its bazel_tools has lower-version dependencies that won't affect our experiment with protobuf, rules_jvm_external and stardoc. With 8.0.0, Bazel mod version resolution always sets higher version for protobuf and rules_jvm_external, so we can't independently verify that the issue does not happen with rules_python@0.38.0.
Rules_python version:
Anything else relevant?
The core issues here is that rules_python depends on Protobuf and Stardoc, two very big repositories with a lot of dependencies, with PITA reasons.
For Protobuf, ideally py_proto_library should come from rules_proto not rules_python. AFAIK this is #2173.
For Stardoc, this appears to come from 5978390. Usually, Stardoc should be a dev_dependency so that the root module can choose whether it wants Stardoc. But rules_python provides
sphinx_stardoc
which requires a non-dev dependency on Stardoc. I can file a separate bug to track this if it makes more sense.Both have heavy dependencies on Java and Kotlin, not to mention the Maven dependencies that Stardoc has. As the code grows, it is highly possible that Stardoc and Protobuf have even more dependencies in the future, where some may contain toolchains, causing users of rules_python to vendor them to have offline builds. I found it very funny that rules_python has Java dependencies.
Context: Android kernel builds are executed by Google's build servers and partner's build servers that cannot reach the Internet. Therefore, all dependencies must be imported into AOSP with careful reviews. Because the Android kernel build does not contain any Java, Protobuf (yet) or Kotlin code, it is hard for us to justify that rules_kotlin should be imported.
The text was updated successfully, but these errors were encountered: