diff --git a/aspect/intellij_info_impl.bzl b/aspect/intellij_info_impl.bzl index 2192d7fd4e2..123fe8a7820 100644 --- a/aspect/intellij_info_impl.bzl +++ b/aspect/intellij_info_impl.bzl @@ -233,11 +233,22 @@ def _is_language_specific_proto_library(ctx, target): return True return False +def _stringify_label(label): + s = str(label) + + # If the label is in the main repo, make sure any leading '@'s are stripped so that tests are + # okay with the fixture setups. + if s.startswith("@@//"): + return s[2:] + if s.startswith("@//"): + return s[1:] + return s + def make_target_key(label, aspect_ids): """Returns a TargetKey proto struct from a target.""" return struct_omit_none( aspect_ids = tuple(aspect_ids) if aspect_ids else None, - label = str(label), + label = _stringify_label(label), ) def make_dep(dep, dependency_type): @@ -255,7 +266,7 @@ def make_dep_from_label(label, dependency_type): """Returns a Dependency proto struct from a label.""" return struct( dependency_type = dependency_type, - target = struct(label = str(label)), + target = struct(label = _stringify_label(label)), ) def update_sync_output_groups(groups_dict, key, new_set):