Skip to content

Commit 5060e25

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

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
@@ -1160,7 +1160,7 @@ def _crate_impl(module_ctx):
11601160
manifests = {str(module_ctx.path(m)): str(m) for m in cfg.manifests}
11611161

11621162
packages = {
1163-
p.package: _package_to_json(p)
1163+
p.package_alias or p.package: _package_to_json(p)
11641164
for p in common_specs + repo_specific_specs.get(cfg.name, [])
11651165
}
11661166

@@ -1427,6 +1427,9 @@ _spec = tag_class(
14271427
doc = "The explicit name of the package.",
14281428
mandatory = True,
14291429
),
1430+
"package_alias": attr.string(
1431+
doc = "Alias for the package.",
1432+
),
14301433
"path": attr.string(
14311434
doc = "The local path of the remote crate. Cannot be used with `version` or `git`.",
14321435
),

0 commit comments

Comments
 (0)