Search in sources :

Example 1 with OpaqueComponentArtifactIdentifier

use of org.gradle.internal.component.local.model.OpaqueComponentArtifactIdentifier in project gradle by gradle.

the class LocalFileDependencyBackedArtifactSet method snapshot.

@Override
public ResolvedArtifactSet snapshot() {
    ComponentIdentifier componentIdentifier = dependencyMetadata.getComponentId();
    if (componentIdentifier != null && !componentFilter.isSatisfiedBy(componentIdentifier)) {
        return ResolvedArtifactSet.EMPTY;
    }
    Set<File> files;
    try {
        files = dependencyMetadata.getFiles().getFiles();
    } catch (Throwable throwable) {
        return new FailingResolvedArtifactSetSnapshot(throwable);
    }
    List<ResolvedVariant> variants = Lists.newArrayListWithCapacity(files.size());
    for (File file : files) {
        ComponentArtifactIdentifier artifactIdentifier;
        if (componentIdentifier == null) {
            artifactIdentifier = new OpaqueComponentArtifactIdentifier(file);
            if (!componentFilter.isSatisfiedBy(artifactIdentifier.getComponentIdentifier())) {
                continue;
            }
        } else {
            artifactIdentifier = new ComponentFileArtifactIdentifier(componentIdentifier, file.getName());
        }
        AttributeContainerInternal variantAttributes = DefaultArtifactAttributes.forFile(file, attributesFactory);
        ResolvedVariant variant = new SingletonFileResolvedVariant(file, artifactIdentifier, variantAttributes);
        variants.add(selector.select(Collections.singleton(variant)));
    }
    return new ResolvedVariantBackedArtifactSetSnapshot(variants, dependencyMetadata);
}
Also used : OpaqueComponentArtifactIdentifier(org.gradle.internal.component.local.model.OpaqueComponentArtifactIdentifier) ComponentArtifactIdentifier(org.gradle.api.artifacts.component.ComponentArtifactIdentifier) ComponentIdentifier(org.gradle.api.artifacts.component.ComponentIdentifier) AttributeContainerInternal(org.gradle.api.internal.attributes.AttributeContainerInternal) ComponentFileArtifactIdentifier(org.gradle.internal.component.local.model.ComponentFileArtifactIdentifier) OpaqueComponentArtifactIdentifier(org.gradle.internal.component.local.model.OpaqueComponentArtifactIdentifier) File(java.io.File)

Aggregations

File (java.io.File)1 ComponentArtifactIdentifier (org.gradle.api.artifacts.component.ComponentArtifactIdentifier)1 ComponentIdentifier (org.gradle.api.artifacts.component.ComponentIdentifier)1 AttributeContainerInternal (org.gradle.api.internal.attributes.AttributeContainerInternal)1 ComponentFileArtifactIdentifier (org.gradle.internal.component.local.model.ComponentFileArtifactIdentifier)1 OpaqueComponentArtifactIdentifier (org.gradle.internal.component.local.model.OpaqueComponentArtifactIdentifier)1