You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-commits@incubator.apache.org by ma...@apache.org on 2007/06/20 21:09:18 UTC

svn commit: r549236 - in /incubator/ivy/core/trunk: CHANGES.txt src/java/org/apache/ivy/core/resolve/IvyNode.java test/java/org/apache/ivy/core/resolve/ResolveTest.java

Author: maartenc
Date: Wed Jun 20 14:09:17 2007
New Revision: 549236

URL: http://svn.apache.org/viewvc?view=rev&rev=549236
Log:
Evicted modules report depends on the order of the dependencies (IVY-526)

Modified:
    incubator/ivy/core/trunk/CHANGES.txt
    incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNode.java
    incubator/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java

Modified: incubator/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/CHANGES.txt?view=diff&rev=549236&r1=549235&r2=549236
==============================================================================
--- incubator/ivy/core/trunk/CHANGES.txt (original)
+++ incubator/ivy/core/trunk/CHANGES.txt Wed Jun 20 14:09:17 2007
@@ -57,6 +57,7 @@
 - IMPROVEMENT: Remove @author tags (thanks to Stephane Bailliez)
 - IMPROVEMENT: Remove use of deprecated elements in ivysettings.xml (IVY-505) (with contribution from Jan Materne)
 
+- FIX: Evicted modules report depends on the order of the dependencies (IVY-526)
 - FIX: Ivy does not work on Turkish machines (IVY-65)
 - FIX: Ivy does not handle multiple version dependencies in maven2 poms correctly (IVY-494)
 - FIX: pom parser doesn't necessarily processes all important information (IVY-524)

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNode.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNode.java?view=diff&rev=549236&r1=549235&r2=549236
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNode.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNode.java Wed Jun 20 14:09:17 2007
@@ -181,6 +181,10 @@
      */
     public boolean loadData(String rootModuleConf, IvyNode parent, String parentConf, String conf,
             boolean shouldBePublic) {
+        if (!isRoot() && (data.getReport() != null)) {
+            data.getReport().addDependency(this);
+        }
+
         boolean loaded = false;
         if (!isEvicted(rootModuleConf)
                 && (hasConfigurationsToLoad() || !isRootModuleConfLoaded(rootModuleConf))
@@ -193,7 +197,6 @@
                             + ": check your configuration");
                     problem = new RuntimeException("no resolver found for " + getModuleId()
                             + ": check your configuration");
-                    data.getReport().addDependency(this);
                     return false;
                 }
                 try {
@@ -226,7 +229,6 @@
                                                 + ": check your configuration and make sure revision is part of your pattern");
                                 problem = new RuntimeException(
                                         "impossible to resolve dynamic revision");
-                                data.getReport().addDependency(this);
                                 return false;
                             }
                             IvyNode resolved = data.getNode(module.getId());
@@ -287,7 +289,6 @@
 
                 // still not resolved, report error
                 if (module == null) {
-                    data.getReport().addDependency(this);
                     return false;
                 } else {
                     loaded = true;
@@ -308,7 +309,6 @@
             }
         }
         if (hasProblem()) {
-            data.getReport().addDependency(this);
             return handleConfiguration(loaded, rootModuleConf, parent, parentConf, conf,
                 shouldBePublic)
                     && loaded;
@@ -427,14 +427,12 @@
                                 + ": " + confs[i] + ". It was required from " + parent + " "
                                 + parentConf);
                     }
-                    data.getReport().addDependency(this);
                     return false;
                 } else if (shouldBePublic && !isRoot()
                         && c.getVisibility() != Configuration.Visibility.PUBLIC) {
                     confsToFetch.remove(conf);
                     problem = new RuntimeException("configuration not public in " + this + ": " + c
                             + ". It was required from " + parent + " " + parentConf);
-                    data.getReport().addDependency(this);
                     return false;
                 }
                 if (loaded) {

Modified: incubator/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java?view=diff&rev=549236&r1=549235&r2=549236
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java (original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java Wed Jun 20 14:09:17 2007
@@ -18,6 +18,7 @@
 package org.apache.ivy.core.resolve;
 
 import java.io.File;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Date;
 import java.util.HashSet;
@@ -1067,22 +1068,17 @@
         ResolveReport report = _ivy.resolve(ResolveTest.class.getResource("ivy-225.xml"),
             getResolveOptions(new String[] {"default"}));
 
-        Set revisions = report.getConfigurationReport("default").getModuleRevisionIds();
+        List revisions = new ArrayList(report.getConfigurationReport("default").getModuleRevisionIds());
         assertTrue("number of revisions is not correct", revisions.size() >= 3);
 
-        // verify the first 3 modules against the ones in the ivy file
-        Iterator it = revisions.iterator();
-        ModuleRevisionId revId1 = (ModuleRevisionId) it.next();
-        assertEquals("mod1.2", revId1.getName());
-        assertEquals("1.1", revId1.getRevision());
-
-        ModuleRevisionId revId2 = (ModuleRevisionId) it.next();
-        assertEquals("mod3.2", revId2.getName());
-        assertEquals("1.4", revId2.getRevision());
-
-        ModuleRevisionId revId3 = (ModuleRevisionId) it.next();
-        assertEquals("mod5.1", revId3.getName());
-        assertEquals("4.2", revId3.getRevision());
+        int mod12Index = revisions.indexOf(ModuleRevisionId.newInstance("org1", "mod1.2", "1.1"));
+        int mod32Index = revisions.indexOf(ModuleRevisionId.newInstance("org3", "mod3.2", "1.4"));
+        int mod51Index = revisions.indexOf(ModuleRevisionId.newInstance("org5", "mod5.1", "4.2"));
+
+        // verify the order of the modules in the ivy file
+        assertTrue("[ org1 | mod1.2 | 1.1 ] was not found", mod12Index > -1);
+        assertTrue("[ org1 | mod1.2 | 1.1 ] must come before [ org3 | mod3.2 | 1.4 ]", mod12Index < mod32Index);
+        assertTrue("[ org3 | mod3.2 | 1.4 ] must come before [ org5 | mod5.1 | 4.2 ]", mod32Index < mod51Index);
     }
 
     public void testDisableTransitivityPerConfiguration() throws Exception {