Skip to content

same module_extension name in different bzl files could not be resolved while using bzlmod in bazel 6.3.1 #19155

@xiemotongye

Description

@xiemotongye

Description of the bug:

We're using bzlmod.
This is a part of MODULE.bazel, which works fine in bazel 6.2.1.

a_ext = use_extension("//path/to/A:A.bzl", "my_ext")
use_repo(a_ext, "abc")
b_ext = use_extension("//path/to/B:B.bzl", "my_ext")
use_repo(b_ext, "xyz")

When I updated bazel to 6.3.1, there was an error in analysis phase.

ERROR: /my/workspace/library_path/BUILD:4:13: no such package '@_main~my_ext~2~xyz//':
The repository '@_main~my_ext~2~xyz' could not be resolved:
Repository '@_main~my_ext~2~xyz' is not defined and referenced by '//library_path:library_name'
ERROR: Analysis of target '//my_path:my_target' failed; build aborted:

It seems that in bazel 6.2.1, if there is a same module_extension name in different bzl files, the second one will be named as @_main~my_ext2~xyz in external directory. But in bazel 6.3.1, it seems that bazel is tring to find a module named as @_main~my_ext~2~xyz (adds a ~ after ext) which doesn't actually exist.

Which category does this issue belong to?

No response

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

No response

Which operating system are you running Bazel on?

macOS 13.4.1

What is the output of bazel info release?

release 6.3.1

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

Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.

No response

Have you found anything relevant by searching the web?

No

Any other information, logs, or outputs that you want to share?

No response

Metadata

Metadata

Assignees

Labels

P1I'll work on this now. (Assignee required)area-BzlmodBzlmod-specific PRs, issues, and feature requeststeam-ExternalDepsExternal dependency handling, remote repositiories, WORKSPACE file.type: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions