Search in sources :

Example 1 with Artifact

use of org.gradle.internal.component.external.descriptor.Artifact in project gradle by gradle.

the class IvyModuleDescriptorConverter method addDependency.

private void addDependency(List<IvyDependencyMetadata> result, DependencyDescriptor dependencyDescriptor) {
    ModuleRevisionId revisionId = dependencyDescriptor.getDependencyRevisionId();
    ModuleVersionSelector requested = DefaultModuleVersionSelector.newSelector(revisionId.getOrganisation(), revisionId.getName(), 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 IvyDependencyMetadata(requested, dependencyDescriptor.getDynamicConstraintDependencyRevisionId().getRevision(), false, dependencyDescriptor.isChanging(), dependencyDescriptor.isTransitive(), configMappings, artifacts, excludes));
}
Also used : DefaultIvyArtifactName(org.gradle.internal.component.model.DefaultIvyArtifactName) DefaultModuleVersionSelector(org.gradle.api.internal.artifacts.DefaultModuleVersionSelector) ModuleVersionSelector(org.gradle.api.artifacts.ModuleVersionSelector) Exclude(org.gradle.internal.component.model.Exclude) DefaultExclude(org.gradle.internal.component.external.descriptor.DefaultExclude) IvyDependencyMetadata(org.gradle.internal.component.external.model.IvyDependencyMetadata) 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) DefaultIvyArtifactName(org.gradle.internal.component.model.DefaultIvyArtifactName) IvyArtifactName(org.gradle.internal.component.model.IvyArtifactName) List(java.util.List) Map(java.util.Map)

Example 2 with Artifact

use of org.gradle.internal.component.external.descriptor.Artifact in project gradle by gradle.

the class IvyDependencyDescriptor method getConfigurationArtifacts.

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 3 with Artifact

use of org.gradle.internal.component.external.descriptor.Artifact 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 4 with Artifact

use of org.gradle.internal.component.external.descriptor.Artifact 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 5 with Artifact

use of org.gradle.internal.component.external.descriptor.Artifact in project gradle by gradle.

the class RealisedIvyModuleResolveMetadataSerializationHelper method readIvyDependency.

private IvyDependencyDescriptor readIvyDependency(Decoder decoder) throws IOException {
    ModuleComponentSelector requested = getComponentSelectorSerializer().read(decoder);
    SetMultimap<String, String> configMappings = readDependencyConfigurationMapping(decoder);
    List<Artifact> artifacts = readDependencyArtifactDescriptors(decoder);
    List<Exclude> excludes = readDependencyExcludes(decoder);
    String dynamicConstraintVersion = decoder.readString();
    boolean changing = decoder.readBoolean();
    boolean transitive = decoder.readBoolean();
    boolean optional = decoder.readBoolean();
    return new IvyDependencyDescriptor(requested, dynamicConstraintVersion, changing, transitive, optional, configMappings, artifacts, excludes);
}
Also used : Exclude(org.gradle.internal.component.model.Exclude) DefaultExclude(org.gradle.internal.component.external.descriptor.DefaultExclude) ModuleComponentSelector(org.gradle.api.artifacts.component.ModuleComponentSelector) Artifact(org.gradle.internal.component.external.descriptor.Artifact)

Aggregations

Artifact (org.gradle.internal.component.external.descriptor.Artifact)12 IvyArtifactName (org.gradle.internal.component.model.IvyArtifactName)6 DefaultIvyArtifactName (org.gradle.internal.component.model.DefaultIvyArtifactName)4 DefaultExclude (org.gradle.internal.component.external.descriptor.DefaultExclude)3 Exclude (org.gradle.internal.component.model.Exclude)3 ImmutableList (com.google.common.collect.ImmutableList)2 List (java.util.List)2 Map (java.util.Map)2 DependencyArtifactDescriptor (org.apache.ivy.core.module.descriptor.DependencyArtifactDescriptor)2 ExcludeRule (org.apache.ivy.core.module.descriptor.ExcludeRule)2 ModuleRevisionId (org.apache.ivy.core.module.id.ModuleRevisionId)2 ModuleComponentSelector (org.gradle.api.artifacts.component.ModuleComponentSelector)2 ModuleVersionSelector (org.gradle.api.artifacts.ModuleVersionSelector)1 DefaultModuleVersionSelector (org.gradle.api.internal.artifacts.DefaultModuleVersionSelector)1 DefaultImmutableVersionConstraint (org.gradle.api.internal.artifacts.dependencies.DefaultImmutableVersionConstraint)1 DefaultModuleComponentArtifactMetadata (org.gradle.internal.component.external.model.DefaultModuleComponentArtifactMetadata)1 DefaultModuleComponentSelector (org.gradle.internal.component.external.model.DefaultModuleComponentSelector)1 IvyDependencyMetadata (org.gradle.internal.component.external.model.IvyDependencyMetadata)1 ModuleComponentArtifactMetadata (org.gradle.internal.component.external.model.ModuleComponentArtifactMetadata)1 IvyDependencyDescriptor (org.gradle.internal.component.external.model.ivy.IvyDependencyDescriptor)1