Skip to content

Commit

Permalink
Narrow InconsistentAspectOrderException dependencies.
Browse files Browse the repository at this point in the history
Depend on Label and Locaton instead of Target which won't be available in
distributed contexts.

PiperOrigin-RevId: 496474302
Change-Id: I9dd737fb040be321c2946db72dc38c8b6c70c24b
  • Loading branch information
aoeui authored and copybara-github committed Dec 19, 2022
1 parent d2c85db commit 8017ce6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/google/devtools/build/lib/analysis/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ java_library(
srcs = ["InconsistentAspectOrderException.java"],
deps = [
":aspect_collection",
"//src/main/java/com/google/devtools/build/lib/packages",
"//src/main/java/com/google/devtools/build/lib/cmdline",
"//src/main/java/net/starlark/java/syntax",
],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ private static AspectCollection computeAspectCollections(
try {
return AspectCollection.create(filteredAspectPath);
} catch (AspectCycleOnPathException e) {
throw new InconsistentAspectOrderException(toTarget, e);
throw new InconsistentAspectOrderException(toTarget.getLabel(), toTarget.getLocation(), e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
package com.google.devtools.build.lib.analysis;

import com.google.devtools.build.lib.analysis.AspectCollection.AspectCycleOnPathException;
import com.google.devtools.build.lib.packages.Target;
import com.google.devtools.build.lib.cmdline.Label;
import net.starlark.java.syntax.Location;

/**
Expand All @@ -26,9 +26,10 @@
public class InconsistentAspectOrderException extends Exception {
private final Location location;

public InconsistentAspectOrderException(Target target, AspectCycleOnPathException e) {
super(String.format("%s (when propagating to %s)", e.getMessage(), target.getLabel()));
this.location = target.getLocation();
public InconsistentAspectOrderException(
Label targetLabel, Location location, AspectCycleOnPathException e) {
super(String.format("%s (when propagating to %s)", e.getMessage(), targetLabel));
this.location = location;
}

public Location getLocation() {
Expand Down

0 comments on commit 8017ce6

Please sign in to comment.