Search in sources :

Example 6 with ExcludeMetadata

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

the class ModuleMetadataParser method consumeDependencies.

private List<ModuleDependency> consumeDependencies(JsonReader reader) throws IOException {
    List<ModuleDependency> dependencies = new ArrayList<ModuleDependency>();
    reader.beginArray();
    while (reader.peek() != END_ARRAY) {
        reader.beginObject();
        String group = null;
        String module = null;
        String reason = null;
        VersionConstraint version = DefaultImmutableVersionConstraint.of();
        ImmutableList<ExcludeMetadata> excludes = ImmutableList.of();
        while (reader.peek() != END_OBJECT) {
            String name = reader.nextName();
            if (name.equals("group")) {
                group = reader.nextString();
            } else if (name.equals("module")) {
                module = reader.nextString();
            } else if (name.equals("version")) {
                version = consumeVersion(reader);
            } else if (name.equals("excludes")) {
                excludes = consumeExcludes(reader);
            } else if (name.equals("reason")) {
                reason = reader.nextString();
            } else {
                consumeAny(reader);
            }
        }
        dependencies.add(new ModuleDependency(group, module, version, excludes, reason));
        reader.endObject();
    }
    reader.endArray();
    return dependencies;
}
Also used : ImmutableVersionConstraint(org.gradle.api.internal.artifacts.ImmutableVersionConstraint) VersionConstraint(org.gradle.api.artifacts.VersionConstraint) DefaultImmutableVersionConstraint(org.gradle.api.internal.artifacts.dependencies.DefaultImmutableVersionConstraint) ArrayList(java.util.ArrayList) ExcludeMetadata(org.gradle.internal.component.model.ExcludeMetadata)

Example 7 with ExcludeMetadata

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

the class ModuleMetadataParser method consumeExcludes.

private ImmutableList<ExcludeMetadata> consumeExcludes(JsonReader reader) throws IOException {
    ImmutableList.Builder<ExcludeMetadata> builder = new ImmutableList.Builder<ExcludeMetadata>();
    reader.beginArray();
    while (reader.peek() != END_ARRAY) {
        reader.beginObject();
        String group = null;
        String module = null;
        while (reader.peek() != END_OBJECT) {
            String name = reader.nextName();
            if (name.equals("group")) {
                group = reader.nextString();
            } else if (name.equals("module")) {
                module = reader.nextString();
            } else {
                consumeAny(reader);
            }
        }
        reader.endObject();
        ExcludeMetadata exclude = excludeRuleConverter.createExcludeRule(group, module);
        builder.add(exclude);
    }
    reader.endArray();
    return builder.build();
}
Also used : ImmutableList(com.google.common.collect.ImmutableList) ExcludeMetadata(org.gradle.internal.component.model.ExcludeMetadata)

Example 8 with ExcludeMetadata

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

the class ProjectIvyDependencyDescriptorFactory method createDependencyDescriptor.

public LocalOriginDependencyMetadata createDependencyDescriptor(ComponentIdentifier componentId, String clientConfiguration, AttributeContainer clientAttributes, ModuleDependency dependency) {
    ProjectDependencyInternal projectDependency = (ProjectDependencyInternal) dependency;
    projectDependency.beforeResolved();
    ComponentSelector selector = DefaultProjectComponentSelector.newSelector(projectDependency.getDependencyProject());
    List<ExcludeMetadata> excludes = convertExcludeRules(clientConfiguration, dependency.getExcludeRules());
    LocalComponentDependencyMetadata dependencyMetaData = new LocalComponentDependencyMetadata(componentId, selector, clientConfiguration, clientAttributes, projectDependency.getTargetConfiguration(), convertArtifacts(dependency.getArtifacts()), excludes, false, false, dependency.isTransitive(), false, dependency.getReason());
    return new DslOriginDependencyMetadataWrapper(dependencyMetaData, dependency);
}
Also used : ProjectDependencyInternal(org.gradle.api.internal.artifacts.dependencies.ProjectDependencyInternal) ComponentSelector(org.gradle.api.artifacts.component.ComponentSelector) DefaultProjectComponentSelector(org.gradle.internal.component.local.model.DefaultProjectComponentSelector) DslOriginDependencyMetadataWrapper(org.gradle.internal.component.local.model.DslOriginDependencyMetadataWrapper) ExcludeMetadata(org.gradle.internal.component.model.ExcludeMetadata) LocalComponentDependencyMetadata(org.gradle.internal.component.model.LocalComponentDependencyMetadata)

Example 9 with ExcludeMetadata

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

the class DefaultIvyModuleDescriptorWriter method printDependencyExcludeRules.

private static void printDependencyExcludeRules(SimpleXmlWriter writer, Collection<ExcludeMetadata> excludes) throws IOException {
    for (ExcludeMetadata exclude : excludes) {
        writer.startElement("exclude");
        writer.attribute("org", exclude.getModuleId().getGroup());
        writer.attribute("module", exclude.getModuleId().getName());
        IvyArtifactName artifact = exclude.getArtifact();
        if (artifact != null) {
            writer.attribute("name", artifact.getName());
            writer.attribute("type", artifact.getType());
            writer.attribute("ext", artifact.getExtension());
        }
        writer.endElement();
    }
}
Also used : IvyArtifactName(org.gradle.internal.component.model.IvyArtifactName) ExcludeMetadata(org.gradle.internal.component.model.ExcludeMetadata)

Aggregations

ExcludeMetadata (org.gradle.internal.component.model.ExcludeMetadata)9 IvyArtifactName (org.gradle.internal.component.model.IvyArtifactName)3 ModuleComponentSelector (org.gradle.api.artifacts.component.ModuleComponentSelector)2 DefaultImmutableVersionConstraint (org.gradle.api.internal.artifacts.dependencies.DefaultImmutableVersionConstraint)2 DefaultModuleComponentSelector (org.gradle.internal.component.external.model.DefaultModuleComponentSelector)2 DslOriginDependencyMetadataWrapper (org.gradle.internal.component.local.model.DslOriginDependencyMetadataWrapper)2 LocalComponentDependencyMetadata (org.gradle.internal.component.model.LocalComponentDependencyMetadata)2 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 ArrayList (java.util.ArrayList)1 ExternalModuleDependency (org.gradle.api.artifacts.ExternalModuleDependency)1 ModuleIdentifier (org.gradle.api.artifacts.ModuleIdentifier)1 VersionConstraint (org.gradle.api.artifacts.VersionConstraint)1 ComponentSelector (org.gradle.api.artifacts.component.ComponentSelector)1 ImmutableVersionConstraint (org.gradle.api.internal.artifacts.ImmutableVersionConstraint)1 ProjectDependencyInternal (org.gradle.api.internal.artifacts.dependencies.ProjectDependencyInternal)1 ModuleExclusion (org.gradle.api.internal.artifacts.ivyservice.resolveengine.excludes.ModuleExclusion)1 DefaultExclude (org.gradle.internal.component.external.descriptor.DefaultExclude)1 MavenScope (org.gradle.internal.component.external.descriptor.MavenScope)1 MavenDependencyDescriptor (org.gradle.internal.component.external.model.MavenDependencyDescriptor)1