Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion crate_universe/extensions.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,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, [])
}

Expand Down Expand Up @@ -1427,6 +1427,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`.",
),
Expand Down
7 changes: 7 additions & 0 deletions examples/crate_universe/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,13 @@ no_cargo.spec(
repositories = ["no_cargo"],
version = "0.4",
)
no_cargo.spec(
features = ["util"],
package = "tower",
package_alias = "tower_new", # used in package_alias test
repositories = ["no_cargo"],
version = "0.5.3",
)
no_cargo.spec(
features = ["trace"],
package = "tower-http",
Expand Down
4 changes: 4 additions & 0 deletions examples/crate_universe/package_alias/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
alias(
name = "tower-new",
actual = "@no_cargo//:tower_new", # ensures the package_alias works
)