aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/analysis
diff options
context:
space:
mode:
authorGravatar jcater <jcater@google.com>2017-11-10 01:31:20 +0100
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2017-11-10 23:27:52 +0100
commit3fa2e46f73802412772b0182e1e38e9dbbcda638 (patch)
treed5fd8d171c059e918a2d8fe18e680d781b91d9c7 /src/main/java/com/google/devtools/build/lib/analysis
parent2b1531802f90de3d46aea9b5d331899c1d459765 (diff)
Add getAttributeLocation to AttributeMap and related classes.
PiperOrigin-RevId: 175230893
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/analysis')
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/AspectAwareAttributeMapper.java28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/AspectAwareAttributeMapper.java b/src/main/java/com/google/devtools/build/lib/analysis/AspectAwareAttributeMapper.java
index db7d6f0f3c..c866cbd84b 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/AspectAwareAttributeMapper.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/AspectAwareAttributeMapper.java
@@ -17,23 +17,24 @@ package com.google.devtools.build.lib.analysis;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.devtools.build.lib.cmdline.Label;
+import com.google.devtools.build.lib.events.Location;
import com.google.devtools.build.lib.packages.Attribute;
import com.google.devtools.build.lib.packages.AttributeMap;
import com.google.devtools.build.lib.packages.RuleClass;
import com.google.devtools.build.lib.syntax.Type;
/**
- * An {@link AttributeMap} that supports attribute type queries on both a rule
- * and its aspects and attribute value queries on the rule.
+ * An {@link AttributeMap} that supports attribute type queries on both a rule and its aspects and
+ * attribute value queries on the rule.
*
- * <p>An attribute type query is anything accessible from {@link Attribute} (i.e.
- * anything about how the attribute is integrated into the {@link RuleClass}). An
- * attribute value query is anything related to the actual value an attribute takes.
+ * <p>An attribute type query is anything accessible from {@link Attribute} (i.e. anything about how
+ * the attribute is integrated into the {@link RuleClass}). An attribute value query is anything
+ * related to the actual value an attribute takes.
*
- * <p>For example, given {@code deps = [":adep"]}, checking that {@code deps} exists
- * or that it's type is {@link BuildType.LABEL_LIST} are type queries. Checking that
- * its value is explicitly set in the BUILD File or that its value
- * {@code [":adep"]} are value queries..
+ * <p>For example, given {@code deps = [":adep"]}, checking that {@code deps} exists or that it's
+ * type is {@link com.google.devtools.build.lib.packages.BuildType#LABEL_LIST} are type queries.
+ * Checking that its value is explicitly set in the BUILD File or that its value {@code [":adep"]}
+ * are value queries..
*
* <p>Value queries on aspect attributes trigger {@link UnsupportedOperationException}.
*/
@@ -167,4 +168,13 @@ class AspectAwareAttributeMapper implements AttributeMap {
&& aspectAttributes.get(attrName).getType() == type;
}
}
+
+ @Override
+ public Location getAttributeLocation(String attrName) {
+ if (ruleAttributes.has(attrName)) {
+ return ruleAttributes.getAttributeLocation(attrName);
+ } else {
+ return Location.BUILTIN;
+ }
+ }
} \ No newline at end of file