use of org.gradle.api.internal.artifacts.result.DefaultUnresolvedArtifactResult in project gradle by gradle.
the class DefaultArtifactResolutionQuery method addArtifacts.
private <T extends Artifact> void addArtifacts(DefaultComponentArtifactsResult artifacts, Class<T> type, ComponentResolveMetadata component, ArtifactResolver artifactResolver) {
BuildableArtifactSetResolveResult artifactSetResolveResult = new DefaultBuildableArtifactSetResolveResult();
artifactResolver.resolveArtifactsWithType(component, convertType(type), artifactSetResolveResult);
for (ComponentArtifactMetadata artifactMetaData : artifactSetResolveResult.getResult()) {
BuildableArtifactResolveResult resolveResult = new DefaultBuildableArtifactResolveResult();
artifactResolver.resolveArtifact(artifactMetaData, component.getSource(), resolveResult);
if (resolveResult.getFailure() != null) {
artifacts.addArtifact(new DefaultUnresolvedArtifactResult(artifactMetaData.getId(), type, resolveResult.getFailure()));
} else {
artifacts.addArtifact(new DefaultResolvedArtifactResult(artifactMetaData.getId(), ImmutableAttributes.EMPTY, type, resolveResult.getResult()));
}
}
}
Aggregations