From 2fe4ea745b09b86b8388d5f3102ec83590199cdc Mon Sep 17 00:00:00 2001 From: Nicolas Mattia Date: Tue, 25 Nov 2025 16:49:21 +0100 Subject: [PATCH] Add support for package_alias in crate.spec (bzlmod) This makes using different versions of the same crate easier. --- crate_universe/extensions.bzl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crate_universe/extensions.bzl b/crate_universe/extensions.bzl index da2830f085..eeb3973fa1 100644 --- a/crate_universe/extensions.bzl +++ b/crate_universe/extensions.bzl @@ -1153,7 +1153,7 @@ def _crate_impl(module_ctx): manifests = {str(module_ctx.path(m)): str(m) for m in cfg.manifests} packages = { - p.package: _package_to_json(p) + p.package_alias or p.package: _package_to_json(p) for p in common_specs + repo_specific_specs.get(cfg.name, []) } @@ -1409,6 +1409,9 @@ _spec = tag_class( doc = "The explicit name of the package.", mandatory = True, ), + "package_alias": attr.string( + doc = "Alias for the package.", + ), "path": attr.string( doc = "The local path of the remote crate. Cannot be used with `version` or `git`.", ),