Bzlmod: Support local_path
in Bazel Registry's source.json file
#16319
Labels
area-Bzlmod
Bzlmod-specific PRs, issues, and feature requests
P1
I'll work on this now. (Assignee required)
team-ExternalDeps
External dependency handling, remote repositiories, WORKSPACE file.
type: feature request
Milestone
Currently the
source.json
(e.g. for grpc) file in a Bazel registry only accepts attributes that can be translated to ahttp_archive
repository rule, Bazel then delegates the fetching of the Bazel module to thehttp_archive
rule.But when users try to set up their own Bazel registry, they might want to point a Bazel module to a different path that hosts the source of the Bazel module (instead of an archive). Therefore, it would be useful to support other types of repositories in the source.json file, and an attribute 'type' to differentiate between them.
Supported types:
'archive' : the default value if no type was provided
'local_path'
E.g.
For the second case where
path
is a relative path, we need to decide which path it should be relative to.To solve this we can add a
module_base_path
in thebazel_registry.json
file of the registry.Then we resolve
path
by the following rules:path
is already an absolute path, then just use it.path
is a relative path andmodule_base_path
is an absolute path, thenpath
is resolved to<module_base_path>/<path>
path
andmodule_base_path
are both relative paths, thenpath
is resolved to<registry_path>/<module_base_path>/<path>
.Note that in the 3rd case, we need to parse
registry_path
from the registry URL, which means the registry must be hosted locally and used by--registry=file://<registry_path>
(instead ofhttps://
). Otherwise, Bazel should throw an error.The text was updated successfully, but these errors were encountered: