Use label not name to deduplicate in graphless genquery.
RELNOTES: None
PiperOrigin-RevId: 278385572
diff --git a/src/main/java/com/google/devtools/build/lib/rules/genquery/GenQuery.java b/src/main/java/com/google/devtools/build/lib/rules/genquery/GenQuery.java
index b49c9ee..c4ad950 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/genquery/GenQuery.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/genquery/GenQuery.java
@@ -395,7 +395,7 @@
Set<Target> result = targets.getResult();
if (graphlessQuery) {
Comparator<Target> comparator =
- (Target t1, Target t2) -> t1.getName().compareTo(t2.getName());
+ (Target t1, Target t2) -> t1.getLabel().compareTo(t2.getLabel());
result = ImmutableSortedSet.copyOf(comparator, targets.getResult());
}
QueryOutputUtils.output(