aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/pkgcache
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2015-11-26 11:13:26 +0000
committerGravatar Philipp Wollermann <philwo@google.com>2015-11-26 13:20:26 +0000
commit1d0086089f48c7bf3cd7bedf4ac5412841f884ae (patch)
treeefad209ee5aaed56e553a381149f69c99a962e6d /src/main/java/com/google/devtools/build/lib/pkgcache
parent481d38973052f069237bd4bd8188bc4837da7479 (diff)
For --compile_one_dependency, flatten targets coming out of configurable attributes. This might not be the correct behavior in the long run, but it seems like a much better choice
compared to completely ignoring configurable attributes. -- MOS_MIGRATED_REVID=108778853
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/pkgcache')
-rw-r--r--src/main/java/com/google/devtools/build/lib/pkgcache/SrcTargetUtil.java18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/pkgcache/SrcTargetUtil.java b/src/main/java/com/google/devtools/build/lib/pkgcache/SrcTargetUtil.java
index e262d3ec94..5f2c7f3de3 100644
--- a/src/main/java/com/google/devtools/build/lib/pkgcache/SrcTargetUtil.java
+++ b/src/main/java/com/google/devtools/build/lib/pkgcache/SrcTargetUtil.java
@@ -20,7 +20,6 @@ import com.google.common.collect.Sets;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.concurrent.ThreadSafety;
import com.google.devtools.build.lib.events.EventHandler;
-import com.google.devtools.build.lib.packages.AttributeMap;
import com.google.devtools.build.lib.packages.BuildType;
import com.google.devtools.build.lib.packages.FileTarget;
import com.google.devtools.build.lib.packages.NoSuchPackageException;
@@ -121,15 +120,16 @@ public final class SrcTargetUtil {
TargetProvider targetProvider)
throws NoSuchTargetException, NoSuchPackageException, InterruptedException {
List<Label> srcLabels = Lists.newArrayList();
- AttributeMap attributeMap = RawAttributeMapper.of(rule);
+ RawAttributeMapper attributeMapper = RawAttributeMapper.of(rule);
for (String attrName : attributes) {
- if (rule.isConfigurableAttribute(attrName)) {
- // We don't know which path to follow for configurable attributes. So skip them.
- continue;
- } else if (rule.isAttrDefined(attrName, BuildType.LABEL_LIST)) {
- srcLabels.addAll(attributeMap.get(attrName, BuildType.LABEL_LIST));
- } else if (rule.isAttrDefined(attrName, BuildType.LABEL)) {
- Label srcLabel = attributeMap.get(attrName, BuildType.LABEL);
+ if (rule.isAttrDefined(attrName, BuildType.LABEL_LIST)) {
+ // Note that we simply flatten configurable attributes here, which is not the correct
+ // behavior. However, it seems to be a good approximation of what is needed in most use
+ // cases.
+ srcLabels.addAll(attributeMapper.getMergedValues(attrName, BuildType.LABEL_LIST));
+ } else if (rule.isAttrDefined(attrName, BuildType.LABEL)
+ && !rule.isConfigurableAttribute(attrName)) {
+ Label srcLabel = attributeMapper.get(attrName, BuildType.LABEL);
if (srcLabel != null) {
srcLabels.add(srcLabel);
}