use of org.gradle.api.internal.artifacts.dependencies.DefaultImmutableVersionConstraint in project gradle by gradle.
the class ModuleComponentSelectorSerializer method readVersionConstraint.
public VersionConstraint readVersionConstraint(Decoder decoder) throws IOException {
String preferred = decoder.readString();
int cpt = decoder.readSmallInt();
List<String> rejects = Lists.newArrayListWithCapacity(cpt);
for (int i = 0; i < cpt; i++) {
rejects.add(decoder.readString());
}
return new DefaultImmutableVersionConstraint(preferred, rejects);
}
use of org.gradle.api.internal.artifacts.dependencies.DefaultImmutableVersionConstraint in project gradle by gradle.
the class GradlePomModuleDescriptorParser method doParsePom.
private void doParsePom(DescriptorParseContext parserSettings, GradlePomModuleDescriptorBuilder mdBuilder, PomReader pomReader) throws IOException, SAXException {
if (pomReader.hasParent()) {
// Is there any other parent properties?
ModuleComponentSelector parentId = DefaultModuleComponentSelector.newSelector(pomReader.getParentGroupId(), pomReader.getParentArtifactId(), new DefaultImmutableVersionConstraint(pomReader.getParentVersion()));
PomReader parentPomReader = parsePomForSelector(parserSettings, parentId, pomReader.getAllPomProperties());
pomReader.setPomParent(parentPomReader);
}
pomReader.resolveGAV();
String groupId = pomReader.getGroupId();
String artifactId = pomReader.getArtifactId();
String version = pomReader.getVersion();
mdBuilder.setModuleRevId(groupId, artifactId, version);
ModuleVersionIdentifier relocation = pomReader.getRelocation();
if (relocation != null) {
if (groupId != null && artifactId != null && artifactId.equals(relocation.getName()) && groupId.equals(relocation.getGroup())) {
LOGGER.error("POM relocation to an other version number is not fully supported in Gradle : {} relocated to {}.", mdBuilder.getComponentIdentifier(), relocation);
LOGGER.warn("Please update your dependency to directly use the correct version '{}'.", relocation);
LOGGER.warn("Resolution will only pick dependencies of the relocated element. Artifacts and other metadata will be ignored.");
PomReader relocatedModule = parsePomForId(parserSettings, DefaultModuleComponentIdentifier.newId(relocation), Maps.<String, String>newHashMap());
addDependencies(mdBuilder, relocatedModule);
} else {
LOGGER.info(mdBuilder.getComponentIdentifier() + " is relocated to " + relocation + ". Please update your dependencies.");
LOGGER.debug("Relocated module will be considered as a dependency");
ModuleComponentSelector selector = DefaultModuleComponentSelector.newSelector(relocation.getGroup(), relocation.getName(), new DefaultMutableVersionConstraint(relocation.getVersion()));
mdBuilder.addDependencyForRelocation(selector);
}
} else {
overrideDependencyMgtsWithImported(parserSettings, pomReader);
addDependencies(mdBuilder, pomReader);
}
}
Aggregations