You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by "Greg Burcher (JIRA)" <ji...@apache.org> on 2010/12/22 17:43:01 UTC
[jira] Created: (IVY-1256) Create a StrictConflictManager that
supports the force attribute
Create a StrictConflictManager that supports the force attribute
----------------------------------------------------------------
Key: IVY-1256
URL: https://issues.apache.org/jira/browse/IVY-1256
Project: Ivy
Issue Type: Improvement
Components: Core
Reporter: Greg Burcher
Priority: Minor
Neither StrictConflictManager nor LatestCompatibleConflictManager appear to respect the 'force="true" attribute value on dependency. We would like to have the behavior of StrictConflictManager with the enhancement that it would recognize the dependency force attribute as an
override to strict conflict resolution. This appears to be fairly easy to code by extending StrictConflictManager something like this:
/**
* Extends the built-in StrictConflictManager to allow use of the force="true" attribute on individual dependencies.
*/
public class StrictWithForceConflictManager extends StrictConflictManager {
public StrictWithForceConflictManager() {
}
@SuppressWarnings("unchecked")
@Override
public Collection resolveConflicts(IvyNode parent, Collection conflicts) {
if (conflicts.size() < 2) {
return conflicts;
}
Collection<IvyNode> conflictNodes = conflicts;
/*
* First check for root level force dependency only.
*/
DependencyDescriptor[] rootDescriptors = parent.getRoot().getDescriptor().getDependencies();
for (IvyNode node : conflictNodes) {
for (DependencyDescriptor dd : rootDescriptors) {
if (dd.isForce() && dd.getDependencyRevisionId().equals(node.getResolvedId())) {
return Collections.singleton(node);
}
}
}
/*
* No root level force dependency.
* Resolve any conflicts with a force attribute visible within the current parent node.
* The following two blocks of code copied from LatestConflictManager.
*/
for (IvyNode node : conflictNodes) {
DependencyDescriptor dd = node.getDependencyDescriptor(parent);
if (dd != null && dd.isForce() && parent.getResolvedId().equals(dd.getParentRevisionId())) {
return Collections.singleton(node);
}
}
/*
* Not resolvable via force within the current parent node.
* If the list of conflicts contains dynamic revisions, delay the conflict resolution.
*/
for (IvyNode node : conflictNodes) {
ModuleRevisionId modRev = node.getResolvedId();
if (getSettings().getVersionMatcher().isDynamic(modRev)) {
return null;
}
}
return super.resolveConflicts(parent, conflicts);
}
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.