-
-
Notifications
You must be signed in to change notification settings - Fork 219
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
Return, don't fail, when extension used by non-root module #305
base: master
Are you sure you want to change the base?
Return, don't fail, when extension used by non-root module #305
Conversation
As per @fmeum's comment in #243, But, from a composability standpoint, doing nothing for non-root modules doesn't seem ideal either though; I see a couple of issues:
For the common use case (using However for modules that use other outputs from The least-worst solution I can come up with that addresses the above is to have re: gating toolchain resolution for non-root modules: I'm not super convinced that we need to do this (my understanding is that toolchains registered by the root module/by modules closer to the root module have precedence in toolchain resolution; |
Yeah, using Based on your analysis, I believe it means that my change shouldn't be needed for simple cases, and doesn't solve the problem for more complex ones. Is that accurate? |
I see two separate threads here:
For 1., I think that we should stick to and recommend Keeping the Dealing with 2. is much more difficult, which is why I would prefer to keep the For tools such as I do lack the knowledge about OpenMP to assess what a good way would be to bring it in. Does it have be kept in sync with compiler versions? |
This fixes the following scenario:
MODULE.bzlmod
filesMODULE.bzlmod
files specify a llvm toolchainbazel_dep
Expected results
Actual results
Error in fail: Only the root module can use the 'llvm' extension
Resolution
Instead of failing, we just
return
. This keeps the behaviour of only being able to actually use thellvm
extension in the root module, but we don't error out.A more complex but similar example is that from
rules_python
where they will still register the toolchain, but it will not be marked as the default toolchain if it is not called from the root module: https://github.com/bazelbuild/rules_python/blob/main/python/private/bzlmod/python.bzl#L102