fork/rules_rust

git clone https://git.julia.blue/fork/rules_rust

Cameron MartinUse canonical repo name for aspects (#2450)0f777e19

main
614 B15 linesraw
1"""A helper module for the various targets in the `@rules_rust//tools` package"""
2
3def aspect_repository():
4    """Determines the repository name to use in Bazel commands that use aspects.
5
6    Some tools (`//tools/rustfmt` `//tools/rust_analyzer`) make calls to Bazel
7    and pass the `--aspects` flag. This macro allows those tools to work around
8    the following issue: https://github.com/bazelbuild/bazel/issues/11734
9
10    Returns:
11        str: The string to use for the `--aspects` repository labels
12    """
13    if native.repository_name() == "@":
14        return ""
15    return "@" + native.repository_name()