Skip to content

Commit

Permalink
Fix treatment of absolute labels
Browse files Browse the repository at this point in the history
  • Loading branch information
guw committed Dec 11, 2024
1 parent 23c2a28 commit 794f5f5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,12 @@ private Entry toJavaSourceFileOrLabelEntry(String srcFileOrLabel) throws CoreExc

// treat as label if it looks like one
if (shouldTreatAsLabel(srcFileOrLabel)) {
// handle absolute labels first
var mayBeAbsoluteLaybel = Label.createIfValid(srcFileOrLabel);
if (mayBeAbsoluteLaybel != null) {
return new LabelEntry(new BazelLabel(mayBeAbsoluteLaybel.toString()));
}
// treat as relative label
return new LabelEntry(bazelPackage.getBazelTarget(srcFileOrLabel).getLabel());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,9 +476,8 @@ public Label toPrimitive() {
getExternalRepositoryName(),
new WorkspacePath(getPackagePath()),
TargetName.create(getTargetName()));
} else {
return Label.create(new WorkspacePath(getPackagePath()), TargetName.create(getTargetName()));
}
return Label.create(new WorkspacePath(getPackagePath()), TargetName.create(getTargetName()));
}

return Label.create(fullLabel);
Expand All @@ -488,4 +487,5 @@ public Label toPrimitive() {
public String toString() {
return fullLabel;
}

}

0 comments on commit 794f5f5

Please sign in to comment.