public static final <T extends TransitiveInfoProvider> Iterable<T> getTransitivePrerequisites( RuleContext ruleContext, Mode mode, final Class<T> classType) { IterablesChain.Builder<T> builder = IterablesChain.builder(); for (String attr : TRANSITIVE_ATTRIBUTES) { if (ruleContext.getAttribute(attr) != null) { builder.add(ruleContext.getPrerequisites(attr, mode, classType)); } } return builder.build(); }
public static final Iterable<TransitiveInfoCollection> collectTransitiveInfo( RuleContext ruleContext, Mode mode) { ImmutableList.Builder<TransitiveInfoCollection> builder = ImmutableList.builder(); for (String attr : TRANSITIVE_ATTRIBUTES) { if (ruleContext.getAttribute(attr) != null) { builder.addAll(ruleContext.getPrerequisites(attr, mode)); } } return builder.build(); }