aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/RedirectChaser.java34
1 files changed, 5 insertions, 29 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/RedirectChaser.java b/src/main/java/com/google/devtools/build/lib/analysis/RedirectChaser.java
index 6a27b5c2a1..22c1fbc842 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/RedirectChaser.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/RedirectChaser.java
@@ -24,13 +24,11 @@ import com.google.devtools.build.lib.packages.Rule;
import com.google.devtools.build.lib.packages.Target;
import com.google.devtools.build.lib.syntax.Type;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
import javax.annotation.Nullable;
/**
- * Tool for chasing filegroup redirects. This is mainly intended to be used during
- * BuildConfiguration creation.
+ * Tool for chasing redirects. This is intended to be used during configuration creation.
*/
public final class RedirectChaser {
@@ -61,7 +59,7 @@ public final class RedirectChaser {
/**
* Follows the 'srcs' attribute of the given label recursively. Keeps repeating as long as the
- * labels are filegroups with a single srcs entry.
+ * labels are either <code>alias</code> or <code>bind</code> rules.
*
* @param env for loading the packages
* @param label the label to start at
@@ -81,10 +79,7 @@ public final class RedirectChaser {
if (possibleRedirect == null) {
return null;
}
- Label newLabel = getFilegroupRedirect(possibleRedirect);
- if (newLabel == null) {
- newLabel = getBindOrAliasRedirect(possibleRedirect);
- }
+ Label newLabel = getBindOrAliasRedirect(possibleRedirect);
if (newLabel == null) {
return label;
}
@@ -93,8 +88,8 @@ public final class RedirectChaser {
oldLabel = label;
label = newLabel;
if (!visitedLabels.add(label)) {
- throw new InvalidConfigurationException("The " + name + " points to a filegroup which "
- + "recursively includes itself. The label " + label + " is part of the loop");
+ throw new InvalidConfigurationException("The " + name + " points to a rule which "
+ + "recursively references itself. The label " + label + " is part of the loop");
}
}
} catch (NoSuchThingException e) {
@@ -105,25 +100,6 @@ public final class RedirectChaser {
}
}
- private static Label getFilegroupRedirect(Target target) throws InvalidConfigurationException {
- if (!(target instanceof Rule)) {
- return null;
- }
-
- Rule rule = (Rule) target;
- if (!rule.getRuleClass().equals("filegroup")) {
- return null;
- }
-
- List<Label> labels =
- new StaticValuedAttributeMapper(rule).getAndValidate("srcs", BuildType.LABEL_LIST);
- if (labels.size() != 1) {
- return null;
- }
-
- return labels.get(0);
- }
-
private static Label getBindOrAliasRedirect(Target target)
throws InvalidConfigurationException {
if (!(target instanceof Rule)) {