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 16:38:19 UTC

svn commit: r1311261 - in /ant/ivy/core/trunk: CHANGES.txt src/java/org/apache/ivy/core/resolve/IvyNodeCallers.java

Author: hibou
Date: Mon Apr  9 14:38:19 2012
New Revision: 1311261

URL: http://svn.apache.org/viewvc?rev=1311261&view=rev
Log:
IVY-1309: a circular dependency is unconclusive about the exclusion of a dependency

Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNodeCallers.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=1311261&r1=1311260&r2=1311261&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Mon Apr  9 14:38:19 2012
@@ -46,7 +46,7 @@ for detailed view of each issue, please 
 	Jacob Grydholt Jensen
 	John Gibson
 	Scott Goldstein
-	Pierre Hägnestrand
+	Pierre H�gnestrand
 	Scott Hebert
 	Tobias Himstedt
 	Aaron Hachez
@@ -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
@@ -722,7 +723,7 @@ for detailed view of each issue, please 
 - FIX: IOException during publish causes NullPointerException (IVY-371)
 - FIX: Comments in ivy.xml duplicated (IVY-336) (thanks to Gilles Scokart)
 - FIX: Ivy failure when the ivy.xml file contains non US-ASCII characters (IVY-346) (thanks to Gilles Scokart)
-- FIX: Urlresolver is not possible to use dynamic revisions on nonstandard repository structure (IVY-350) (thanks to Pierre Hägnestrand)
+- FIX: Urlresolver is not possible to use dynamic revisions on nonstandard repository structure (IVY-350) (thanks to Pierre H�gnestrand)
 
 
    version 1.4.1 - 2006-11-09

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNodeCallers.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNodeCallers.java?rev=1311261&r1=1311260&r2=1311261&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNodeCallers.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNodeCallers.java Mon Apr  9 14:38:19 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;
         }
     }