Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strip leading '@'s for labels in the splicing manifest #1547

Merged
merged 1 commit into from
Sep 9, 2022
Merged
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
11 changes: 10 additions & 1 deletion crate_universe/private/splicing_utils.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@ def compile_splicing_manifest(splicing_config, manifests, cargo_config_path, pac

return dict(splicing_config.items() + splicing_manifest_content.items())

def _no_at_label(label):
"""Strips leading '@'s for stringified labels in the main repository for backwards-comaptibility reasons."""
s = str(label)
if s.startswith("@@//"):
return s[2:]
if s.startswith("@//"):
return s[1:]
return s

def create_splicing_manifest(repository_ctx):
"""Produce a manifest containing required components for splciing a new Cargo workspace

Expand All @@ -77,7 +86,7 @@ def create_splicing_manifest(repository_ctx):
path: The path to a json encoded manifest
"""

manifests = {str(repository_ctx.path(m)): str(m) for m in repository_ctx.attr.manifests}
manifests = {str(repository_ctx.path(m)): _no_at_label(m) for m in repository_ctx.attr.manifests}

if repository_ctx.attr.cargo_config:
cargo_config = str(repository_ctx.path(repository_ctx.attr.cargo_config))
Expand Down