Search in sources :

Example 1 with DefaultResolvedArtifactResult

use of org.gradle.api.internal.artifacts.result.DefaultResolvedArtifactResult in project gradle by gradle.

the class ResolvedArtifactCollectingVisitor method visitArtifact.

@Override
public void visitArtifact(String variantName, AttributeContainer variantAttributes, ResolvableArtifact artifact) {
    try {
        if (seenArtifacts.add(artifact.getId())) {
            // Trigger download of file, if required
            File file = artifact.getFile();
            this.artifacts.add(new DefaultResolvedArtifactResult(artifact.getId(), variantAttributes, variantName, Artifact.class, file));
        }
    } catch (Throwable t) {
        failures.add(t);
    }
}
Also used : File(java.io.File) Artifact(org.gradle.api.component.Artifact) ResolvableArtifact(org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.ResolvableArtifact) DefaultResolvedArtifactResult(org.gradle.api.internal.artifacts.result.DefaultResolvedArtifactResult)

Example 2 with DefaultResolvedArtifactResult

use of org.gradle.api.internal.artifacts.result.DefaultResolvedArtifactResult 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 3 with DefaultResolvedArtifactResult

use of org.gradle.api.internal.artifacts.result.DefaultResolvedArtifactResult in project gradle by gradle.

the class ResolvedArtifactCollectingVisitor method visitArtifact.

@Override
public void visitArtifact(DisplayName variantName, AttributeContainer variantAttributes, List<? extends Capability> capabilities, ResolvableArtifact artifact) {
    try {
        if (seenArtifacts.add(artifact.getId())) {
            File file = artifact.getFile();
            this.artifacts.add(new DefaultResolvedArtifactResult(artifact.getId(), variantAttributes, capabilities, variantName, Artifact.class, file));
        }
    } catch (Exception t) {
        failures.add(t);
    }
}
Also used : File(java.io.File) Artifact(org.gradle.api.component.Artifact) ResolvableArtifact(org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.ResolvableArtifact) DefaultResolvedArtifactResult(org.gradle.api.internal.artifacts.result.DefaultResolvedArtifactResult)

Aggregations

DefaultResolvedArtifactResult (org.gradle.api.internal.artifacts.result.DefaultResolvedArtifactResult)3 File (java.io.File)2 Artifact (org.gradle.api.component.Artifact)2 ResolvableArtifact (org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.ResolvableArtifact)2 DefaultUnresolvedArtifactResult (org.gradle.api.internal.artifacts.result.DefaultUnresolvedArtifactResult)1 ComponentArtifactMetadata (org.gradle.internal.component.model.ComponentArtifactMetadata)1 BuildableArtifactResolveResult (org.gradle.internal.resolve.result.BuildableArtifactResolveResult)1 BuildableArtifactSetResolveResult (org.gradle.internal.resolve.result.BuildableArtifactSetResolveResult)1 DefaultBuildableArtifactResolveResult (org.gradle.internal.resolve.result.DefaultBuildableArtifactResolveResult)1 DefaultBuildableArtifactSetResolveResult (org.gradle.internal.resolve.result.DefaultBuildableArtifactSetResolveResult)1