merge of r1311267 and r1311261

=> IVY-1309: a circular dependency is unconclusive about the exclusion of a dependency


git-svn-id: https://svn.apache.org/repos/asf/ant/ivy/core/branches/2.3.x@1311279 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nicolas Lalevee 2012-04-09 15:16:00 +00:00
parent 9107e913eb
commit b3085e5caa
3 changed files with 21 additions and 13 deletions

View File

@ -146,6 +146,7 @@ for detailed view of each issue, please consult http://issues.apache.org/jira/br
- IMPROVEMENT: ivy:retrieve can now convert 'dotted'-organisation names into a directory tree.
- IMPROVEMENT: ivy:retrieve now accepts a nested mapper type.
- FIX: Exclude doesn't work when there is some circular dependencies (IVY-1309)
- FIX: Impossible to get artifacts when data has not been loaded for multiple dynamic revisions (IVY-1333)
- FIX: Ivy didn't properly handle some file: URLs (IVY-1340)
- FIX: fallback mechanism didn't work properly for private configurations

View File

@ -109,6 +109,7 @@ List of changes since Ivy 2.2.0:
- IMPROVEMENT: ivy:retrieve can now convert 'dotted'-organisation names into a directory tree.
- IMPROVEMENT: ivy:retrieve now accepts a nested mapper type.
- FIX: Exclude doesn't work when there is some circular dependencies (IVY-1309)
- FIX: Impossible to get artifacts when data has not been loaded for multiple dynamic revisions (IVY-1333)
- FIX: Ivy didn't properly handle some file: URLs (IVY-1340)
- FIX: fallback mechanism didn't work properly for private configurations

View File

@ -266,48 +266,54 @@ public class IvyNodeCallers {
}
boolean doesCallersExclude(String rootModuleConf, Artifact artifact, Stack callersStack) {
if (callersStack.contains(node.getId())) {
return false;
}
callersStack.push(node.getId());
try {
Caller[] callers = getCallers(rootModuleConf);
if (callers.length == 0) {
return false;
}
boolean allUnconclusive = true;
for (int i = 0; i < callers.length; i++) {
if (!callers[i].canExclude()) {
return false;
}
ModuleDescriptor md = callers[i].getModuleDescriptor();
if (!doesExclude(md, rootModuleConf, callers[i].getCallerConfigurations(),
callers[i].getDependencyDescriptor(), artifact, callersStack)) {
return false;
}
Boolean doesExclude = doesExclude(md, rootModuleConf, callers[i].getCallerConfigurations(),
callers[i].getDependencyDescriptor(), artifact, callersStack);
if (doesExclude != null) {
if (!doesExclude.booleanValue()) {
return false;
}
allUnconclusive = false;
}
}
return true;
return allUnconclusive ? false : true;
} finally {
callersStack.pop();
}
}
private boolean doesExclude(ModuleDescriptor md, String rootModuleConf, String[] moduleConfs,
private Boolean doesExclude(ModuleDescriptor md, String rootModuleConf, String[] moduleConfs,
DependencyDescriptor dd, Artifact artifact, Stack callersStack) {
// artifact is excluded if it match any of the exclude pattern for this dependency...
if (dd != null) {
if (dd.doesExclude(moduleConfs, artifact.getId().getArtifactId())) {
return true;
return Boolean.TRUE;
}
}
if (md.doesExclude(moduleConfs, artifact.getId().getArtifactId())) {
return true;
return Boolean.TRUE;
}
// ... or if it is excluded by all its callers
IvyNode c = node.getData().getNode(md.getModuleRevisionId());
if (c != null) {
return c.doesCallersExclude(rootModuleConf, artifact, callersStack);
if (callersStack.contains(c.getId())) {
// a circular dependency, we cannot be conclusive here
return null;
}
return Boolean.valueOf(c.doesCallersExclude(rootModuleConf, artifact, callersStack));
} else {
return false;
return Boolean.FALSE;
}
}