Search in sources :

Example 1 with DefaultBuildableArtifactSetResolveResult

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())));
        }
    }
}
Also used : ComponentArtifactMetadata(org.gradle.internal.component.model.ComponentArtifactMetadata) DefaultUnresolvedArtifactResult(org.gradle.api.internal.artifacts.result.DefaultUnresolvedArtifactResult) BuildableArtifactSetResolveResult(org.gradle.internal.resolve.result.BuildableArtifactSetResolveResult) DefaultBuildableArtifactSetResolveResult(org.gradle.internal.resolve.result.DefaultBuildableArtifactSetResolveResult) DefaultBuildableArtifactSetResolveResult(org.gradle.internal.resolve.result.DefaultBuildableArtifactSetResolveResult) BuildableArtifactResolveResult(org.gradle.internal.resolve.result.BuildableArtifactResolveResult) DefaultBuildableArtifactResolveResult(org.gradle.internal.resolve.result.DefaultBuildableArtifactResolveResult) DefaultBuildableArtifactResolveResult(org.gradle.internal.resolve.result.DefaultBuildableArtifactResolveResult) DefaultResolvedArtifactResult(org.gradle.api.internal.artifacts.result.DefaultResolvedArtifactResult)

Example 2 with DefaultBuildableArtifactSetResolveResult

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;
}
Also used : ComponentArtifactIdentifier(org.gradle.api.artifacts.component.ComponentArtifactIdentifier) ModuleComponentArtifactIdentifier(org.gradle.internal.component.external.model.ModuleComponentArtifactIdentifier) ModuleComponentArtifactIdentifier(org.gradle.internal.component.external.model.ModuleComponentArtifactIdentifier) DefaultBuildableComponentResolveResult(org.gradle.internal.resolve.result.DefaultBuildableComponentResolveResult) BuildableComponentResolveResult(org.gradle.internal.resolve.result.BuildableComponentResolveResult) ComponentArtifactMetadata(org.gradle.internal.component.model.ComponentArtifactMetadata) DefaultMetadataFileSource(org.gradle.api.internal.artifacts.repositories.metadata.DefaultMetadataFileSource) DefaultBuildableComponentResolveResult(org.gradle.internal.resolve.result.DefaultBuildableComponentResolveResult) LocallyAvailableExternalResource(org.gradle.internal.resource.local.LocallyAvailableExternalResource) BuildableArtifactSetResolveResult(org.gradle.internal.resolve.result.BuildableArtifactSetResolveResult) DefaultBuildableArtifactSetResolveResult(org.gradle.internal.resolve.result.DefaultBuildableArtifactSetResolveResult) DefaultBuildableArtifactSetResolveResult(org.gradle.internal.resolve.result.DefaultBuildableArtifactSetResolveResult) BuildableArtifactResolveResult(org.gradle.internal.resolve.result.BuildableArtifactResolveResult) DefaultBuildableArtifactResolveResult(org.gradle.internal.resolve.result.DefaultBuildableArtifactResolveResult) DefaultBuildableArtifactResolveResult(org.gradle.internal.resolve.result.DefaultBuildableArtifactResolveResult) File(java.io.File)

Aggregations

ComponentArtifactMetadata (org.gradle.internal.component.model.ComponentArtifactMetadata)2 BuildableArtifactResolveResult (org.gradle.internal.resolve.result.BuildableArtifactResolveResult)2 BuildableArtifactSetResolveResult (org.gradle.internal.resolve.result.BuildableArtifactSetResolveResult)2 DefaultBuildableArtifactResolveResult (org.gradle.internal.resolve.result.DefaultBuildableArtifactResolveResult)2 DefaultBuildableArtifactSetResolveResult (org.gradle.internal.resolve.result.DefaultBuildableArtifactSetResolveResult)2 File (java.io.File)1 ComponentArtifactIdentifier (org.gradle.api.artifacts.component.ComponentArtifactIdentifier)1 DefaultMetadataFileSource (org.gradle.api.internal.artifacts.repositories.metadata.DefaultMetadataFileSource)1 DefaultResolvedArtifactResult (org.gradle.api.internal.artifacts.result.DefaultResolvedArtifactResult)1 DefaultUnresolvedArtifactResult (org.gradle.api.internal.artifacts.result.DefaultUnresolvedArtifactResult)1 ModuleComponentArtifactIdentifier (org.gradle.internal.component.external.model.ModuleComponentArtifactIdentifier)1 BuildableComponentResolveResult (org.gradle.internal.resolve.result.BuildableComponentResolveResult)1 DefaultBuildableComponentResolveResult (org.gradle.internal.resolve.result.DefaultBuildableComponentResolveResult)1 LocallyAvailableExternalResource (org.gradle.internal.resource.local.LocallyAvailableExternalResource)1