Skip to content

Commit

Permalink
Add debugging info when test target is unexpectedly an alias.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 385581436
  • Loading branch information
janakdr authored and copybara-github committed Jul 19, 2021
1 parent 463b758 commit 9f4f674
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.
package com.google.devtools.build.lib.rules;

import com.google.common.base.MoreObjects;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableCollection;
import com.google.common.collect.ImmutableMap;
Expand Down Expand Up @@ -173,4 +174,15 @@ public Label getOriginalLabel() {
public void repr(Printer printer) {
printer.append("<alias target " + label + " of " + actual.getLabel() + ">");
}

@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("label", label)
.add("configurationKey", configurationKey)
.add("actual", actual)
.add("overrides", overrides)
.add("configConditions", configConditions)
.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ public DetailedExitCode differentialAnalyzeAndReport(
}

private static ConfiguredTargetKey asKey(ConfiguredTarget target) {
Preconditions.checkArgument(!AliasProvider.isAlias(target));
Preconditions.checkArgument(!AliasProvider.isAlias(target), "Target %s is alias", target);
return ConfiguredTargetKey.builder()
.setLabel(AliasProvider.getDependencyLabel(target))
.setConfigurationKey(target.getConfigurationKey())
Expand Down

0 comments on commit 9f4f674

Please sign in to comment.