use of org.gradle.api.internal.artifacts.ivyservice.ResolvedFileCollectionVisitor in project gradle by gradle.
the class ArtifactSetToFileCollectionFactory method asFileCollection.
/**
* Presents the contents of the given artifacts as a partial {@link FileCollectionInternal} implementation.
*
* <p>This produces only a minimal implementation to use for artifact sets loaded from the configuration cache
* Over time, this should be merged with the FileCollection implementation in DefaultConfiguration
*/
public FileCollectionInternal asFileCollection(ResolvedArtifactSet artifacts) {
return new AbstractFileCollection() {
@Override
public String getDisplayName() {
return "files";
}
@Override
protected void visitContents(FileCollectionStructureVisitor visitor) {
ResolvedFileCollectionVisitor collectingVisitor = new ResolvedFileCollectionVisitor(visitor);
ParallelResolveArtifactSet.wrap(artifacts, buildOperationExecutor).visit(collectingVisitor);
if (!collectingVisitor.getFailures().isEmpty()) {
throw UncheckedException.throwAsUncheckedException(collectingVisitor.getFailures().iterator().next());
}
}
};
}
Aggregations