Search in sources :

Example 6 with ModuleComponentIdentifier

use of org.gradle.api.artifacts.component.ModuleComponentIdentifier in project gradle by gradle.

the class ComponentArtifactIdentifierSerializer method read.

public DefaultModuleComponentArtifactIdentifier read(Decoder decoder) throws Exception {
    ModuleComponentIdentifier componentIdentifier = (ModuleComponentIdentifier) componentIdentifierSerializer.read(decoder);
    String artifactName = decoder.readString();
    String type = decoder.readString();
    String extension = decoder.readNullableString();
    String classifier = decoder.readNullableString();
    return new DefaultModuleComponentArtifactIdentifier(componentIdentifier, artifactName, type, extension, classifier);
}
Also used : DefaultModuleComponentArtifactIdentifier(org.gradle.internal.component.external.model.DefaultModuleComponentArtifactIdentifier) ModuleComponentIdentifier(org.gradle.api.artifacts.component.ModuleComponentIdentifier)

Example 7 with ModuleComponentIdentifier

use of org.gradle.api.artifacts.component.ModuleComponentIdentifier in project gradle by gradle.

the class IvyModuleResolveMetaDataBuilder method build.

public MutableIvyModuleResolveMetadata build() {
    ModuleRevisionId moduleRevisionId = ivyDescriptor.getModuleRevisionId();
    ModuleComponentIdentifier cid = DefaultModuleComponentIdentifier.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.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.MutableIvyModuleResolveMetadata)

Example 8 with ModuleComponentIdentifier

use of org.gradle.api.artifacts.component.ModuleComponentIdentifier in project gradle by gradle.

the class DefaultIvyModuleDescriptorWriter method printInfoTag.

private static void printInfoTag(IvyModulePublishMetadata metadata, SimpleXmlWriter writer) throws IOException {
    ModuleComponentIdentifier id = metadata.getComponentId();
    writer.startElement("info");
    writer.attribute("organisation", id.getGroup());
    writer.attribute("module", id.getModule());
    writer.attribute("revision", id.getVersion());
    writer.attribute("status", metadata.getStatus());
    printUnusedContent(metadata, writer);
    writer.endElement();
}
Also used : ModuleComponentIdentifier(org.gradle.api.artifacts.component.ModuleComponentIdentifier)

Example 9 with ModuleComponentIdentifier

use of org.gradle.api.artifacts.component.ModuleComponentIdentifier in project gradle by gradle.

the class DefaultIdeDependencyResolver method getIdeRepoFileDependencies.

public List<IdeExtendedRepoFileDependency> getIdeRepoFileDependencies(Configuration configuration) {
    Set<ResolvedArtifactResult> artifacts = configuration.getIncoming().artifactView(new Action<ArtifactView.ViewConfiguration>() {

        @Override
        public void execute(ArtifactView.ViewConfiguration viewConfiguration) {
            viewConfiguration.lenient(true);
            viewConfiguration.componentFilter(IS_A_MODULE_ID);
        }
    }).getArtifacts().getArtifacts();
    List<IdeExtendedRepoFileDependency> externalDependencies = new ArrayList<IdeExtendedRepoFileDependency>(artifacts.size());
    for (ResolvedArtifactResult artifact : artifacts) {
        ModuleComponentIdentifier moduleId = (ModuleComponentIdentifier) artifact.getId().getComponentIdentifier();
        IdeExtendedRepoFileDependency ideRepoFileDependency = new IdeExtendedRepoFileDependency();
        ideRepoFileDependency.setId(new DefaultModuleVersionIdentifier(moduleId.getGroup(), moduleId.getModule(), moduleId.getVersion()));
        externalDependencies.add(ideRepoFileDependency);
    }
    return externalDependencies;
}
Also used : DefaultModuleVersionIdentifier(org.gradle.api.internal.artifacts.DefaultModuleVersionIdentifier) IdeExtendedRepoFileDependency(org.gradle.plugins.ide.internal.resolver.model.IdeExtendedRepoFileDependency) ArrayList(java.util.ArrayList) ModuleComponentIdentifier(org.gradle.api.artifacts.component.ModuleComponentIdentifier) ResolvedArtifactResult(org.gradle.api.artifacts.result.ResolvedArtifactResult) ArtifactView(org.gradle.api.artifacts.ArtifactView)

Example 10 with ModuleComponentIdentifier

use of org.gradle.api.artifacts.component.ModuleComponentIdentifier in project gradle by gradle.

the class DependencyResolverIvyPublisher method publish.

public void publish(IvyNormalizedPublication publication, PublicationAwareRepository repository) {
    ModuleVersionPublisher publisher = repository.createPublisher();
    IvyPublicationIdentity projectIdentity = publication.getProjectIdentity();
    ModuleComponentIdentifier moduleVersionIdentifier = DefaultModuleComponentIdentifier.newId(projectIdentity.getOrganisation(), projectIdentity.getModule(), projectIdentity.getRevision());
    // Use the legacy metadata type so that we can leverage `ModuleVersionPublisher.publish()`
    DefaultIvyModulePublishMetadata publishMetaData = new DefaultIvyModulePublishMetadata(moduleVersionIdentifier, "");
    for (IvyArtifact publishArtifact : publication.getArtifacts()) {
        publishMetaData.addArtifact(createIvyArtifact(publishArtifact), publishArtifact.getFile());
    }
    IvyArtifactName ivyDescriptor = new DefaultIvyArtifactName("ivy", "ivy", "xml");
    publishMetaData.addArtifact(ivyDescriptor, publication.getIvyDescriptorFile());
    File gradleModuleDescriptorFile = publication.getGradleModuleDescriptorFile();
    if (gradleModuleDescriptorFile != null && gradleModuleDescriptorFile.exists()) {
        // may not exist if experimental features are disabled
        IvyArtifactName gradleDescriptor = new DefaultIvyArtifactName(projectIdentity.getModule(), "json", "module");
        publishMetaData.addArtifact(gradleDescriptor, gradleModuleDescriptorFile);
    }
    publisher.publish(publishMetaData);
}
Also used : DefaultIvyModulePublishMetadata(org.gradle.internal.component.external.ivypublish.DefaultIvyModulePublishMetadata) DefaultIvyArtifactName(org.gradle.internal.component.model.DefaultIvyArtifactName) ModuleComponentIdentifier(org.gradle.api.artifacts.component.ModuleComponentIdentifier) DefaultModuleComponentIdentifier(org.gradle.internal.component.external.model.DefaultModuleComponentIdentifier) IvyArtifactName(org.gradle.internal.component.model.IvyArtifactName) DefaultIvyArtifactName(org.gradle.internal.component.model.DefaultIvyArtifactName) IvyArtifact(org.gradle.api.publish.ivy.IvyArtifact) File(java.io.File) ModuleVersionPublisher(org.gradle.api.internal.artifacts.ModuleVersionPublisher)

Aggregations

ModuleComponentIdentifier (org.gradle.api.artifacts.component.ModuleComponentIdentifier)20 DefaultModuleComponentIdentifier (org.gradle.internal.component.external.model.DefaultModuleComponentIdentifier)9 NamespaceId (org.gradle.api.internal.artifacts.ivyservice.NamespaceId)3 ModuleRevisionId (org.apache.ivy.core.module.id.ModuleRevisionId)2 ComponentSelection (org.gradle.api.artifacts.ComponentSelection)2 ComponentSelector (org.gradle.api.artifacts.component.ComponentSelector)2 ModuleComponentSelector (org.gradle.api.artifacts.component.ModuleComponentSelector)2 DefaultComponentSelection (org.gradle.api.internal.artifacts.DefaultComponentSelection)2 VersionSelector (org.gradle.api.internal.artifacts.ivyservice.ivyresolve.strategy.VersionSelector)2 MutableMavenModuleResolveMetadata (org.gradle.internal.component.external.model.MutableMavenModuleResolveMetadata)2 DefaultIvyArtifactName (org.gradle.internal.component.model.DefaultIvyArtifactName)2 IvyArtifactName (org.gradle.internal.component.model.IvyArtifactName)2 SpecRuleAction (org.gradle.internal.rules.SpecRuleAction)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 ExcludeRule (org.apache.ivy.core.module.descriptor.ExcludeRule)1 ArtifactView (org.gradle.api.artifacts.ArtifactView)1 ModuleVersionIdentifier (org.gradle.api.artifacts.ModuleVersionIdentifier)1 ModuleVersionSelector (org.gradle.api.artifacts.ModuleVersionSelector)1