use of org.gradle.internal.component.model.IvyArtifactName in project gradle by gradle.
the class IvyModuleDescriptorConverter method forIvyExclude.
private Exclude forIvyExclude(org.apache.ivy.core.module.descriptor.ExcludeRule excludeRule) {
ArtifactId id = excludeRule.getId();
IvyArtifactName artifactExclusion = artifactForIvyExclude(id);
return new DefaultExclude(moduleIdentifierFactory.module(id.getModuleId().getOrganisation(), id.getModuleId().getName()), artifactExclusion, excludeRule.getConfigurations(), excludeRule.getMatcher().getName());
}
use of org.gradle.internal.component.model.IvyArtifactName in project gradle by gradle.
the class GradlePomModuleDescriptorBuilder method doAddDependency.
private void doAddDependency(PomDependencyMgt dep, MavenDependencyType dependencyType) {
MavenScope scope;
if (dependencyType == MavenDependencyType.DEPENDENCY_MANAGEMENT) {
scope = MavenScope.Compile;
} else {
String scopeString = dep.getScope();
if (scopeString == null || scopeString.length() == 0) {
scopeString = getDefaultScope(dep);
}
// unknown scope, defaulting to 'compile'
scope = SCOPES.getOrDefault(scopeString, MavenScope.Compile);
}
String version = determineVersion(dep);
String mappedVersion = convertVersionFromMavenSyntax(version);
ModuleComponentSelector selector = DefaultModuleComponentSelector.newSelector(DefaultModuleIdentifier.newId(dep.getGroupId(), dep.getArtifactId()), new DefaultImmutableVersionConstraint(mappedVersion));
// Example: http://repo2.maven.org/maven2/net/jini/jsk-platform/2.1/jsk-platform-2.1.pom
if (selector.getModuleIdentifier().equals(componentIdentifier.getModuleIdentifier())) {
return;
}
IvyArtifactName dependencyArtifact = null;
boolean hasClassifier = dep.getClassifier() != null && dep.getClassifier().length() > 0;
boolean hasNonJarType = dep.getType() != null && !"jar".equals(dep.getType());
if (hasClassifier || hasNonJarType) {
String type = "jar";
if (dep.getType() != null) {
type = dep.getType();
}
String ext = determineExtension(type);
String classifier = hasClassifier ? dep.getClassifier() : getClassifierForType(type);
dependencyArtifact = new DefaultIvyArtifactName(selector.getModule(), type, ext, classifier);
}
// experimentation shows the following, excluded modules are
// inherited from parent POMs if either of the following is true:
// the <exclusions> element is missing or the <exclusions> element
// is present, but empty.
List<ExcludeMetadata> excludes = Lists.newArrayList();
List<ModuleIdentifier> excluded = dep.getExcludedModules();
if (excluded.isEmpty()) {
excluded = getDependencyMgtExclusions(dep);
}
for (ModuleIdentifier excludedModule : excluded) {
DefaultExclude rule = new DefaultExclude(excludedModule);
excludes.add(rule);
}
dependencies.add(new MavenDependencyDescriptor(scope, dependencyType, selector, dependencyArtifact, excludes));
}
use of org.gradle.internal.component.model.IvyArtifactName in project gradle by gradle.
the class DefaultGradleModuleMetadataSource method listModuleVersions.
@Override
public void listModuleVersions(ModuleDependencyMetadata dependency, ModuleIdentifier module, List<ResourcePattern> ivyPatterns, List<ResourcePattern> artifactPatterns, VersionLister versionLister, BuildableModuleVersionListingResolveResult result) {
if (listVersions) {
// List modules based on metadata files, but only if we won't check for maven-metadata (which is preferred)
IvyArtifactName metaDataArtifact = new DefaultIvyArtifactName(module.getName(), "module", "module");
versionLister.listVersions(module, metaDataArtifact, ivyPatterns, result);
}
}
use of org.gradle.internal.component.model.IvyArtifactName in project gradle by gradle.
the class DefaultIvyDescriptorMetadataSource method listModuleVersions.
@Override
public void listModuleVersions(ModuleDependencyMetadata dependency, ModuleIdentifier module, List<ResourcePattern> ivyPatterns, List<ResourcePattern> artifactPatterns, VersionLister versionLister, BuildableModuleVersionListingResolveResult result) {
// List modules based on metadata files (artifact version is not considered in listVersionsForAllPatterns())
IvyArtifactName metaDataArtifact = metadataArtifactProvider.getMetaDataArtifactName(module.getName());
versionLister.listVersions(module, metaDataArtifact, ivyPatterns, result);
}
use of org.gradle.internal.component.model.IvyArtifactName in project gradle by gradle.
the class ComponentArtifactMetadataSerializer method write.
@Override
public void write(Encoder encoder, ComponentArtifactMetadata value) throws Exception {
if (value instanceof ModuleComponentArtifactMetadata) {
ModuleComponentArtifactMetadata moduleComponentArtifactMetadata = (ModuleComponentArtifactMetadata) value;
componentIdentifierSerializer.write(encoder, moduleComponentArtifactMetadata.getComponentId());
IvyArtifactName ivyArtifactName = moduleComponentArtifactMetadata.getName();
encoder.writeString(ivyArtifactName.getName());
encoder.writeString(ivyArtifactName.getType());
encoder.writeNullableString(ivyArtifactName.getExtension());
encoder.writeNullableString(ivyArtifactName.getClassifier());
} else {
throw new IllegalArgumentException("Unknown artifact metadata type.");
}
}
Aggregations