You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by hi...@apache.org on 2012/04/09 17:16:01 UTC

svn commit: r1311279 - in /ant/ivy/core/branches/2.3.x: ./ CHANGES.txt RELEASE_NOTES src/java/org/apache/ivy/core/resolve/IvyNodeCallers.java

Author: hibou
Date: Mon Apr  9 15:16:00 2012
New Revision: 1311279

URL: http://svn.apache.org/viewvc?rev=1311279&view=rev
Log:
merge of r1311267 and r1311261
=> IVY-1309: a circular dependency is unconclusive about the exclusion of a dependency

Modified:
    ant/ivy/core/branches/2.3.x/   (props changed)
    ant/ivy/core/branches/2.3.x/CHANGES.txt
    ant/ivy/core/branches/2.3.x/RELEASE_NOTES
    ant/ivy/core/branches/2.3.x/src/java/org/apache/ivy/core/resolve/IvyNodeCallers.java

Propchange: ant/ivy/core/branches/2.3.x/
------------------------------------------------------------------------------
  Merged /ant/ivy/core/trunk:r1311261,1311267

Modified: ant/ivy/core/branches/2.3.x/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/branches/2.3.x/CHANGES.txt?rev=1311279&r1=1311278&r2=1311279&view=diff
==============================================================================
--- ant/ivy/core/branches/2.3.x/CHANGES.txt (original)
+++ ant/ivy/core/branches/2.3.x/CHANGES.txt Mon Apr  9 15:16:00 2012
@@ -146,6 +146,7 @@ for detailed view of each issue, please 
 - 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

Modified: ant/ivy/core/branches/2.3.x/RELEASE_NOTES
URL: http://svn.apache.org/viewvc/ant/ivy/core/branches/2.3.x/RELEASE_NOTES?rev=1311279&r1=1311278&r2=1311279&view=diff
==============================================================================
--- ant/ivy/core/branches/2.3.x/RELEASE_NOTES (original)
+++ ant/ivy/core/branches/2.3.x/RELEASE_NOTES Mon Apr  9 15:16:00 2012
@@ -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

Modified: ant/ivy/core/branches/2.3.x/src/java/org/apache/ivy/core/resolve/IvyNodeCallers.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/branches/2.3.x/src/java/org/apache/ivy/core/resolve/IvyNodeCallers.java?rev=1311279&r1=1311278&r2=1311279&view=diff
==============================================================================
--- ant/ivy/core/branches/2.3.x/src/java/org/apache/ivy/core/resolve/IvyNodeCallers.java (original)
+++ ant/ivy/core/branches/2.3.x/src/java/org/apache/ivy/core/resolve/IvyNodeCallers.java Mon Apr  9 15:16:00 2012
@@ -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;
         }
     }