-
Notifications
You must be signed in to change notification settings - Fork 8
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
bzlmod users should get a default toolchain registration #22
Comments
I've tried adding the default toolchain by adding the following to MODULE.bazel ruby = use_extension("@rules_ruby//ruby:extensions.bzl", "ruby")
ruby.toolchain(
name = "ruby",
version = "jruby-9.4.5.0",
)
use_repo(ruby, "ruby", "ruby_toolchains")
register_toolchains("@ruby_toolchains//:all") However, this fails as now there are multiple toolchains called ruby:
How multiple toolchain registrations should actually work? Is there any good example of this? |
That error is our own, in extensions.bzl doing logic that looks at the global view of all calls to the extension and decide what to do. I think it's just a logic bug that we should figure out how to disambiguate this case. @kormide has been doing these fixes in our other rules lately and probably has some details easily recalled. |
You can follow what we do with toolchain registration in bazel-lib: https://github.com/aspect-build/bazel-lib/blob/main/lib/extensions.bzl#L110. We use this private toolchain_repos_bfs utility to do the work. |
@kormide Thank you for sharing, but the code in is quite similar to what ruby_rules already do and produce the same error. How would a user define a custom toolchain with a custom |
We write the toolchain module extension so that whatever version is specified in the root module overrides versions from other invocations in the dependency graph, as long as the repo "name" is the same. |
There's a TODO introduced, see thread:
#17 (comment)
The text was updated successfully, but these errors were encountered: