Search in sources :

Example 1 with Configuration

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

the class IvyModuleDescriptorConverter method addConfiguration.

private static void addConfiguration(List<Configuration> result, org.apache.ivy.core.module.descriptor.Configuration configuration) {
    String name = configuration.getName();
    boolean transitive = configuration.isTransitive();
    boolean visible = configuration.getVisibility() == org.apache.ivy.core.module.descriptor.Configuration.Visibility.PUBLIC;
    List<String> extendsFrom = Lists.newArrayList(configuration.getExtends());
    result.add(new Configuration(name, transitive, visible, extendsFrom));
}
Also used : Configuration(org.gradle.internal.component.external.descriptor.Configuration)

Example 2 with Configuration

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

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

the class AbstractModuleComponentResolveMetadata method populateConfigurationFromDescriptor.

private DefaultConfigurationMetadata populateConfigurationFromDescriptor(String name, Map<String, Configuration> configurationDefinitions, Map<String, DefaultConfigurationMetadata> configurations) {
    DefaultConfigurationMetadata populated = configurations.get(name);
    if (populated != null) {
        return populated;
    }
    Configuration descriptorConfiguration = configurationDefinitions.get(name);
    List<String> extendsFrom = descriptorConfiguration.getExtendsFrom();
    boolean transitive = descriptorConfiguration.isTransitive();
    boolean visible = descriptorConfiguration.isVisible();
    if (extendsFrom.isEmpty()) {
        // tail
        populated = new DefaultConfigurationMetadata(componentIdentifier, name, transitive, visible, excludes);
        configurations.put(name, populated);
        return populated;
    } else if (extendsFrom.size() == 1) {
        populated = new DefaultConfigurationMetadata(componentIdentifier, name, transitive, visible, Collections.singletonList(populateConfigurationFromDescriptor(extendsFrom.get(0), configurationDefinitions, configurations)), excludes);
        configurations.put(name, populated);
        return populated;
    }
    List<DefaultConfigurationMetadata> hierarchy = new ArrayList<DefaultConfigurationMetadata>(extendsFrom.size());
    for (String confName : extendsFrom) {
        hierarchy.add(populateConfigurationFromDescriptor(confName, configurationDefinitions, configurations));
    }
    populated = new DefaultConfigurationMetadata(componentIdentifier, name, transitive, visible, hierarchy, excludes);
    configurations.put(name, populated);
    return populated;
}
Also used : Configuration(org.gradle.internal.component.external.descriptor.Configuration) ArrayList(java.util.ArrayList)

Example 4 with Configuration

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

the class DefaultIvyModulePublishMetadata method addConfiguration.

@Override
public void addConfiguration(String name, String description, Set<String> extendsFrom, Set<String> hierarchy, boolean visible, boolean transitive, AttributeContainerInternal attributes, boolean canBeConsumed, boolean canBeResolved) {
    List<String> sortedExtends = Lists.newArrayList(extendsFrom);
    Collections.sort(sortedExtends);
    Configuration configuration = new Configuration(name, transitive, visible, sortedExtends);
    configurations.put(name, configuration);
}
Also used : Configuration(org.gradle.internal.component.external.descriptor.Configuration)

Example 5 with Configuration

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

Configuration (org.gradle.internal.component.external.descriptor.Configuration)6 IvyDependencyMetadata (org.gradle.internal.component.external.model.IvyDependencyMetadata)2 ArrayList (java.util.ArrayList)1 ModuleVersionIdentifier (org.gradle.api.artifacts.ModuleVersionIdentifier)1 ModuleComponentIdentifier (org.gradle.api.artifacts.component.ModuleComponentIdentifier)1 Artifact (org.gradle.internal.component.external.descriptor.Artifact)1 ModuleDescriptorState (org.gradle.internal.component.external.descriptor.ModuleDescriptorState)1 DefaultMutableIvyModuleResolveMetadata (org.gradle.internal.component.external.model.DefaultMutableIvyModuleResolveMetadata)1