use of org.gradle.internal.resolve.result.DefaultBuildableArtifactSetResolveResult 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.getSources(), resolveResult);
if (resolveResult.getFailure() != null) {
artifacts.addArtifact(new DefaultUnresolvedArtifactResult(artifactMetaData.getId(), type, resolveResult.getFailure()));
} else {
artifacts.addArtifact(ivyFactory.verifiedArtifact(new DefaultResolvedArtifactResult(artifactMetaData.getId(), ImmutableAttributes.EMPTY, Collections.emptyList(), Describables.of(component.getId().getDisplayName()), type, resolveResult.getResult())));
}
}
}
use of org.gradle.internal.resolve.result.DefaultBuildableArtifactSetResolveResult in project gradle by gradle.
the class ExternalResourceResolverDescriptorParseContext method resolveMetaDataArtifactFile.
private LocallyAvailableExternalResource resolveMetaDataArtifactFile(ModuleComponentIdentifier moduleComponentIdentifier, ComponentMetaDataResolver componentResolver, ArtifactResolver artifactResolver, ArtifactType artifactType) {
BuildableComponentResolveResult moduleVersionResolveResult = new DefaultBuildableComponentResolveResult();
componentResolver.resolve(moduleComponentIdentifier, DefaultComponentOverrideMetadata.EMPTY, moduleVersionResolveResult);
BuildableArtifactSetResolveResult moduleArtifactsResolveResult = new DefaultBuildableArtifactSetResolveResult();
artifactResolver.resolveArtifactsWithType(moduleVersionResolveResult.getMetadata(), artifactType, moduleArtifactsResolveResult);
BuildableArtifactResolveResult artifactResolveResult = new DefaultBuildableArtifactResolveResult();
ComponentArtifactMetadata artifactMetaData = moduleArtifactsResolveResult.getResult().iterator().next();
artifactResolver.resolveArtifact(artifactMetaData, moduleVersionResolveResult.getMetadata().getSources(), artifactResolveResult);
File file = artifactResolveResult.getResult();
LocallyAvailableExternalResource resource = fileResourceRepository.resource(file);
ComponentArtifactIdentifier id = artifactMetaData.getId();
if (id instanceof ModuleComponentArtifactIdentifier) {
sources.add(new DefaultMetadataFileSource((ModuleComponentArtifactIdentifier) id, file, checksumService.sha1(file)));
}
return resource;
}
Aggregations