diff options
author | 2015-11-26 11:13:26 +0000 | |
---|---|---|
committer | 2015-11-26 13:20:26 +0000 | |
commit | 1d0086089f48c7bf3cd7bedf4ac5412841f884ae (patch) | |
tree | efad209ee5aaed56e553a381149f69c99a962e6d /src/main/java/com/google | |
parent | 481d38973052f069237bd4bd8188bc4837da7479 (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')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/pkgcache/SrcTargetUtil.java | 18 |
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); } |