Search in sources :

Example 1 with IvyDependencyMetadata

use of org.gradle.internal.component.external.model.IvyDependencyMetadata 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 IvyDependencyMetadata

use of org.gradle.internal.component.external.model.IvyDependencyMetadata in project gradle by gradle.

the class IvyModuleResolveMetaDataBuilder method build.

public DefaultMutableIvyModuleResolveMetadata build() {
    ModuleDescriptorState descriptorState = converter.forIvyModuleDescriptor(ivyDescriptor);
    for (Artifact artifact : artifacts) {
        descriptorState.addArtifact(artifact.getArtifactName(), artifact.getConfigurations());
    }
    List<Configuration> configurations = converter.extractConfigurations(ivyDescriptor);
    List<IvyDependencyMetadata> dependencies = converter.extractDependencies(ivyDescriptor);
    ModuleComponentIdentifier cid = descriptorState.getComponentIdentifier();
    ModuleVersionIdentifier mvi = moduleIdentifierFactory.moduleWithVersion(cid.getGroup(), cid.getModule(), cid.getVersion());
    return new DefaultMutableIvyModuleResolveMetadata(mvi, cid, descriptorState, configurations, dependencies);
}
Also used : ModuleVersionIdentifier(org.gradle.api.artifacts.ModuleVersionIdentifier) Configuration(org.gradle.internal.component.external.descriptor.Configuration) IvyDependencyMetadata(org.gradle.internal.component.external.model.IvyDependencyMetadata) ModuleComponentIdentifier(org.gradle.api.artifacts.component.ModuleComponentIdentifier) ModuleDescriptorState(org.gradle.internal.component.external.descriptor.ModuleDescriptorState) DefaultMutableIvyModuleResolveMetadata(org.gradle.internal.component.external.model.DefaultMutableIvyModuleResolveMetadata) Artifact(org.gradle.internal.component.external.descriptor.Artifact)

Example 3 with IvyDependencyMetadata

use of org.gradle.internal.component.external.model.IvyDependencyMetadata in project gradle by gradle.

the class GradlePomModuleDescriptorBuilder method addDependencyForRelocation.

public void addDependencyForRelocation(ModuleVersionSelector selector) {
    // Example: http://repo2.maven.org/maven2/com/atomikos/atomikos-util/3.6.4/atomikos-util-3.6.4.pom
    if (selector.getGroup().equals(descriptor.getComponentIdentifier().getGroup()) && selector.getName().equals(descriptor.getComponentIdentifier().getModule())) {
        return;
    }
    // TODO - this is a constant
    ListMultimap<String, String> confMappings = ArrayListMultimap.create();
    // Map dependency on all public configurations
    for (Configuration m2Conf : GradlePomModuleDescriptorBuilder.MAVEN2_CONFIGURATIONS.values()) {
        if (m2Conf.isVisible()) {
            confMappings.put(m2Conf.getName(), m2Conf.getName());
        }
    }
    dependencies.add(new IvyDependencyMetadata(selector, confMappings));
}
Also used : Configuration(org.gradle.internal.component.external.descriptor.Configuration) IvyDependencyMetadata(org.gradle.internal.component.external.model.IvyDependencyMetadata)

Aggregations

IvyDependencyMetadata (org.gradle.internal.component.external.model.IvyDependencyMetadata)3 Artifact (org.gradle.internal.component.external.descriptor.Artifact)2 Configuration (org.gradle.internal.component.external.descriptor.Configuration)2 List (java.util.List)1 Map (java.util.Map)1 DependencyArtifactDescriptor (org.apache.ivy.core.module.descriptor.DependencyArtifactDescriptor)1 ExcludeRule (org.apache.ivy.core.module.descriptor.ExcludeRule)1 ModuleRevisionId (org.apache.ivy.core.module.id.ModuleRevisionId)1 ModuleVersionIdentifier (org.gradle.api.artifacts.ModuleVersionIdentifier)1 ModuleVersionSelector (org.gradle.api.artifacts.ModuleVersionSelector)1 ModuleComponentIdentifier (org.gradle.api.artifacts.component.ModuleComponentIdentifier)1 DefaultModuleVersionSelector (org.gradle.api.internal.artifacts.DefaultModuleVersionSelector)1 DefaultExclude (org.gradle.internal.component.external.descriptor.DefaultExclude)1 ModuleDescriptorState (org.gradle.internal.component.external.descriptor.ModuleDescriptorState)1 DefaultMutableIvyModuleResolveMetadata (org.gradle.internal.component.external.model.DefaultMutableIvyModuleResolveMetadata)1 DefaultIvyArtifactName (org.gradle.internal.component.model.DefaultIvyArtifactName)1 Exclude (org.gradle.internal.component.model.Exclude)1 IvyArtifactName (org.gradle.internal.component.model.IvyArtifactName)1