You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by ma...@apache.org on 2012/08/30 17:28:26 UTC

svn commit: r1378988 - in /ant/ivy/core/branches/2.3.x: ./ src/java/org/apache/ivy/core/resolve/ test/java/org/apache/ivy/core/resolve/ test/repositories/IVY-1366/ test/repositories/IVY-1366/a/ test/repositories/IVY-1366/a/1/ test/repositories/IVY-1366...

Author: maartenc
Date: Thu Aug 30 15:28:25 2012
New Revision: 1378988

URL: http://svn.apache.org/viewvc?rev=1378988&view=rev
Log:
FIX: Resolve does not deliver all dependent artifacts (IVY-1366) (thanks to Wolfgang Frank) (merged from trunk)

Added:
    ant/ivy/core/branches/2.3.x/test/repositories/IVY-1366/
      - copied from r1378882, ant/ivy/core/trunk/test/repositories/IVY-1366/
    ant/ivy/core/branches/2.3.x/test/repositories/IVY-1366/a/
      - copied from r1378882, ant/ivy/core/trunk/test/repositories/IVY-1366/a/
    ant/ivy/core/branches/2.3.x/test/repositories/IVY-1366/a/1/
      - copied from r1378882, ant/ivy/core/trunk/test/repositories/IVY-1366/a/1/
    ant/ivy/core/branches/2.3.x/test/repositories/IVY-1366/a/1/ivy.xml
      - copied unchanged from r1378882, ant/ivy/core/trunk/test/repositories/IVY-1366/a/1/ivy.xml
    ant/ivy/core/branches/2.3.x/test/repositories/IVY-1366/a/1/jars/
      - copied from r1378882, ant/ivy/core/trunk/test/repositories/IVY-1366/a/1/jars/
    ant/ivy/core/branches/2.3.x/test/repositories/IVY-1366/a/1/jars/a-1.jar
      - copied unchanged from r1378882, ant/ivy/core/trunk/test/repositories/IVY-1366/a/1/jars/a-1.jar
    ant/ivy/core/branches/2.3.x/test/repositories/IVY-1366/b/
      - copied from r1378882, ant/ivy/core/trunk/test/repositories/IVY-1366/b/
    ant/ivy/core/branches/2.3.x/test/repositories/IVY-1366/b/1/
      - copied from r1378882, ant/ivy/core/trunk/test/repositories/IVY-1366/b/1/
    ant/ivy/core/branches/2.3.x/test/repositories/IVY-1366/b/1/ivy.xml
      - copied unchanged from r1378882, ant/ivy/core/trunk/test/repositories/IVY-1366/b/1/ivy.xml
    ant/ivy/core/branches/2.3.x/test/repositories/IVY-1366/b/1/jars/
      - copied from r1378882, ant/ivy/core/trunk/test/repositories/IVY-1366/b/1/jars/
    ant/ivy/core/branches/2.3.x/test/repositories/IVY-1366/b/1/jars/b-1.jar
      - copied unchanged from r1378882, ant/ivy/core/trunk/test/repositories/IVY-1366/b/1/jars/b-1.jar
    ant/ivy/core/branches/2.3.x/test/repositories/IVY-1366/c/
      - copied from r1378882, ant/ivy/core/trunk/test/repositories/IVY-1366/c/
    ant/ivy/core/branches/2.3.x/test/repositories/IVY-1366/c/1/
      - copied from r1378882, ant/ivy/core/trunk/test/repositories/IVY-1366/c/1/
    ant/ivy/core/branches/2.3.x/test/repositories/IVY-1366/c/1/ivy.xml
      - copied unchanged from r1378882, ant/ivy/core/trunk/test/repositories/IVY-1366/c/1/ivy.xml
    ant/ivy/core/branches/2.3.x/test/repositories/IVY-1366/c/1/jars/
      - copied from r1378882, ant/ivy/core/trunk/test/repositories/IVY-1366/c/1/jars/
    ant/ivy/core/branches/2.3.x/test/repositories/IVY-1366/c/1/jars/c-1.jar
      - copied unchanged from r1378882, ant/ivy/core/trunk/test/repositories/IVY-1366/c/1/jars/c-1.jar
    ant/ivy/core/branches/2.3.x/test/repositories/IVY-1366/ivy.xml
      - copied unchanged from r1378882, ant/ivy/core/trunk/test/repositories/IVY-1366/ivy.xml
    ant/ivy/core/branches/2.3.x/test/repositories/IVY-1366/ivysettings.xml
      - copied unchanged from r1378882, ant/ivy/core/trunk/test/repositories/IVY-1366/ivysettings.xml
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/src/java/org/apache/ivy/core/resolve/IvyNode.java
    ant/ivy/core/branches/2.3.x/src/java/org/apache/ivy/core/resolve/ResolveEngine.java
    ant/ivy/core/branches/2.3.x/test/java/org/apache/ivy/core/resolve/ResolveTest.java

Propchange: ant/ivy/core/branches/2.3.x/
------------------------------------------------------------------------------
  Merged /ant/ivy/core/trunk:r1378882

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=1378988&r1=1378987&r2=1378988&view=diff
==============================================================================
--- ant/ivy/core/branches/2.3.x/CHANGES.txt (original)
+++ ant/ivy/core/branches/2.3.x/CHANGES.txt Thu Aug 30 15:28:25 2012
@@ -45,6 +45,7 @@ for detailed view of each issue, please 
 	Gregory Fernandez
 	Danno Ferrin
 	Benjamin Francisoud	
+	Wolfgang Frank
 	Jacob Grydholt Jensen
 	John Gibson
 	Mitch Gitman
@@ -129,6 +130,7 @@ for detailed view of each issue, please 
 	
    2.3.x
 =====================================
+- FIX: Resolve does not deliver all dependent artifacts (IVY-1366) (thanks to Wolfgang Frank)
 - FIX: Ivy descriptors are merged incorrectly when there is an <exclude> element (IVY-1356)
 - FIX: SimpleDateFormat is not thread safe (IVY-1373)
 - FIX: Maven 'hk2-jar' packaging is now supported (IVY-1357)

Modified: ant/ivy/core/branches/2.3.x/src/java/org/apache/ivy/core/resolve/IvyNode.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/branches/2.3.x/src/java/org/apache/ivy/core/resolve/IvyNode.java?rev=1378988&r1=1378987&r2=1378988&view=diff
==============================================================================
--- ant/ivy/core/branches/2.3.x/src/java/org/apache/ivy/core/resolve/IvyNode.java (original)
+++ ant/ivy/core/branches/2.3.x/src/java/org/apache/ivy/core/resolve/IvyNode.java Thu Aug 30 15:28:25 2012
@@ -288,7 +288,7 @@ public class IvyNode implements Comparab
         }
     }
 
-    public Collection getDependencies(String rootModuleConf, String[] confs) {
+    public Collection getDependencies(String rootModuleConf, String[] confs, String requestedConf) {
         if (md == null) {
             throw new IllegalStateException(
                     "impossible to get dependencies when data has not been loaded");
@@ -302,7 +302,7 @@ public class IvyNode implements Comparab
         }
         Collection deps = new HashSet();
         for (int i = 0; i < confs.length; i++) {
-            deps.addAll(getDependencies(rootModuleConf, confs[i], confs[i]));
+            deps.addAll(getDependencies(rootModuleConf, confs[i], requestedConf));
         }
         return deps;
     }

Modified: ant/ivy/core/branches/2.3.x/src/java/org/apache/ivy/core/resolve/ResolveEngine.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/branches/2.3.x/src/java/org/apache/ivy/core/resolve/ResolveEngine.java?rev=1378988&r1=1378987&r2=1378988&view=diff
==============================================================================
--- ant/ivy/core/branches/2.3.x/src/java/org/apache/ivy/core/resolve/ResolveEngine.java (original)
+++ ant/ivy/core/branches/2.3.x/src/java/org/apache/ivy/core/resolve/ResolveEngine.java Thu Aug 30 15:28:25 2012
@@ -1081,7 +1081,8 @@ public class ResolveEngine {
             // In this case we need to compute selected nodes again. 
             Collection deps = ancestor.getNode().getDependencies(
                 node.getRootModuleConf(), 
-                ancestor.getNode().getConfigurations(node.getRootModuleConf()));
+                ancestor.getNode().getConfigurations(node.getRootModuleConf()), 
+                ancestor.getRequestedConf());
             for (Iterator iter = deps.iterator(); iter.hasNext();) {
                 IvyNode dep = (IvyNode) iter.next();
                 if (dep.getModuleId().equals(node.getModuleId())) {
@@ -1096,9 +1097,11 @@ public class ResolveEngine {
              * (otherwise previous block would have been reached). We can compute conflicts based on
              * the parent direct dependencies in current root module conf.
              */
-            Collection parentDepIvyNodes = node.getParent().getNode()
-                        .getDependencies(node.getRootModuleConf(), 
-                            new String[] {node.getParentConf()});
+            VisitNode parent = node.getParent();
+            Collection parentDepIvyNodes = parent.getNode().getDependencies(
+                node.getRootModuleConf(), 
+                parent.getNode().getConfigurations(node.getRootModuleConf()), 
+                parent.getRequestedConf());
             for (Iterator it = parentDepIvyNodes.iterator(); it.hasNext();) {
                 IvyNode parentDep = (IvyNode) it.next();
                 if (parentDep.getModuleId().equals(node.getModuleId())) {

Modified: ant/ivy/core/branches/2.3.x/test/java/org/apache/ivy/core/resolve/ResolveTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/branches/2.3.x/test/java/org/apache/ivy/core/resolve/ResolveTest.java?rev=1378988&r1=1378987&r2=1378988&view=diff
==============================================================================
--- ant/ivy/core/branches/2.3.x/test/java/org/apache/ivy/core/resolve/ResolveTest.java (original)
+++ ant/ivy/core/branches/2.3.x/test/java/org/apache/ivy/core/resolve/ResolveTest.java Thu Aug 30 15:28:25 2012
@@ -110,7 +110,7 @@ public class ResolveTest extends TestCas
         FileUtil.forceDelete(deliverDir);
         FileUtil.forceDelete(workDir);
     }
-
+    
     public void testResolveWithRetainingArtifactName() throws Exception {
         ((DefaultRepositoryCacheManager) ivy.getSettings().getDefaultRepositoryCacheManager())
                 .setArtifactPattern(ivy.substitute("[module]/[originalname].[ext]"));
@@ -3430,6 +3430,21 @@ public class ResolveTest extends TestCas
         assertFalse(modRevIds.contains(ModuleRevisionId.newInstance("junit", "junit", "3.8")));
     }
 
+    public void testIVY1366() throws Exception {
+        Ivy ivy = new Ivy();
+        ivy.configure(new File("test/repositories/IVY-1366/ivysettings.xml"));
+
+        ResolveReport report = ivy.resolve(new File("test/repositories/IVY-1366/ivy.xml"), 
+                new ResolveOptions().setConfs(new String[] {"runtime"}));
+        assertFalse(report.hasError());
+        
+        List artifacts = report.getArtifacts();
+        assertEquals(3, artifacts.size());
+        assertEquals("test#a;1!a.jar", artifacts.get(0).toString());
+        assertEquals("test#c;1!c.jar", artifacts.get(1).toString());
+        assertEquals("test#b;1!b.jar", artifacts.get(2).toString());
+    }
+    
     public void testBadFiles() throws Exception {
         Ivy ivy = new Ivy();
         ivy.configure(new File("test/repositories/badfile/ivysettings.xml"));