use of org.gradle.internal.component.model.DefaultIvyArtifactName in project gradle by gradle.
the class AbstractIvyDependencyDescriptorFactory method convertArtifacts.
protected List<IvyArtifactName> convertArtifacts(Set<DependencyArtifact> dependencyArtifacts) {
if (dependencyArtifacts.isEmpty()) {
return Collections.emptyList();
}
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 ComponentArtifactMetadataSerializer method read.
@Override
public ComponentArtifactMetadata 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 DefaultModuleComponentArtifactMetadata(componentIdentifier, new DefaultIvyArtifactName(artifactName, type, extension, classifier));
}
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");
DefaultModuleComponentArtifactMetadata artifactId = new DefaultModuleComponentArtifactMetadata(moduleComponentIdentifier, moduleMetadataArtifact);
LocallyAvailableExternalResource gradleMetadataArtifact = artifactResolver.resolveArtifact(artifactId, result);
if (gradleMetadataArtifact != null) {
MutableModuleComponentResolveMetadata metaDataFromResource = mutableModuleMetadataFactory.createForGradleModuleMetadata(moduleComponentIdentifier);
metadataParser.parse(gradleMetadataArtifact, metaDataFromResource);
validateGradleMetadata(metaDataFromResource);
createModuleSources(artifactId, gradleMetadataArtifact, metaDataFromResource);
metadataCompatibilityConverter.process(metaDataFromResource);
return metaDataFromResource;
}
return null;
}
use of org.gradle.internal.component.model.DefaultIvyArtifactName in project gradle by gradle.
the class DefaultArtifactPublisher method publish.
@Override
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);
}
}
use of org.gradle.internal.component.model.DefaultIvyArtifactName in project gradle by gradle.
the class AbstractRealisedModuleResolveMetadataSerializationHelper method readFiles.
protected ImmutableList<? extends ModuleComponentArtifactMetadata> readFiles(Decoder decoder, ModuleComponentIdentifier componentIdentifier) throws IOException {
ImmutableList.Builder<ModuleComponentArtifactMetadata> artifacts = new ImmutableList.Builder<>();
int artifactsCount = decoder.readSmallInt();
for (int i = 0; i < artifactsCount; i++) {
String name = decoder.readString();
String type = decoder.readString();
String extension = decoder.readNullableString();
String classifier = decoder.readNullableString();
String timestamp = decoder.readNullableString();
String version;
ModuleComponentIdentifier cid = componentIdentifier;
if (timestamp != null) {
version = decoder.readString();
cid = new MavenUniqueSnapshotComponentIdentifier(componentIdentifier.getModuleIdentifier(), version, timestamp);
}
boolean alternativeArtifact = decoder.readBoolean();
DefaultIvyArtifactName alternative = null;
if (alternativeArtifact) {
String altName = decoder.readString();
String altType = decoder.readString();
String altExtension = decoder.readNullableString();
String altClassifier = decoder.readNullableString();
alternative = new DefaultIvyArtifactName(altName, altType, altExtension, altClassifier);
}
boolean optional = decoder.readBoolean();
if (optional) {
artifacts.add(new ModuleComponentOptionalArtifactMetadata(cid, new DefaultIvyArtifactName(name, type, extension, classifier)));
} else {
if (alternativeArtifact) {
artifacts.add(new DefaultModuleComponentArtifactMetadata(cid, new DefaultIvyArtifactName(name, type, extension, classifier), new DefaultModuleComponentArtifactMetadata(cid, alternative)));
} else {
artifacts.add(new DefaultModuleComponentArtifactMetadata(cid, new DefaultIvyArtifactName(name, type, extension, classifier)));
}
}
}
int filesCount = decoder.readSmallInt();
for (int i = 0; i < filesCount; i++) {
String fileName = decoder.readString();
String uri = decoder.readString();
artifacts.add(new UrlBackedArtifactMetadata(componentIdentifier, fileName, uri));
}
return artifacts.build();
}
Aggregations