use of com.google.devtools.build.lib.packages.AspectClass in project bazel by bazelbuild.
the class BuildView method addExtraActionsFromTargets.
private NestedSet<Artifact> addExtraActionsFromTargets(BuildView.Options viewOptions, Collection<ConfiguredTarget> configuredTargets) {
NestedSetBuilder<Artifact> builder = NestedSetBuilder.stableOrder();
for (ConfiguredTarget target : configuredTargets) {
ExtraActionArtifactsProvider provider = target.getProvider(ExtraActionArtifactsProvider.class);
if (provider != null) {
if (viewOptions.extraActionTopLevelOnly) {
if (!viewOptions.extraActionTopLevelOnlyWithAspects) {
builder.addTransitive(provider.getExtraActionArtifacts());
} else {
// Collect all aspect-classes that topLevel might inject.
Set<AspectClass> aspectClasses = new HashSet<>();
for (Attribute attr : target.getTarget().getAssociatedRule().getAttributes()) {
aspectClasses.addAll(attr.getAspectClasses());
}
builder.addTransitive(provider.getExtraActionArtifacts());
if (!aspectClasses.isEmpty()) {
builder.addAll(filterTransitiveExtraActions(provider, aspectClasses));
}
}
} else {
builder.addTransitive(provider.getTransitiveExtraActionArtifacts());
}
}
}
return builder.build();
}
Aggregations