• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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()
16