Add additional modules to module_ctx #22070
Labels
area-Bzlmod
Bzlmod-specific PRs, issues, and feature requests
good first issue
help wanted
Someone outside the Bazel team could own this
P2
We'll consider working on this in future. (Assignee optional)
team-ExternalDeps
External dependency handling, remote repositiories, WORKSPACE file.
type: feature request
Description of the feature request:
I'd like additional properties on module_ctx.
module_ctx.root_module
would be anOptional[bazel_module]
that would be equivalent to the output of the_find_root
function belowmodule_ctx.current_module
would be abazel_module
object corresponding to the module that defined the current module extension (it could possibly be aOptional[bazel_module]
.A classic piece of code being written is:
This would significantly simplify the recommended workflow we prescribe in #22024 (eg. bazelbuild/rules_rust#2624)
Which category does this issue belong to?
Core, External Dependency
What underlying problem are you trying to solve with this feature?
Our discussion about the right way to implement toolchains in bazel came to the following conclusion:
The policy would be, for a given toolchain defined by rules_foo which has the tag
foo.toolchain
:foo.toolchain
tagrules_foo
'sfoo.toolchain
rules_foo
'sfoo.toolchain
rules_foo
rules_foo
may choose to compare the root MODULE'sfoo.toolchain
with MVS(all modules'foo.toolchain
) in order to output warningsfoo.toolchain
invocations)rules_foo
'sfoo.toolchain
foo.toolchain
This will require special-casing of the root module and the current module extension, both of which seems like something pretty reasonable to me.
Which operating system are you running Bazel on?
linux
What is the output of
bazel info release
?7.1.1
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse HEAD
?No response
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
No response
The text was updated successfully, but these errors were encountered: