Search in sources :

Example 1 with Exclude

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

the class ModuleExclusions method excludeAny.

/**
     * Returns a spec that excludes those modules and artifacts that are excluded by _any_ of the given exclude rules.
     */
public ModuleExclusion excludeAny(List<Exclude> excludes) {
    if (excludes.isEmpty()) {
        return EXCLUDE_NONE;
    }
    AbstractModuleExclusion exclusion = excludeAnyCache.get(excludes);
    if (exclusion != null) {
        return exclusion;
    }
    Set<AbstractModuleExclusion> exclusions = Sets.newHashSetWithExpectedSize(excludes.size());
    for (Exclude exclude : excludes) {
        exclusions.add(forExclude(exclude));
    }
    exclusion = new IntersectionExclusion(asImmutable(exclusions));
    excludeAnyCache.put(excludes, exclusion);
    return exclusion;
}
Also used : Exclude(org.gradle.internal.component.model.Exclude)

Example 2 with Exclude

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

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

the class ExternalModuleIvyDependencyDescriptorFactory method createDependencyDescriptor.

public DslOriginDependencyMetadata createDependencyDescriptor(String clientConfiguration, AttributeContainer clientAttributes, ModuleDependency dependency) {
    ExternalModuleDependency externalModuleDependency = (ExternalModuleDependency) dependency;
    boolean force = externalModuleDependency.isForce();
    boolean changing = externalModuleDependency.isChanging();
    boolean transitive = externalModuleDependency.isTransitive();
    ModuleVersionSelector requested = new DefaultModuleVersionSelector(nullToEmpty(dependency.getGroup()), nullToEmpty(dependency.getName()), nullToEmpty(dependency.getVersion()));
    ModuleComponentSelector selector = DefaultModuleComponentSelector.newSelector(requested);
    List<Exclude> excludes = convertExcludeRules(clientConfiguration, dependency.getExcludeRules());
    LocalComponentDependencyMetadata dependencyMetaData = new LocalComponentDependencyMetadata(selector, requested, clientConfiguration, clientAttributes, dependency.getTargetConfiguration(), convertArtifacts(dependency.getArtifacts()), excludes, force, changing, transitive);
    return new DslOriginDependencyMetadataWrapper(dependencyMetaData, dependency);
}
Also used : 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) DefaultModuleComponentSelector(org.gradle.internal.component.external.model.DefaultModuleComponentSelector) ModuleComponentSelector(org.gradle.api.artifacts.component.ModuleComponentSelector) DslOriginDependencyMetadataWrapper(org.gradle.internal.component.local.model.DslOriginDependencyMetadataWrapper) ExternalModuleDependency(org.gradle.api.artifacts.ExternalModuleDependency) LocalComponentDependencyMetadata(org.gradle.internal.component.model.LocalComponentDependencyMetadata)

Example 4 with Exclude

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

the class RealisedIvyModuleResolveMetadataSerializationHelper method readDependencyExcludes.

private List<Exclude> readDependencyExcludes(Decoder decoder) throws IOException {
    int len = decoder.readSmallInt();
    List<Exclude> result = Lists.newArrayListWithCapacity(len);
    for (int i = 0; i < len; i++) {
        DefaultExclude rule = readExcludeRule(decoder);
        result.add(rule);
    }
    return result;
}
Also used : Exclude(org.gradle.internal.component.model.Exclude) DefaultExclude(org.gradle.internal.component.external.descriptor.DefaultExclude) DefaultExclude(org.gradle.internal.component.external.descriptor.DefaultExclude)

Example 5 with Exclude

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

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