From 547f6a0666024c4b14b794598ecac3ce56a5e950 Mon Sep 17 00:00:00 2001 From: Cameron Martin Date: Sun, 18 Feb 2024 20:49:48 +0000 Subject: [PATCH] Use non-canonical repo name in hub repo (#2491) #2461 changed the rendering of the hub repo to use canonical repository names, but incorrectly. Doing so wasn't necessary - instead we just need to do the resolution of the non-canonical label from the perspective of the hub repo rather than the consumer by using the `Label` constructor. Fixes #2483 --- crate_universe/extension.bzl | 1 - .../src/rendering/templates/partials/module/deps_map.j2 | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/crate_universe/extension.bzl b/crate_universe/extension.bzl index 9117f6c432..8e6b816290 100644 --- a/crate_universe/extension.bzl +++ b/crate_universe/extension.bzl @@ -46,7 +46,6 @@ def _generate_hub_and_spokes(module_ctx, cargo_bazel, cfg, annotations): rendering_config = json.decode(render_config( regen_command = "Run 'cargo update [--workspace]'", - crate_label_template = "@@rules_rust~override~crate~{repository}__{name}-{version}//:{target}", )) config_file = tag_path.get_child("config.json") module_ctx.file( diff --git a/crate_universe/src/rendering/templates/partials/module/deps_map.j2 b/crate_universe/src/rendering/templates/partials/module/deps_map.j2 index c9f169df3e..fe8175dbfe 100644 --- a/crate_universe/src/rendering/templates/partials/module/deps_map.j2 +++ b/crate_universe/src/rendering/templates/partials/module/deps_map.j2 @@ -30,7 +30,7 @@ {%- for dep in deps_set.common %} {%- if dep.id in context.workspace_members %}{% continue %}}{% endif %}{# Workspace member repositories are not defined, skip adding their labels here #} {%- set crate = context.crates | get(key=dep.id) %} - "{{ dep | get(key="alias", default=crate.name) }}": "{{ crate_label(name = crate.name, version = crate.version, target = dep.target) }}", + "{{ dep | get(key="alias", default=crate.name) }}": Label("{{ crate_label(name = crate.name, version = crate.version, target = dep.target) }}"), {%- endfor %} }, {%- endif %}