From 1a759077b44f160c1a299babf8a0105fd1372bd4 Mon Sep 17 00:00:00 2001 From: Michajlo Matijkiw Date: Thu, 22 Oct 2015 13:52:00 +0000 Subject: Remove ast from Rule It's always null -- MOS_MIGRATED_REVID=106053287 --- .../com/google/devtools/build/lib/packages/Package.java | 12 +++++------- .../devtools/build/lib/packages/PackageDeserializer.java | 6 +++--- .../java/com/google/devtools/build/lib/packages/Rule.java | 15 +-------------- .../com/google/devtools/build/lib/packages/RuleClass.java | 2 +- 4 files changed, 10 insertions(+), 25 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/com/google/devtools/build/lib/packages/Package.java b/src/main/java/com/google/devtools/build/lib/packages/Package.java index 94df8eae6c..579e0604d8 100644 --- a/src/main/java/com/google/devtools/build/lib/packages/Package.java +++ b/src/main/java/com/google/devtools/build/lib/packages/Package.java @@ -35,7 +35,6 @@ import com.google.devtools.build.lib.events.Location; import com.google.devtools.build.lib.packages.AttributeMap.AcceptsLabelAttribute; import com.google.devtools.build.lib.packages.License.DistributionType; import com.google.devtools.build.lib.packages.PackageFactory.Globber; -import com.google.devtools.build.lib.syntax.FuncallExpression; import com.google.devtools.build.lib.util.Pair; import com.google.devtools.build.lib.vfs.Canonicalizer; import com.google.devtools.build.lib.vfs.Path; @@ -1002,15 +1001,14 @@ public class Package { *

Useful for RuleClass instantiation, where the rule name is checked by trying to create a * Label. This label can then be used again here. */ - Rule newRuleWithLabel(Label label, RuleClass ruleClass, FuncallExpression ast, - Location location) { - return newRuleWithLabelAndAttrContainer(label, ruleClass, ast, location, + Rule newRuleWithLabel(Label label, RuleClass ruleClass, Location location) { + return newRuleWithLabelAndAttrContainer(label, ruleClass, location, new AttributeContainer(ruleClass)); } - Rule newRuleWithLabelAndAttrContainer(Label label, RuleClass ruleClass, FuncallExpression ast, - Location location, AttributeContainer attributeContainer) { - return new Rule(pkg, label, ruleClass, ast, location, attributeContainer); + Rule newRuleWithLabelAndAttrContainer(Label label, RuleClass ruleClass, Location location, + AttributeContainer attributeContainer) { + return new Rule(pkg, label, ruleClass, location, attributeContainer); } /** diff --git a/src/main/java/com/google/devtools/build/lib/packages/PackageDeserializer.java b/src/main/java/com/google/devtools/build/lib/packages/PackageDeserializer.java index 4a4ae10993..302240f74d 100644 --- a/src/main/java/com/google/devtools/build/lib/packages/PackageDeserializer.java +++ b/src/main/java/com/google/devtools/build/lib/packages/PackageDeserializer.java @@ -369,7 +369,7 @@ public class PackageDeserializer { * Deserialize a package from its representation as a protocol message. The inverse of * {@link PackageSerializer#serialize}. * @throws IOException - * @throws InterruptedException + * @throws InterruptedException */ private void deserializeInternal(Build.Package packagePb, StoredEventHandler eventHandler, Package.Builder builder, InputStream in) @@ -472,7 +472,7 @@ public class PackageDeserializer { * @return a new {@link Package} as read from {@code in} * @throws PackageDeserializationException on failures deserializing the input * @throws IOException on failures reading from {@code in} - * @throws InterruptedException + * @throws InterruptedException */ public Package deserialize(InputStream in) throws PackageDeserializationException, IOException, InterruptedException { @@ -719,7 +719,7 @@ public class PackageDeserializer { Map attributeValues, EventHandler eventHandler, AttributeContainer attributeContainer) throws LabelSyntaxException, InterruptedException { - Rule rule = pkgBuilder.newRuleWithLabelAndAttrContainer(label, ruleClass, null, ruleLocation, + Rule rule = pkgBuilder.newRuleWithLabelAndAttrContainer(label, ruleClass, ruleLocation, attributeContainer); rule.checkValidityPredicate(eventHandler); 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 1cc5f63c03..df1cb5e9b5 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 @@ -35,7 +35,6 @@ import com.google.devtools.build.lib.events.Location; import com.google.devtools.build.lib.packages.Attribute.ConfigurationTransition; import com.google.devtools.build.lib.packages.License.DistributionType; import com.google.devtools.build.lib.syntax.EvalException; -import com.google.devtools.build.lib.syntax.FuncallExpression; import com.google.devtools.build.lib.syntax.GlobList; import com.google.devtools.build.lib.syntax.Type; import com.google.devtools.build.lib.util.BinaryPredicate; @@ -149,15 +148,13 @@ public final class Rule implements Target { private final Location location; - private final FuncallExpression ast; // may be null - private final String workspaceName; // Initialized in the call to populateOutputFiles. private List outputFiles; private ListMultimap outputFileMap; - Rule(Package pkg, Label label, RuleClass ruleClass, FuncallExpression ast, Location location, + Rule(Package pkg, Label label, RuleClass ruleClass, Location location, AttributeContainer attributeContainer) { this.pkg = Preconditions.checkNotNull(pkg); this.label = label; @@ -166,7 +163,6 @@ public final class Rule implements Target { this.attributes = attributeContainer; this.attributeMap = new RawAttributeMapper(pkg, ruleClass, label, attributes); this.containsErrors = false; - this.ast = ast; this.workspaceName = pkg.getWorkspaceName(); } @@ -247,15 +243,6 @@ public final class Rule implements Target { : ruleClass.hasBinaryOutput(); } - /** - * Returns the AST for this rule. Returns null if the package factory chose - * not to retain the AST when evaluateBuildFile was called for this rule's - * package. - */ - public FuncallExpression getSyntaxTree() { - return ast; - } - /** * Returns true iff there were errors while constructing this rule, such as * attributes with missing values or values of the wrong type. diff --git a/src/main/java/com/google/devtools/build/lib/packages/RuleClass.java b/src/main/java/com/google/devtools/build/lib/packages/RuleClass.java index 797aeb94d5..aaa0c7d422 100644 --- a/src/main/java/com/google/devtools/build/lib/packages/RuleClass.java +++ b/src/main/java/com/google/devtools/build/lib/packages/RuleClass.java @@ -1230,7 +1230,7 @@ public final class RuleClass { Rule createRuleWithLabel(Package.Builder pkgBuilder, Label ruleLabel, Map attributeValues, EventHandler eventHandler, FuncallExpression ast, Location location) throws LabelSyntaxException, InterruptedException { - Rule rule = pkgBuilder.newRuleWithLabel(ruleLabel, this, null, location); + Rule rule = pkgBuilder.newRuleWithLabel(ruleLabel, this, location); createRuleCommon(rule, pkgBuilder, attributeValues, eventHandler, ast); return rule; } -- cgit v1.2.3