Search in sources :

Example 1 with NamespaceId

use of org.gradle.api.internal.artifacts.ivyservice.NamespaceId in project gradle by gradle.

the class IvyXmlModuleDescriptorWriter method printInfoTag.

private static void printInfoTag(ModuleDescriptorState descriptor, SimpleXmlWriter writer) throws IOException {
    ModuleComponentIdentifier id = descriptor.getComponentIdentifier();
    writer.startElement("info");
    writer.attribute("organisation", id.getGroup());
    writer.attribute("module", id.getModule());
    String branch = descriptor.getBranch();
    if (branch != null) {
        writer.attribute("branch", branch);
    }
    writer.attribute("revision", id.getVersion());
    writer.attribute("status", descriptor.getStatus());
    if (descriptor.isGenerated()) {
        writer.attribute("default", "true");
    }
    printUnusedContent(descriptor, writer);
    for (Map.Entry<NamespaceId, String> entry : descriptor.getExtraInfo().entrySet()) {
        if (entry.getValue() == null || entry.getValue().length() == 0) {
            continue;
        }
        NamespaceId namespaceId = entry.getKey();
        writer.startElement("ns:" + namespaceId.getName());
        writer.attribute("xmlns:ns", namespaceId.getNamespace());
        writer.characters(entry.getValue());
        writer.endElement();
    }
    writer.endElement();
}
Also used : ModuleComponentIdentifier(org.gradle.api.artifacts.component.ModuleComponentIdentifier) NamespaceId(org.gradle.api.internal.artifacts.ivyservice.NamespaceId) Map(java.util.Map)

Example 2 with NamespaceId

use of org.gradle.api.internal.artifacts.ivyservice.NamespaceId 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 3 with NamespaceId

use of org.gradle.api.internal.artifacts.ivyservice.NamespaceId in project gradle by gradle.

the class IvyModuleDescriptorConverter method forIvyModuleDescriptor.

public ModuleDescriptorState forIvyModuleDescriptor(ModuleDescriptor ivyDescriptor) {
    ModuleRevisionId moduleRevisionId = ivyDescriptor.getModuleRevisionId();
    ModuleComponentIdentifier componentIdentifier = DefaultModuleComponentIdentifier.newId(moduleRevisionId.getOrganisation(), moduleRevisionId.getName(), moduleRevisionId.getRevision());
    MutableModuleDescriptorState state = new MutableModuleDescriptorState(componentIdentifier, ivyDescriptor.getStatus(), ivyDescriptor.isDefault());
    state.setBranch(moduleRevisionId.getBranch());
    state.setDescription(ivyDescriptor.getDescription());
    state.setPublicationDate(ivyDescriptor.getPublicationDate());
    Map<NamespaceId, String> extraInfo = Cast.uncheckedCast(ivyDescriptor.getExtraInfo());
    state.getExtraInfo().putAll(extraInfo);
    for (ExcludeRule excludeRule : ivyDescriptor.getAllExcludeRules()) {
        addExcludeRule(state, excludeRule);
    }
    return state;
}
Also used : MutableModuleDescriptorState(org.gradle.internal.component.external.descriptor.MutableModuleDescriptorState) DefaultModuleComponentIdentifier(org.gradle.internal.component.external.model.DefaultModuleComponentIdentifier) ModuleComponentIdentifier(org.gradle.api.artifacts.component.ModuleComponentIdentifier) ModuleRevisionId(org.apache.ivy.core.module.id.ModuleRevisionId) NamespaceId(org.gradle.api.internal.artifacts.ivyservice.NamespaceId) ExcludeRule(org.apache.ivy.core.module.descriptor.ExcludeRule)

Aggregations

ModuleComponentIdentifier (org.gradle.api.artifacts.component.ModuleComponentIdentifier)3 NamespaceId (org.gradle.api.internal.artifacts.ivyservice.NamespaceId)3 ModuleRevisionId (org.apache.ivy.core.module.id.ModuleRevisionId)2 DefaultModuleComponentIdentifier (org.gradle.internal.component.external.model.DefaultModuleComponentIdentifier)2 Map (java.util.Map)1 ExcludeRule (org.apache.ivy.core.module.descriptor.ExcludeRule)1 Configuration (org.gradle.internal.component.external.descriptor.Configuration)1 MutableModuleDescriptorState (org.gradle.internal.component.external.descriptor.MutableModuleDescriptorState)1 IvyDependencyDescriptor (org.gradle.internal.component.external.model.ivy.IvyDependencyDescriptor)1 MutableIvyModuleResolveMetadata (org.gradle.internal.component.external.model.ivy.MutableIvyModuleResolveMetadata)1 Exclude (org.gradle.internal.component.model.Exclude)1