Search in sources :

Example 6 with DefaultBuildableComponentResolveResult

use of org.gradle.internal.resolve.result.DefaultBuildableComponentResolveResult 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

DefaultBuildableComponentResolveResult (org.gradle.internal.resolve.result.DefaultBuildableComponentResolveResult)6 LongIdGenerator (org.gradle.internal.id.LongIdGenerator)3 BuildableComponentResolveResult (org.gradle.internal.resolve.result.BuildableComponentResolveResult)2 File (java.io.File)1 ModuleVersionIdentifier (org.gradle.api.artifacts.ModuleVersionIdentifier)1 ComponentArtifactIdentifier (org.gradle.api.artifacts.component.ComponentArtifactIdentifier)1 ComponentIdentifier (org.gradle.api.artifacts.component.ComponentIdentifier)1 ResolvedVersionConstraint (org.gradle.api.internal.artifacts.ResolvedVersionConstraint)1 ResolutionStrategyInternal (org.gradle.api.internal.artifacts.configurations.ResolutionStrategyInternal)1 DefaultMetadataFileSource (org.gradle.api.internal.artifacts.repositories.metadata.DefaultMetadataFileSource)1 DefaultComponentArtifactsResult (org.gradle.api.internal.artifacts.result.DefaultComponentArtifactsResult)1 DefaultModuleComponentIdentifier (org.gradle.internal.component.external.model.DefaultModuleComponentIdentifier)1 ModuleComponentArtifactIdentifier (org.gradle.internal.component.external.model.ModuleComponentArtifactIdentifier)1 ComponentArtifactMetadata (org.gradle.internal.component.model.ComponentArtifactMetadata)1 ComponentOverrideMetadata (org.gradle.internal.component.model.ComponentOverrideMetadata)1 ComponentResolveMetadata (org.gradle.internal.component.model.ComponentResolveMetadata)1 DefaultComponentOverrideMetadata (org.gradle.internal.component.model.DefaultComponentOverrideMetadata)1 BuildOperationConstraint (org.gradle.internal.operations.BuildOperationConstraint)1 BuildableArtifactResolveResult (org.gradle.internal.resolve.result.BuildableArtifactResolveResult)1 BuildableArtifactSetResolveResult (org.gradle.internal.resolve.result.BuildableArtifactSetResolveResult)1