Search in sources :

Example 21 with IvyArtifactName

use of org.gradle.internal.component.model.IvyArtifactName in project gradle by gradle.

the class DefaultResolvableArtifact method transformedTo.

@Override
public ResolvableArtifact transformedTo(File file) {
    IvyArtifactName artifactName = DefaultIvyArtifactName.forFile(file, artifact.getClassifier());
    ComponentArtifactIdentifier newId = new ComponentFileArtifactIdentifier(artifactId.getComponentIdentifier(), artifactName);
    return new PreResolvedResolvableArtifact(owner, artifactName, newId, calculatedValueContainerFactory.create(Describables.of(newId), file), TaskDependencyContainer.EMPTY, calculatedValueContainerFactory);
}
Also used : ComponentArtifactIdentifier(org.gradle.api.artifacts.component.ComponentArtifactIdentifier) ComponentFileArtifactIdentifier(org.gradle.internal.component.local.model.ComponentFileArtifactIdentifier) DefaultIvyArtifactName(org.gradle.internal.component.model.DefaultIvyArtifactName) IvyArtifactName(org.gradle.internal.component.model.IvyArtifactName)

Example 22 with IvyArtifactName

use of org.gradle.internal.component.model.IvyArtifactName in project gradle by gradle.

the class RealisedIvyModuleResolveMetadataSerializationHelper method readDependencyArtifactDescriptors.

private List<Artifact> readDependencyArtifactDescriptors(Decoder decoder) throws IOException {
    int size = decoder.readSmallInt();
    List<Artifact> result = Lists.newArrayListWithCapacity(size);
    for (int i = 0; i < size; i++) {
        IvyArtifactName ivyArtifactName = new DefaultIvyArtifactName(decoder.readString(), decoder.readString(), decoder.readNullableString(), decoder.readNullableString());
        result.add(new Artifact(ivyArtifactName, readStringSet(decoder)));
    }
    return result;
}
Also used : DefaultIvyArtifactName(org.gradle.internal.component.model.DefaultIvyArtifactName) DefaultIvyArtifactName(org.gradle.internal.component.model.DefaultIvyArtifactName) IvyArtifactName(org.gradle.internal.component.model.IvyArtifactName) Artifact(org.gradle.internal.component.external.descriptor.Artifact)

Example 23 with IvyArtifactName

use of org.gradle.internal.component.model.IvyArtifactName in project gradle by gradle.

the class RealisedIvyModuleResolveMetadataSerializationHelper method writeArtifacts.

private void writeArtifacts(Encoder encoder, List<Artifact> artifacts) throws IOException {
    encoder.writeSmallInt(artifacts.size());
    for (Artifact artifact : artifacts) {
        IvyArtifactName artifactName = artifact.getArtifactName();
        encoder.writeString(artifactName.getName());
        encoder.writeString(artifactName.getType());
        encoder.writeNullableString(artifactName.getExtension());
        encoder.writeNullableString(artifactName.getClassifier());
        writeStringSet(encoder, artifact.getConfigurations());
    }
}
Also used : DefaultIvyArtifactName(org.gradle.internal.component.model.DefaultIvyArtifactName) IvyArtifactName(org.gradle.internal.component.model.IvyArtifactName) Artifact(org.gradle.internal.component.external.descriptor.Artifact)

Example 24 with IvyArtifactName

use of org.gradle.internal.component.model.IvyArtifactName in project gradle by gradle.

the class IvyDependencyDescriptor method getConfigurationArtifacts.

@Override
public ImmutableList<IvyArtifactName> getConfigurationArtifacts(ConfigurationMetadata fromConfiguration) {
    if (dependencyArtifacts.isEmpty()) {
        return ImmutableList.of();
    }
    Collection<String> includedConfigurations = fromConfiguration.getHierarchy();
    ImmutableList.Builder<IvyArtifactName> artifacts = ImmutableList.builder();
    for (Artifact depArtifact : dependencyArtifacts) {
        Set<String> artifactConfigurations = depArtifact.getConfigurations();
        if (include(artifactConfigurations, includedConfigurations)) {
            IvyArtifactName ivyArtifactName = depArtifact.getArtifactName();
            artifacts.add(ivyArtifactName);
        }
    }
    return artifacts.build();
}
Also used : ImmutableList(com.google.common.collect.ImmutableList) IvyArtifactName(org.gradle.internal.component.model.IvyArtifactName) Artifact(org.gradle.internal.component.external.descriptor.Artifact)

Example 25 with IvyArtifactName

use of org.gradle.internal.component.model.IvyArtifactName in project gradle by gradle.

the class IvyModuleDescriptorConverter method addDependency.

private void addDependency(List<IvyDependencyDescriptor> result, DependencyDescriptor dependencyDescriptor) {
    ModuleRevisionId revisionId = dependencyDescriptor.getDependencyRevisionId();
    ModuleComponentSelector requested = DefaultModuleComponentSelector.newSelector(DefaultModuleIdentifier.newId(revisionId.getOrganisation(), revisionId.getName()), new DefaultImmutableVersionConstraint(revisionId.getRevision()));
    ListMultimap<String, String> configMappings = ArrayListMultimap.create();
    for (Map.Entry<String, List<String>> entry : readConfigMappings(dependencyDescriptor).entrySet()) {
        configMappings.putAll(entry.getKey(), entry.getValue());
    }
    List<Artifact> artifacts = Lists.newArrayList();
    for (DependencyArtifactDescriptor ivyArtifact : dependencyDescriptor.getAllDependencyArtifacts()) {
        IvyArtifactName ivyArtifactName = new DefaultIvyArtifactName(ivyArtifact.getName(), ivyArtifact.getType(), ivyArtifact.getExt(), (String) ivyArtifact.getExtraAttributes().get(CLASSIFIER));
        artifacts.add(new Artifact(ivyArtifactName, Sets.newHashSet(ivyArtifact.getConfigurations())));
    }
    List<Exclude> excludes = Lists.newArrayList();
    for (ExcludeRule excludeRule : dependencyDescriptor.getAllExcludeRules()) {
        excludes.add(forIvyExclude(excludeRule));
    }
    result.add(new IvyDependencyDescriptor(requested, dependencyDescriptor.getDynamicConstraintDependencyRevisionId().getRevision(), dependencyDescriptor.isChanging(), dependencyDescriptor.isTransitive(), false, configMappings, artifacts, excludes));
}
Also used : DefaultIvyArtifactName(org.gradle.internal.component.model.DefaultIvyArtifactName) DefaultImmutableVersionConstraint(org.gradle.api.internal.artifacts.dependencies.DefaultImmutableVersionConstraint) Exclude(org.gradle.internal.component.model.Exclude) DefaultExclude(org.gradle.internal.component.external.descriptor.DefaultExclude) ModuleRevisionId(org.apache.ivy.core.module.id.ModuleRevisionId) ExcludeRule(org.apache.ivy.core.module.descriptor.ExcludeRule) Artifact(org.gradle.internal.component.external.descriptor.Artifact) DependencyArtifactDescriptor(org.apache.ivy.core.module.descriptor.DependencyArtifactDescriptor) IvyDependencyDescriptor(org.gradle.internal.component.external.model.ivy.IvyDependencyDescriptor) ModuleComponentSelector(org.gradle.api.artifacts.component.ModuleComponentSelector) DefaultModuleComponentSelector(org.gradle.internal.component.external.model.DefaultModuleComponentSelector) DefaultIvyArtifactName(org.gradle.internal.component.model.DefaultIvyArtifactName) IvyArtifactName(org.gradle.internal.component.model.IvyArtifactName) List(java.util.List) Map(java.util.Map)

Aggregations

IvyArtifactName (org.gradle.internal.component.model.IvyArtifactName)52 DefaultIvyArtifactName (org.gradle.internal.component.model.DefaultIvyArtifactName)28 DefaultExclude (org.gradle.internal.component.external.descriptor.DefaultExclude)7 ExcludeMetadata (org.gradle.internal.component.model.ExcludeMetadata)7 File (java.io.File)6 Artifact (org.gradle.internal.component.external.descriptor.Artifact)6 ModuleIdentifier (org.gradle.api.artifacts.ModuleIdentifier)5 ComponentArtifactIdentifier (org.gradle.api.artifacts.component.ComponentArtifactIdentifier)5 ModuleComponentSelector (org.gradle.api.artifacts.component.ModuleComponentSelector)5 ImmutableList (com.google.common.collect.ImmutableList)4 DefaultImmutableVersionConstraint (org.gradle.api.internal.artifacts.dependencies.DefaultImmutableVersionConstraint)4 ComponentArtifactMetadata (org.gradle.internal.component.model.ComponentArtifactMetadata)4 ImmutableSet (com.google.common.collect.ImmutableSet)3 List (java.util.List)3 Map (java.util.Map)3 ModuleRevisionId (org.apache.ivy.core.module.id.ModuleRevisionId)3 ModuleVersionSelector (org.gradle.api.artifacts.ModuleVersionSelector)3 DefaultResolvedArtifact (org.gradle.api.internal.artifacts.DefaultResolvedArtifact)3 ImmutableAttributes (org.gradle.api.internal.attributes.ImmutableAttributes)3 MavenScope (org.gradle.internal.component.external.descriptor.MavenScope)3