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;
}
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);
}
}
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;
}
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();
}
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);
}
}
Aggregations