Skip to content

Undetected cyclic dependency between module extensions #17564

@aherrmann

Description

@aherrmann

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-BzlmodBzlmod-specific PRs, issues, and feature requeststeam-ExternalDepsExternal dependency handling, remote repositiories, WORKSPACE file.type: buguntriaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions