Description of the bug:
It's possible to construct a cyclic dependency between bzlmod module extensions that goes undetected by Bazel but instead causes tags defined in MODULE.bazel to be ignored.
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Check out https://github.com/aherrmann/repro-bzlmod-module-extension-cycle (66f4ab2 at the time of writing) and follow the steps in the README.
In that example module_a defines two extensions extension_1 and extension_2 in separate files extension_1.bzl and extension_2.bzl. The file implementing extension_2 loads a file that is generated by a repository rule that extension_1 invokes. Things work well so long as each extension is loaded (use_extension) from its dedicated file.
However, module_a includes extensions.bzl which re-exports both extensions. Trying to use this file to load the extensions from module_a yields an error message about cyclic dependencies as expected. However, loading this file from module_b raises no such error and instead causes the tags of extension_1 defined in module_b to be ignored.
Which operating system are you running Bazel on?
Ubuntu 22.04
What is the output of bazel info release?
release 6.0.0
If bazel info release returns development 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 master; 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?
Related to the more general question of whether module extensions can depend on files generated by other module extensions.
Description of the bug:
It's possible to construct a cyclic dependency between bzlmod module extensions that goes undetected by Bazel but instead causes tags defined in
MODULE.bazelto be ignored.What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Check out https://github.com/aherrmann/repro-bzlmod-module-extension-cycle (66f4ab2 at the time of writing) and follow the steps in the README.
In that example
module_adefines two extensionsextension_1andextension_2in separate filesextension_1.bzlandextension_2.bzl. The file implementingextension_2loads a file that is generated by a repository rule thatextension_1invokes. Things work well so long as each extension is loaded (use_extension) from its dedicated file.However,
module_aincludesextensions.bzlwhich re-exports both extensions. Trying to use this file to load the extensions frommodule_ayields an error message about cyclic dependencies as expected. However, loading this file frommodule_braises no such error and instead causes the tags ofextension_1defined inmodule_bto be ignored.Which operating system are you running Bazel on?
Ubuntu 22.04
What is the output of
bazel info release?release 6.0.0
If
bazel info releasereturnsdevelopment versionor(@non-git), tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse master; 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?
Related to the more general question of whether module extensions can depend on files generated by other module extensions.