Search in sources :

Example 11 with DefaultIvyArtifactName

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

the class MutableModuleDescriptorState method createModuleDescriptor.

public static MutableModuleDescriptorState createModuleDescriptor(ModuleComponentIdentifier componentIdentifier, Set<IvyArtifactName> componentArtifacts) {
    MutableModuleDescriptorState moduleDescriptorState = new MutableModuleDescriptorState(componentIdentifier);
    for (IvyArtifactName artifactName : componentArtifacts) {
        moduleDescriptorState.addArtifact(artifactName, Collections.singleton(org.gradle.api.artifacts.Dependency.DEFAULT_CONFIGURATION));
    }
    if (componentArtifacts.isEmpty()) {
        IvyArtifactName defaultArtifact = new DefaultIvyArtifactName(componentIdentifier.getModule(), "jar", "jar");
        moduleDescriptorState.addArtifact(defaultArtifact, Collections.singleton(org.gradle.api.artifacts.Dependency.DEFAULT_CONFIGURATION));
    }
    return moduleDescriptorState;
}
Also used : DefaultIvyArtifactName(org.gradle.internal.component.model.DefaultIvyArtifactName) IvyArtifactName(org.gradle.internal.component.model.IvyArtifactName) DefaultIvyArtifactName(org.gradle.internal.component.model.DefaultIvyArtifactName)

Example 12 with DefaultIvyArtifactName

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

the class DefaultIvyModulePublishMetadata method addArtifacts.

@Override
public void addArtifacts(String configuration, Iterable<? extends PublishArtifact> artifacts) {
    for (PublishArtifact artifact : artifacts) {
        DefaultIvyArtifactName ivyName = DefaultIvyArtifactName.forPublishArtifact(artifact);
        DefaultIvyModuleArtifactPublishMetadata ivyArtifact = getOrCreate(ivyName);
        ivyArtifact.setFile(artifact.getFile());
        ivyArtifact.addConfiguration(configuration);
    }
}
Also used : DefaultIvyArtifactName(org.gradle.internal.component.model.DefaultIvyArtifactName) PublishArtifact(org.gradle.api.artifacts.PublishArtifact)

Example 13 with DefaultIvyArtifactName

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

the class DefaultGradleModuleMetadataSource method create.

@Override
public MutableModuleComponentResolveMetadata create(String repositoryName, ComponentResolvers componentResolvers, ModuleComponentIdentifier moduleComponentIdentifier, ComponentOverrideMetadata prescribedMetaData, ExternalResourceArtifactResolver artifactResolver, BuildableModuleComponentMetaDataResolveResult result) {
    DefaultIvyArtifactName moduleMetadataArtifact = new DefaultIvyArtifactName(moduleComponentIdentifier.getModule(), "module", "module");
    LocallyAvailableExternalResource gradleMetadataArtifact = artifactResolver.resolveArtifact(new DefaultModuleComponentArtifactMetadata(moduleComponentIdentifier, moduleMetadataArtifact), result);
    if (gradleMetadataArtifact != null) {
        MutableModuleComponentResolveMetadata metaDataFromResource = mutableModuleMetadataFactory.create(moduleComponentIdentifier);
        metadataParser.parse(gradleMetadataArtifact, metaDataFromResource);
        return metaDataFromResource;
    }
    return null;
}
Also used : DefaultIvyArtifactName(org.gradle.internal.component.model.DefaultIvyArtifactName) MutableModuleComponentResolveMetadata(org.gradle.internal.component.external.model.MutableModuleComponentResolveMetadata) DefaultModuleComponentArtifactMetadata(org.gradle.internal.component.external.model.DefaultModuleComponentArtifactMetadata) LocallyAvailableExternalResource(org.gradle.internal.resource.local.LocallyAvailableExternalResource)

Example 14 with DefaultIvyArtifactName

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

the class AbstractIvyDependencyDescriptorFactory method convertArtifacts.

protected ImmutableList<IvyArtifactName> convertArtifacts(Set<DependencyArtifact> dependencyArtifacts) {
    ImmutableList.Builder<IvyArtifactName> names = ImmutableList.builder();
    for (DependencyArtifact dependencyArtifact : dependencyArtifacts) {
        DefaultIvyArtifactName name = new DefaultIvyArtifactName(dependencyArtifact.getName(), dependencyArtifact.getType(), getExtension(dependencyArtifact), dependencyArtifact.getClassifier());
        names.add(name);
    }
    return names.build();
}
Also used : DefaultIvyArtifactName(org.gradle.internal.component.model.DefaultIvyArtifactName) DependencyArtifact(org.gradle.api.artifacts.DependencyArtifact) ImmutableList(com.google.common.collect.ImmutableList) IvyArtifactName(org.gradle.internal.component.model.IvyArtifactName) DefaultIvyArtifactName(org.gradle.internal.component.model.DefaultIvyArtifactName)

Example 15 with DefaultIvyArtifactName

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

the class DefaultArtifactPublisher method publish.

public void publish(final Iterable<? extends PublicationAwareRepository> repositories, final Module module, final Configuration configuration, final File descriptor) throws PublishException {
    Set<ConfigurationInternal> allConfigurations = Cast.uncheckedCast(configuration.getAll());
    Set<ConfigurationInternal> configurationsToPublish = Cast.uncheckedCast(configuration.getHierarchy());
    // Will create `ivy.xml` even for Maven publishing! (as long as `Upload.uploadDescriptor == true`)
    if (descriptor != null) {
        // Convert once, in order to write the Ivy descriptor with _all_ configurations
        DefaultIvyModulePublishMetadata publishMetaData = toPublishMetaData(module, allConfigurations, false);
        ivyModuleDescriptorWriter.write(publishMetaData, descriptor);
    }
    // Convert a second time with only the published configurations: this ensures that the correct artifacts are included
    DefaultIvyModulePublishMetadata publishMetaData = toPublishMetaData(module, configurationsToPublish, true);
    if (descriptor != null) {
        IvyArtifactName artifact = new DefaultIvyArtifactName("ivy", "ivy", "xml");
        publishMetaData.addArtifact(artifact, descriptor);
    }
    for (PublicationAwareRepository repository : repositories) {
        ModuleVersionPublisher publisher = repository.createPublisher();
        LOGGER.info("Publishing to {}", publisher);
        publisher.publish(publishMetaData);
    }
}
Also used : DefaultIvyArtifactName(org.gradle.internal.component.model.DefaultIvyArtifactName) DefaultIvyArtifactName(org.gradle.internal.component.model.DefaultIvyArtifactName) IvyArtifactName(org.gradle.internal.component.model.IvyArtifactName) PublicationAwareRepository(org.gradle.api.internal.artifacts.repositories.PublicationAwareRepository) ConfigurationInternal(org.gradle.api.internal.artifacts.configurations.ConfigurationInternal) ModuleVersionPublisher(org.gradle.api.internal.artifacts.ModuleVersionPublisher)

Aggregations

DefaultIvyArtifactName (org.gradle.internal.component.model.DefaultIvyArtifactName)15 IvyArtifactName (org.gradle.internal.component.model.IvyArtifactName)11 DefaultExclude (org.gradle.internal.component.external.descriptor.DefaultExclude)4 ModuleVersionPublisher (org.gradle.api.internal.artifacts.ModuleVersionPublisher)3 Artifact (org.gradle.internal.component.external.descriptor.Artifact)3 Exclude (org.gradle.internal.component.model.Exclude)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 ModuleRevisionId (org.apache.ivy.core.module.id.ModuleRevisionId)2 ModuleIdentifier (org.gradle.api.artifacts.ModuleIdentifier)2 ModuleVersionSelector (org.gradle.api.artifacts.ModuleVersionSelector)2 ModuleComponentIdentifier (org.gradle.api.artifacts.component.ModuleComponentIdentifier)2 ModuleComponentSelector (org.gradle.api.artifacts.component.ModuleComponentSelector)2 DefaultModuleVersionSelector (org.gradle.api.internal.artifacts.DefaultModuleVersionSelector)2 ConfigurationInternal (org.gradle.api.internal.artifacts.configurations.ConfigurationInternal)2 DefaultImmutableVersionConstraint (org.gradle.api.internal.artifacts.dependencies.DefaultImmutableVersionConstraint)2 PublicationAwareRepository (org.gradle.api.internal.artifacts.repositories.PublicationAwareRepository)2 MavenScope (org.gradle.internal.component.external.descriptor.MavenScope)2