Search in sources :

Example 1 with ResolvableArtifact

use of org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.ResolvableArtifact 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 ResolvableArtifact

use of org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.ResolvableArtifact in project gradle by gradle.

the class DependencyResolvingClasspath method getFiles.

@Override
public Set<File> getFiles() {
    ensureResolved(true);
    final Set<File> result = new LinkedHashSet<File>();
    ParallelResolveArtifactSet artifacts = ParallelResolveArtifactSet.wrap(resolveResult.artifactsResults.getArtifacts(), buildOperationExecutor);
    artifacts.visit(new ArtifactVisitor() {

        @Override
        public void visitArtifact(String variantName, AttributeContainer variantAttributes, ResolvableArtifact artifact) {
            result.add(artifact.getFile());
        }

        @Override
        public void visitFailure(Throwable failure) {
            throw UncheckedException.throwAsUncheckedException(failure);
        }

        @Override
        public boolean includeFiles() {
            return true;
        }

        @Override
        public boolean requireArtifactFiles() {
            return true;
        }

        @Override
        public void visitFile(ComponentArtifactIdentifier artifactIdentifier, String variantName, AttributeContainer variantAttributes, File file) {
            result.add(file);
        }
    });
    return result;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) ComponentArtifactIdentifier(org.gradle.api.artifacts.component.ComponentArtifactIdentifier) ResolvableArtifact(org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.ResolvableArtifact) AttributeContainer(org.gradle.api.attributes.AttributeContainer) File(java.io.File) ArtifactVisitor(org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.ArtifactVisitor) ParallelResolveArtifactSet(org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.ParallelResolveArtifactSet)

Example 3 with ResolvableArtifact

use of org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.ResolvableArtifact 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

File (java.io.File)3 ResolvableArtifact (org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.ResolvableArtifact)3 Artifact (org.gradle.api.component.Artifact)2 DefaultResolvedArtifactResult (org.gradle.api.internal.artifacts.result.DefaultResolvedArtifactResult)2 LinkedHashSet (java.util.LinkedHashSet)1 ComponentArtifactIdentifier (org.gradle.api.artifacts.component.ComponentArtifactIdentifier)1 AttributeContainer (org.gradle.api.attributes.AttributeContainer)1 ArtifactVisitor (org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.ArtifactVisitor)1 ParallelResolveArtifactSet (org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.ParallelResolveArtifactSet)1