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 deleted file mode 100644 index 22c1fbc842b153..00000000000000 --- a/src/main/java/com/google/devtools/build/lib/analysis/RedirectChaser.java +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright 2014 The Bazel Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package com.google.devtools.build.lib.analysis; - -import com.google.devtools.build.lib.analysis.config.ConfigurationEnvironment; -import com.google.devtools.build.lib.analysis.config.InvalidConfigurationException; -import com.google.devtools.build.lib.cmdline.Label; -import com.google.devtools.build.lib.packages.AbstractAttributeMapper; -import com.google.devtools.build.lib.packages.BuildType; -import com.google.devtools.build.lib.packages.NoSuchThingException; -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.Set; -import javax.annotation.Nullable; - -/** - * Tool for chasing redirects. This is intended to be used during configuration creation. - */ -public final class RedirectChaser { - - /** - * Custom attribute mapper that throws an exception if an attribute's value depends on the - * build configuration. - */ - private static class StaticValuedAttributeMapper extends AbstractAttributeMapper { - public StaticValuedAttributeMapper(Rule rule) { - super(rule.getPackage(), rule.getRuleClassObject(), rule.getLabel(), - rule.getAttributeContainer()); - } - - /** - * Returns the value of the given attribute. - * - * @throws InvalidConfigurationException if the value is configuration-dependent - */ - public T getAndValidate(String attributeName, Type type) - throws InvalidConfigurationException { - if (getSelectorList(attributeName, type) != null) { - throw new InvalidConfigurationException - ("The value of '" + attributeName + "' cannot be configuration-dependent"); - } - return super.get(attributeName, type); - } - } - - /** - * Follows the 'srcs' attribute of the given label recursively. Keeps repeating as long as the - * labels are either alias or bind rules. - * - * @param env for loading the packages - * @param label the label to start at - * @param name user-meaningful description of the content being resolved - * @return the label which cannot be further resolved - * @throws InvalidConfigurationException if something goes wrong - */ - @Nullable - public static Label followRedirects(ConfigurationEnvironment env, Label label, String name) - throws InvalidConfigurationException, InterruptedException { - Label oldLabel = null; - Set