use of org.gradle.internal.component.model.IvyArtifactName in project gradle by gradle.
the class ExternalResourceResolver method doListModuleVersions.
private void doListModuleVersions(DependencyMetadata dependency, BuildableModuleVersionListingResolveResult result) {
ModuleIdentifier module = moduleIdentifierFactory.module(dependency.getRequested().getGroup(), dependency.getRequested().getName());
Set<String> versions = new LinkedHashSet<String>();
VersionPatternVisitor visitor = versionLister.newVisitor(module, versions, result);
// List modules based on metadata files (artifact version is not considered in listVersionsForAllPatterns())
IvyArtifactName metaDataArtifact = getMetaDataArtifactName(dependency.getRequested().getName());
listVersionsForAllPatterns(ivyPatterns, metaDataArtifact, visitor);
// List modules with missing metadata files
for (IvyArtifactName otherArtifact : getDependencyArtifactNames(dependency.getRequested().getName(), dependency.getArtifacts())) {
listVersionsForAllPatterns(artifactPatterns, otherArtifact, visitor);
}
result.listed(versions);
}
use of org.gradle.internal.component.model.IvyArtifactName in project gradle by gradle.
the class IvyXmlModuleDescriptorWriter method printPublications.
private static void printPublications(Collection<IvyModuleArtifactPublishMetadata> artifacts, SimpleXmlWriter writer) throws IOException {
writer.startElement("publications");
for (IvyModuleArtifactPublishMetadata artifactMetadata : artifacts) {
IvyArtifactName artifact = artifactMetadata.getArtifactName();
writer.startElement("artifact");
writer.attribute("name", artifact.getName());
writer.attribute("type", artifact.getType());
writer.attribute("ext", artifact.getExtension() == null ? "" : artifact.getExtension());
writer.attribute("conf", Joiner.on(",").join(artifactMetadata.getConfigurations()));
if (artifact.getClassifier() != null) {
printExtraAttributes(Collections.singletonMap("m:classifier", artifact.getClassifier()), writer);
}
writer.endElement();
}
writer.endElement();
}
use of org.gradle.internal.component.model.IvyArtifactName in project gradle by gradle.
the class ComponentArtifactIdentifierSerializer method write.
public void write(Encoder encoder, ComponentArtifactIdentifier value) throws Exception {
if (value instanceof DefaultModuleComponentArtifactIdentifier) {
DefaultModuleComponentArtifactIdentifier moduleComponentArtifactIdentifier = (DefaultModuleComponentArtifactIdentifier) value;
componentIdentifierSerializer.write(encoder, moduleComponentArtifactIdentifier.getComponentIdentifier());
IvyArtifactName ivyArtifactName = moduleComponentArtifactIdentifier.getName();
encoder.writeString(ivyArtifactName.getName());
encoder.writeString(ivyArtifactName.getType());
encoder.writeNullableString(ivyArtifactName.getExtension());
encoder.writeNullableString(ivyArtifactName.getClassifier());
} else {
throw new IllegalArgumentException("Unknown identifier type.");
}
}
use of org.gradle.internal.component.model.IvyArtifactName in project gradle by gradle.
the class IvyModuleDescriptorConverter method addDependency.
private void addDependency(List<IvyDependencyMetadata> result, DependencyDescriptor dependencyDescriptor) {
ModuleRevisionId revisionId = dependencyDescriptor.getDependencyRevisionId();
ModuleVersionSelector requested = DefaultModuleVersionSelector.newSelector(revisionId.getOrganisation(), revisionId.getName(), revisionId.getRevision());
ListMultimap<String, String> configMappings = ArrayListMultimap.create();
for (Map.Entry<String, List<String>> entry : readConfigMappings(dependencyDescriptor).entrySet()) {
configMappings.putAll(entry.getKey(), entry.getValue());
}
List<Artifact> artifacts = Lists.newArrayList();
for (DependencyArtifactDescriptor ivyArtifact : dependencyDescriptor.getAllDependencyArtifacts()) {
IvyArtifactName ivyArtifactName = new DefaultIvyArtifactName(ivyArtifact.getName(), ivyArtifact.getType(), ivyArtifact.getExt(), (String) ivyArtifact.getExtraAttributes().get(CLASSIFIER));
artifacts.add(new Artifact(ivyArtifactName, Sets.newHashSet(ivyArtifact.getConfigurations())));
}
List<Exclude> excludes = Lists.newArrayList();
for (ExcludeRule excludeRule : dependencyDescriptor.getAllExcludeRules()) {
excludes.add(forIvyExclude(excludeRule));
}
result.add(new IvyDependencyMetadata(requested, dependencyDescriptor.getDynamicConstraintDependencyRevisionId().getRevision(), false, dependencyDescriptor.isChanging(), dependencyDescriptor.isTransitive(), configMappings, artifacts, excludes));
}
use of org.gradle.internal.component.model.IvyArtifactName in project gradle by gradle.
the class DefaultArtifactSet method toResolvedVariant.
private static ResolvedVariant toResolvedVariant(VariantResolveMetadata variant, ModuleVersionIdentifier ownerId, ModuleSource moduleSource, ModuleExclusion exclusions, ArtifactResolver artifactResolver, Map<ComponentArtifactIdentifier, ResolvableArtifact> allResolvedArtifacts, ArtifactTypeRegistry artifactTypeRegistry) {
List<? extends ComponentArtifactMetadata> artifacts = variant.getArtifacts();
ImmutableSet.Builder<ResolvableArtifact> resolvedArtifacts = ImmutableSet.builder();
// Apply any artifact type mappings to the attributes of the variant
ImmutableAttributes attributes = artifactTypeRegistry.mapAttributesFor(variant);
for (ComponentArtifactMetadata artifact : artifacts) {
IvyArtifactName artifactName = artifact.getName();
if (exclusions.excludeArtifact(ownerId.getModule(), artifactName)) {
continue;
}
ResolvableArtifact resolvedArtifact = allResolvedArtifacts.get(artifact.getId());
if (resolvedArtifact == null) {
Factory<File> artifactSource = new LazyArtifactSource(artifact, moduleSource, artifactResolver);
resolvedArtifact = new DefaultResolvedArtifact(ownerId, artifactName, artifact.getId(), artifact.getBuildDependencies(), artifactSource);
allResolvedArtifacts.put(artifact.getId(), resolvedArtifact);
}
resolvedArtifacts.add(resolvedArtifact);
}
return ArtifactBackedResolvedVariant.create(variant.asDescribable(), attributes, resolvedArtifacts.build());
}
Aggregations