diff options
author | 2016-04-29 20:35:44 +0000 | |
---|---|---|
committer | 2016-05-02 09:09:53 +0000 | |
commit | 0d7f041a8f3284f2e8ee53ec3e88249bda77489e (patch) | |
tree | cd6ae2ca3c3242521a2691e03a2a737fbfabff02 /src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java | |
parent | f5a73c6d5cbea16d865a79638bb08606890bc647 (diff) |
In apple_binary, propagate cc_library dependencies for all child configurations of the split transition
--
MOS_MIGRATED_REVID=121146341
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java b/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java index cc3118be95..9c85ce9949 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java @@ -696,8 +696,7 @@ public final class RuleContext extends TargetContext AnalysisUtils.checkProvider(classType); List<? extends TransitiveInfoCollection> transitiveInfoCollections = getPrerequisites(attributeName, mode); - - // Use an ImmutableListMultimap.Builder here to preserve ordering. + ImmutableListMultimap.Builder<BuildConfiguration, C> result = ImmutableListMultimap.builder(); for (TransitiveInfoCollection prerequisite : transitiveInfoCollections) { @@ -710,6 +709,24 @@ public final class RuleContext extends TargetContext } /** + * For a given attribute, returns all {@link TransitiveInfoCollection}s provided by targets + * of that attribute. Each {@link TransitiveInfoCollection} is keyed by the + * {@link BuildConfiguration} under which the collection was created. + */ + public ImmutableListMultimap<BuildConfiguration, TransitiveInfoCollection> + getPrerequisitesByConfiguration(String attributeName, Mode mode) { + List<? extends TransitiveInfoCollection> transitiveInfoCollections = + getPrerequisites(attributeName, mode); + + ImmutableListMultimap.Builder<BuildConfiguration, TransitiveInfoCollection> result = + ImmutableListMultimap.builder(); + for (TransitiveInfoCollection prerequisite : transitiveInfoCollections) { + result.put(prerequisite.getConfiguration(), prerequisite); + } + return result.build(); + } + + /** * Returns all the providers of the specified type that are listed under the specified attribute * of this target in the BUILD file. */ |