Search in sources :

Example 6 with Exclude

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

the class IvyModuleResolveMetaDataBuilder method build.

public MutableIvyModuleResolveMetadata build() {
    ModuleRevisionId moduleRevisionId = ivyDescriptor.getModuleRevisionId();
    ModuleComponentIdentifier cid = DefaultModuleComponentIdentifier.newId(DefaultModuleIdentifier.newId(moduleRevisionId.getOrganisation(), moduleRevisionId.getName()), moduleRevisionId.getRevision());
    List<Configuration> configurations = converter.extractConfigurations(ivyDescriptor);
    List<IvyDependencyDescriptor> dependencies = converter.extractDependencies(ivyDescriptor);
    List<Exclude> excludes = converter.extractExcludes(ivyDescriptor);
    Map<NamespaceId, String> extraAttributes = converter.extractExtraAttributes(ivyDescriptor);
    MutableIvyModuleResolveMetadata metadata = metadataFactory.create(cid, dependencies, configurations, artifacts, excludes);
    metadata.setStatus(ivyDescriptor.getStatus());
    metadata.setExtraAttributes(extraAttributes);
    metadata.setBranch(ivyDescriptor.getModuleRevisionId().getBranch());
    return metadata;
}
Also used : IvyDependencyDescriptor(org.gradle.internal.component.external.model.ivy.IvyDependencyDescriptor) Exclude(org.gradle.internal.component.model.Exclude) Configuration(org.gradle.internal.component.external.descriptor.Configuration) ModuleComponentIdentifier(org.gradle.api.artifacts.component.ModuleComponentIdentifier) DefaultModuleComponentIdentifier(org.gradle.internal.component.external.model.DefaultModuleComponentIdentifier) ModuleRevisionId(org.apache.ivy.core.module.id.ModuleRevisionId) NamespaceId(org.gradle.api.internal.artifacts.ivyservice.NamespaceId) MutableIvyModuleResolveMetadata(org.gradle.internal.component.external.model.ivy.MutableIvyModuleResolveMetadata)

Example 7 with Exclude

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

Example 8 with Exclude

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

the class IvyXmlModuleDescriptorWriter method printAllExcludes.

private static void printAllExcludes(IvyModulePublishMetadata metadata, SimpleXmlWriter writer) throws IOException {
    List<Exclude> excludes = metadata.getModuleDescriptor().getExcludes();
    for (Exclude exclude : excludes) {
        writer.startElement("exclude");
        writer.attribute("org", exclude.getModuleId().getGroup());
        writer.attribute("module", exclude.getModuleId().getName());
        writer.attribute("artifact", exclude.getArtifact().getName());
        writer.attribute("type", exclude.getArtifact().getType());
        writer.attribute("ext", exclude.getArtifact().getExtension());
        Set<String> ruleConfs = exclude.getConfigurations();
        if (!metadata.getConfigurations().keySet().equals(ruleConfs)) {
            writer.attribute("conf", Joiner.on(',').join(ruleConfs));
        }
        writer.attribute("matcher", exclude.getMatcher());
        writer.endElement();
    }
}
Also used : Exclude(org.gradle.internal.component.model.Exclude)

Example 9 with Exclude

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

the class ProjectIvyDependencyDescriptorFactory method createDependencyDescriptor.

public DslOriginDependencyMetadata createDependencyDescriptor(String clientConfiguration, AttributeContainer clientAttributes, ModuleDependency dependency) {
    ProjectDependencyInternal projectDependency = (ProjectDependencyInternal) dependency;
    projectDependency.beforeResolved();
    Module module = getProjectModule(dependency);
    ModuleVersionSelector requested = new DefaultModuleVersionSelector(module.getGroup(), module.getName(), module.getVersion());
    ComponentSelector selector = DefaultProjectComponentSelector.newSelector(projectDependency.getDependencyProject());
    List<Exclude> excludes = convertExcludeRules(clientConfiguration, dependency.getExcludeRules());
    LocalComponentDependencyMetadata dependencyMetaData = new LocalComponentDependencyMetadata(selector, requested, clientConfiguration, clientAttributes, projectDependency.getTargetConfiguration(), convertArtifacts(dependency.getArtifacts()), excludes, false, false, dependency.isTransitive());
    return new DslOriginDependencyMetadataWrapper(dependencyMetaData, dependency);
}
Also used : ProjectDependencyInternal(org.gradle.api.internal.artifacts.dependencies.ProjectDependencyInternal) DefaultModuleVersionSelector(org.gradle.api.internal.artifacts.DefaultModuleVersionSelector) ModuleVersionSelector(org.gradle.api.artifacts.ModuleVersionSelector) DefaultModuleVersionSelector(org.gradle.api.internal.artifacts.DefaultModuleVersionSelector) Exclude(org.gradle.internal.component.model.Exclude) ComponentSelector(org.gradle.api.artifacts.component.ComponentSelector) DefaultProjectComponentSelector(org.gradle.internal.component.local.model.DefaultProjectComponentSelector) DslOriginDependencyMetadataWrapper(org.gradle.internal.component.local.model.DslOriginDependencyMetadataWrapper) Module(org.gradle.api.internal.artifacts.Module) LocalComponentDependencyMetadata(org.gradle.internal.component.model.LocalComponentDependencyMetadata)

Example 10 with Exclude

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

the class IvyXmlModuleDescriptorWriter method printDependencyExcludeRules.

private static void printDependencyExcludeRules(IvyModulePublishMetadata metadata, SimpleXmlWriter writer, Collection<Exclude> excludes) throws IOException {
    for (Exclude exclude : excludes) {
        writer.startElement("exclude");
        writer.attribute("org", exclude.getModuleId().getGroup());
        writer.attribute("module", exclude.getModuleId().getName());
        writer.attribute("name", exclude.getArtifact().getName());
        writer.attribute("type", exclude.getArtifact().getType());
        writer.attribute("ext", exclude.getArtifact().getExtension());
        Set<String> ruleConfs = exclude.getConfigurations();
        if (!metadata.getConfigurations().keySet().equals(ruleConfs)) {
            writer.attribute("conf", Joiner.on(',').join(ruleConfs));
        }
        writer.attribute("matcher", exclude.getMatcher());
        writer.endElement();
    }
}
Also used : Exclude(org.gradle.internal.component.model.Exclude)

Aggregations

Exclude (org.gradle.internal.component.model.Exclude)12 DefaultExclude (org.gradle.internal.component.external.descriptor.DefaultExclude)5 ModuleRevisionId (org.apache.ivy.core.module.id.ModuleRevisionId)3 ModuleVersionSelector (org.gradle.api.artifacts.ModuleVersionSelector)3 ModuleComponentSelector (org.gradle.api.artifacts.component.ModuleComponentSelector)3 DefaultModuleVersionSelector (org.gradle.api.internal.artifacts.DefaultModuleVersionSelector)3 Artifact (org.gradle.internal.component.external.descriptor.Artifact)3 DefaultIvyArtifactName (org.gradle.internal.component.model.DefaultIvyArtifactName)3 IvyArtifactName (org.gradle.internal.component.model.IvyArtifactName)3 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 DefaultModuleComponentSelector (org.gradle.internal.component.external.model.DefaultModuleComponentSelector)2 IvyDependencyDescriptor (org.gradle.internal.component.external.model.ivy.IvyDependencyDescriptor)2 DslOriginDependencyMetadataWrapper (org.gradle.internal.component.local.model.DslOriginDependencyMetadataWrapper)2 LocalComponentDependencyMetadata (org.gradle.internal.component.model.LocalComponentDependencyMetadata)2 BitSet (java.util.BitSet)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1