use of org.gradle.api.artifacts.component.ComponentArtifactIdentifier in project gradle by gradle.
the class LocalFileDependencyBackedArtifactSet method snapshot.
@Override
public ResolvedArtifactSet snapshot() {
ComponentIdentifier componentIdentifier = dependencyMetadata.getComponentId();
if (componentIdentifier != null && !componentFilter.isSatisfiedBy(componentIdentifier)) {
return ResolvedArtifactSet.EMPTY;
}
Set<File> files;
try {
files = dependencyMetadata.getFiles().getFiles();
} catch (Throwable throwable) {
return new FailingResolvedArtifactSetSnapshot(throwable);
}
List<ResolvedVariant> variants = Lists.newArrayListWithCapacity(files.size());
for (File file : files) {
ComponentArtifactIdentifier artifactIdentifier;
if (componentIdentifier == null) {
artifactIdentifier = new OpaqueComponentArtifactIdentifier(file);
if (!componentFilter.isSatisfiedBy(artifactIdentifier.getComponentIdentifier())) {
continue;
}
} else {
artifactIdentifier = new ComponentFileArtifactIdentifier(componentIdentifier, file.getName());
}
AttributeContainerInternal variantAttributes = DefaultArtifactAttributes.forFile(file, attributesFactory);
ResolvedVariant variant = new SingletonFileResolvedVariant(file, artifactIdentifier, variantAttributes);
variants.add(selector.select(Collections.singleton(variant)));
}
return new ResolvedVariantBackedArtifactSetSnapshot(variants, dependencyMetadata);
}
use of org.gradle.api.artifacts.component.ComponentArtifactIdentifier in project gradle by gradle.
the class DependencyResolvingClasspath method getFiles.
@Override
public Set<File> getFiles() {
ensureResolved(true);
final Set<File> result = new LinkedHashSet<File>();
resolveResult.artifactsResults.getArtifacts().visit(new ArtifactVisitor() {
@Override
public void visitArtifact(AttributeContainer variant, ResolvedArtifact artifact) {
result.add(artifact.getFile());
}
@Override
public void visitFailure(Throwable failure) {
throw UncheckedException.throwAsUncheckedException(failure);
}
@Override
public boolean includeFiles() {
return true;
}
@Override
public void visitFile(ComponentArtifactIdentifier artifactIdentifier, AttributeContainer variant, File file) {
result.add(file);
}
});
return result;
}
Aggregations