aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/packages/Rule.java
diff options
context:
space:
mode:
authorGravatar Janak Ramakrishnan <janakr@google.com>2016-08-15 21:54:55 +0000
committerGravatar Philipp Wollermann <philwo@google.com>2016-08-16 15:21:17 +0000
commit3c0adb26bac6d756fb97e4bcc6d4e5b2cefa5eeb (patch)
treec77f6438711f4b23d6c528907a81e23dc9e6dc91 /src/main/java/com/google/devtools/build/lib/packages/Rule.java
parent89125d5ee83f562c309a792a7c56ce24452e61ea (diff)
Allow Skyframe graph lookups and value retrievals to throw InterruptedException.
The only place we now don't handle InterruptedException is in the action graph created after analysis, since I'm not sure that will be around for that much longer. -- MOS_MIGRATED_REVID=130327770
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/packages/Rule.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/packages/Rule.java37
1 files changed, 18 insertions, 19 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/packages/Rule.java b/src/main/java/com/google/devtools/build/lib/packages/Rule.java
index dd5df33055..29af9a54c9 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/Rule.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/Rule.java
@@ -398,10 +398,8 @@ public final class Rule implements Target, DependencyFilter.AttributeInfoProvide
return false;
}
- /**
- * Returns a new List instance containing all direct dependencies (all types).
- */
- public Collection<Label> getLabels() {
+ /** Returns a new List instance containing all direct dependencies (all types). */
+ public Collection<Label> getLabels() throws InterruptedException {
final List<Label> labels = Lists.newArrayList();
AggregatingAttributeMapper.of(this).visitLabels(new AttributeMap.AcceptsLabelAttribute() {
@Override
@@ -413,29 +411,30 @@ public final class Rule implements Target, DependencyFilter.AttributeInfoProvide
}
/**
- * Returns a new Collection containing all Labels that match a given Predicate,
- * not including outputs.
+ * Returns a new Collection containing all Labels that match a given Predicate, not including
+ * outputs.
*
- * @param predicate A binary predicate that determines if a label should be
- * included in the result. The predicate is evaluated with this rule and
- * the attribute that contains the label. The label will be contained in the
- * result iff (the predicate returned {@code true} and the labels are not outputs)
+ * @param predicate A binary predicate that determines if a label should be included in the
+ * result. The predicate is evaluated with this rule and the attribute that contains the
+ * label. The label will be contained in the result iff (the predicate returned {@code true}
+ * and the labels are not outputs)
*/
- public Collection<Label> getLabels(BinaryPredicate<? super Rule, Attribute> predicate) {
+ public Collection<Label> getLabels(BinaryPredicate<? super Rule, Attribute> predicate)
+ throws InterruptedException {
return ImmutableSortedSet.copyOf(getTransitions(predicate).values());
}
/**
- * Returns a new Multimap containing all attributes that match a given Predicate and
- * corresponding labels, not including outputs.
+ * Returns a new Multimap containing all attributes that match a given Predicate and corresponding
+ * labels, not including outputs.
*
- * @param predicate A binary predicate that determines if a label should be
- * included in the result. The predicate is evaluated with this rule and
- * the attribute that contains the label. The label will be contained in the
- * result iff (the predicate returned {@code true} and the labels are not outputs)
+ * @param predicate A binary predicate that determines if a label should be included in the
+ * result. The predicate is evaluated with this rule and the attribute that contains the
+ * label. The label will be contained in the result iff (the predicate returned {@code true}
+ * and the labels are not outputs)
*/
public Multimap<Attribute, Label> getTransitions(
- final BinaryPredicate<? super Rule, Attribute> predicate) {
+ final BinaryPredicate<? super Rule, Attribute> predicate) throws InterruptedException {
final Multimap<Attribute, Label> transitions = HashMultimap.create();
// TODO(bazel-team): move this to AttributeMap, too. Just like visitLabels, which labels should
// be visited may depend on the calling context. We shouldn't implicitly decide this for
@@ -651,7 +650,7 @@ public final class Rule implements Target, DependencyFilter.AttributeInfoProvide
// null-valued, with a packageFragment that is null...). The bug that prompted
// the introduction of this code is #2210848 (NullPointerException in
// Package.checkForConflicts() ).
- void checkForNullLabels() {
+ void checkForNullLabels() throws InterruptedException {
AggregatingAttributeMapper.of(this).visitLabels(
new AttributeMap.AcceptsLabelAttribute() {
@Override