Skip to content

Commit 2fe4ea7

Browse files
committed
Add support for package_alias in crate.spec (bzlmod)
This makes using different versions of the same crate easier.
1 parent c6b9399 commit 2fe4ea7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

crate_universe/extensions.bzl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1153,7 +1153,7 @@ def _crate_impl(module_ctx):
11531153
manifests = {str(module_ctx.path(m)): str(m) for m in cfg.manifests}
11541154

11551155
packages = {
1156-
p.package: _package_to_json(p)
1156+
p.package_alias or p.package: _package_to_json(p)
11571157
for p in common_specs + repo_specific_specs.get(cfg.name, [])
11581158
}
11591159

@@ -1409,6 +1409,9 @@ _spec = tag_class(
14091409
doc = "The explicit name of the package.",
14101410
mandatory = True,
14111411
),
1412+
"package_alias": attr.string(
1413+
doc = "Alias for the package.",
1414+
),
14121415
"path": attr.string(
14131416
doc = "The local path of the remote crate. Cannot be used with `version` or `git`.",
14141417
),

0 commit comments

Comments
 (0)