diff options
author | Klaus Aehlig <aehlig@google.com> | 2016-10-25 14:51:55 +0000 |
---|---|---|
committer | John Cater <jcater@google.com> | 2016-10-25 20:19:07 +0000 |
commit | d1f4a167f8080d460dd532eb83b87ab0d0eb4f86 (patch) | |
tree | 38c10b81b925807207ae2311c99b4ae241394a0e /src/main/java/com/google/devtools/build/lib/analysis/AspectCompleteEvent.java | |
parent | b96a0952c9a05d3a0b56b54eb0b841c455929261 (diff) |
Add a new concept of failure causes
Not all possible reasons for failure are uniquely identified
by a label. Therefore, add a new data type describing possible
root causes of failures and use it.
The new type is added in causes/*.java and coresponds to Haskell's
one-line definition
data Cause = LabelCause Label | ActionCause Path Label deriving Show
With future clean up of other failure causes inadequately described
by a label, we expect that type to be extended by new constructors
(i.e., new classes implementing Cause).
--
Change-Id: I6fec74c78cec6abb9c10e32743b05a792888fead
Reviewed-on: https://bazel-review.googlesource.com/#/c/6617
MOS_MIGRATED_REVID=137156390
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/analysis/AspectCompleteEvent.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/analysis/AspectCompleteEvent.java | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/AspectCompleteEvent.java b/src/main/java/com/google/devtools/build/lib/analysis/AspectCompleteEvent.java index 661449e16e..763a29454e 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/AspectCompleteEvent.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/AspectCompleteEvent.java @@ -14,7 +14,7 @@ package com.google.devtools.build.lib.analysis; import com.google.common.collect.Iterables; -import com.google.devtools.build.lib.cmdline.Label; +import com.google.devtools.build.lib.causes.Cause; import com.google.devtools.build.lib.collect.nestedset.NestedSet; import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder; import com.google.devtools.build.lib.collect.nestedset.Order; @@ -27,12 +27,12 @@ import com.google.devtools.build.skyframe.SkyValue; */ public class AspectCompleteEvent implements SkyValue { private final AspectValue aspectValue; - private final NestedSet<Label> rootCauses; + private final NestedSet<Cause> rootCauses; - private AspectCompleteEvent(AspectValue aspectValue, NestedSet<Label> rootCauses) { + private AspectCompleteEvent(AspectValue aspectValue, NestedSet<Cause> rootCauses) { this.aspectValue = aspectValue; this.rootCauses = - (rootCauses == null) ? NestedSetBuilder.<Label>emptySet(Order.STABLE_ORDER) : rootCauses; + (rootCauses == null) ? NestedSetBuilder.<Cause>emptySet(Order.STABLE_ORDER) : rootCauses; } /** @@ -45,7 +45,7 @@ public class AspectCompleteEvent implements SkyValue { /** * Construct a target completion event for a failed target, with the given non-empty root causes. */ - public static AspectCompleteEvent createFailed(AspectValue value, NestedSet<Label> rootCauses) { + public static AspectCompleteEvent createFailed(AspectValue value, NestedSet<Cause> rootCauses) { Preconditions.checkArgument(!Iterables.isEmpty(rootCauses)); return new AspectCompleteEvent(value, rootCauses); } @@ -64,10 +64,8 @@ public class AspectCompleteEvent implements SkyValue { return !rootCauses.isEmpty(); } - /** - * Get the root causes of the target. May be empty. - */ - public Iterable<Label> getRootCauses() { + /** Get the root causes of the target. May be empty. */ + public Iterable<Cause> getRootCauses() { return rootCauses; } } |