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