-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Closed
bazelbuild/bazel-central-registry
#4862Labels
P1I'll work on this now. (Assignee required)I'll work on this now. (Assignee required)team-ExternalDepsExternal dependency handling, remote repositiories, WORKSPACE file.External dependency handling, remote repositiories, WORKSPACE file.type: feature request
Description
Description of the feature request:
For modules representing projects which lack MODULE.bazel files, module maintainers have to carry patch files or overlay/MODULE.bazel
symlinks so http_archive
and friends take care of injecting them into repos. Since the registry already needs to contain MODULE.bazel anyway, this amounts to needless busywork for nearly every module in the BCR. When a module comes from a registry, bazel should fall back to copying or symlinking the MODULE.bazel file it got from the registry if none exists after repository rules finish.
Which category does this issue belong to?
External Dependency
What underlying problem are you trying to solve with this feature?
Needless busywork for most modules' maintainers.
Which operating system are you running Bazel on?
Ubuntu 20.04
What is the output of bazel info release
?
release 7.6.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 HEAD
?
Have you found anything relevant by searching the web?
No response
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)I'll work on this now. (Assignee required)team-ExternalDepsExternal dependency handling, remote repositiories, WORKSPACE file.External dependency handling, remote repositiories, WORKSPACE file.type: feature request
Activity
Wyverald commentedon Jun 18, 2025
It just occurred to me today that this could be implemented fairly simply by just treating the MODULE.bazel file served from the registry as an implicit overlay. That is, whenever we generate a
RepoSpec
for a module usinghttp_archive
(code), always set the MODULE.bazel file from the registry as aremote_file_url
.Of course, this means that we need to add overlay support to
git_repository
to be fully on par -- but that shouldn't be hard.MODULE.bazel
file on the module repo #26332fmeum commentedon Jun 18, 2025
I tried this in #26332, but this fails on modules with patches applied to the module file to please the very check we want to remove.
fmeum commentedon Jun 18, 2025
Looks like we can get around this by swapping the order in which
http_archive
applies patches and overlays - how breaking would you consider that?Wyverald commentedon Jun 18, 2025
hmm, that's a bit annoying. The order of "overlays before patches" is explicitly documented at https://bazel.build/external/registry#source-json, so it would be fairly breaking. Maybe we do need a dedicated
remote_module_file
attribute onhttp_archive
after all. (Can also remove theworkspace_file
andworkspace_file_contents
attributes by now.)Overlay the registry `MODULE.bazel` file on the module repo
Overlay the registry `MODULE.bazel` file on the module repo
MODULE.bazel
file on the module repo #26462[8.4.0] Overlay the registry `MODULE.bazel` file on the module repo (#…