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 13:03:18 UTC

svn commit: r1378882 - in /ant/ivy/core/trunk: ./ 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/a/1/jars...

Author: maartenc
Date: Thu Aug 30 11:03:17 2012
New Revision: 1378882

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

Added:
    ant/ivy/core/trunk/test/repositories/IVY-1366/
    ant/ivy/core/trunk/test/repositories/IVY-1366/a/
    ant/ivy/core/trunk/test/repositories/IVY-1366/a/1/
    ant/ivy/core/trunk/test/repositories/IVY-1366/a/1/ivy.xml
    ant/ivy/core/trunk/test/repositories/IVY-1366/a/1/jars/
    ant/ivy/core/trunk/test/repositories/IVY-1366/a/1/jars/a-1.jar
    ant/ivy/core/trunk/test/repositories/IVY-1366/b/
    ant/ivy/core/trunk/test/repositories/IVY-1366/b/1/
    ant/ivy/core/trunk/test/repositories/IVY-1366/b/1/ivy.xml
    ant/ivy/core/trunk/test/repositories/IVY-1366/b/1/jars/
    ant/ivy/core/trunk/test/repositories/IVY-1366/b/1/jars/b-1.jar
    ant/ivy/core/trunk/test/repositories/IVY-1366/c/
    ant/ivy/core/trunk/test/repositories/IVY-1366/c/1/
    ant/ivy/core/trunk/test/repositories/IVY-1366/c/1/ivy.xml
    ant/ivy/core/trunk/test/repositories/IVY-1366/c/1/jars/
    ant/ivy/core/trunk/test/repositories/IVY-1366/c/1/jars/c-1.jar
    ant/ivy/core/trunk/test/repositories/IVY-1366/ivy.xml
    ant/ivy/core/trunk/test/repositories/IVY-1366/ivysettings.xml
Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNode.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=1378882&r1=1378881&r2=1378882&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Thu Aug 30 11:03:17 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
@@ -130,6 +131,7 @@ for detailed view of each issue, please 
 	
    trunk
 =====================================
+- 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/trunk/src/java/org/apache/ivy/core/resolve/IvyNode.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNode.java?rev=1378882&r1=1378881&r2=1378882&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNode.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNode.java Thu Aug 30 11:03:17 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/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java?rev=1378882&r1=1378881&r2=1378882&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java Thu Aug 30 11:03:17 2012
@@ -1084,7 +1084,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())) {
@@ -1099,9 +1100,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/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java?rev=1378882&r1=1378881&r2=1378882&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java Thu Aug 30 11:03:17 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"));

Added: ant/ivy/core/trunk/test/repositories/IVY-1366/a/1/ivy.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/IVY-1366/a/1/ivy.xml?rev=1378882&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/repositories/IVY-1366/a/1/ivy.xml (added)
+++ ant/ivy/core/trunk/test/repositories/IVY-1366/a/1/ivy.xml Thu Aug 30 11:03:17 2012
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.    
+-->
+<ivy-module version="2.0">
+	<info organisation="test" module="a" revision="1" status="release"/>
+	<configurations>
+        <conf name="runtime" extends="requires, compile" transitive="true" />
+        <conf name="requires" />
+        <conf name="compile" />
+    </configurations>
+    <publications>
+		<artifact name="a" type="jar" conf="compile"/>
+	</publications>
+</ivy-module>

Added: ant/ivy/core/trunk/test/repositories/IVY-1366/a/1/jars/a-1.jar
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/IVY-1366/a/1/jars/a-1.jar?rev=1378882&view=auto
==============================================================================
    (empty)

Added: ant/ivy/core/trunk/test/repositories/IVY-1366/b/1/ivy.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/IVY-1366/b/1/ivy.xml?rev=1378882&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/repositories/IVY-1366/b/1/ivy.xml (added)
+++ ant/ivy/core/trunk/test/repositories/IVY-1366/b/1/ivy.xml Thu Aug 30 11:03:17 2012
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.    
+-->
+<ivy-module version="2.0">
+	<info organisation="test" module="b" revision="1" status="release"/>
+	<configurations>
+        <conf name="runtime" extends="requires, compile" transitive="true" />
+        <conf name="requires" />
+        <conf name="compile"/>
+    </configurations>
+    <publications>
+		<artifact name="b" type="jar" conf="compile"/>
+	</publications>
+</ivy-module>

Added: ant/ivy/core/trunk/test/repositories/IVY-1366/b/1/jars/b-1.jar
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/IVY-1366/b/1/jars/b-1.jar?rev=1378882&view=auto
==============================================================================
    (empty)

Added: ant/ivy/core/trunk/test/repositories/IVY-1366/c/1/ivy.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/IVY-1366/c/1/ivy.xml?rev=1378882&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/repositories/IVY-1366/c/1/ivy.xml (added)
+++ ant/ivy/core/trunk/test/repositories/IVY-1366/c/1/ivy.xml Thu Aug 30 11:03:17 2012
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.    
+-->
+<ivy-module version="2.0">
+	<info organisation="test" module="c" revision="1" status="release"/>
+	<configurations>
+        <conf name="runtime" extends="requires, compile" transitive="true" />
+        <conf name="requires" />
+        <conf name="compile"/>
+    </configurations>
+    <publications>
+		<artifact name="c" type="jar" conf="compile"/>
+	</publications>
+	<dependencies>
+		<dependency org="test" name="a" rev="1" conf="requires->#"/>
+		<dependency org="test" name="b" rev="1" conf="requires->#"/>
+	</dependencies>
+</ivy-module>

Added: ant/ivy/core/trunk/test/repositories/IVY-1366/c/1/jars/c-1.jar
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/IVY-1366/c/1/jars/c-1.jar?rev=1378882&view=auto
==============================================================================
    (empty)

Added: ant/ivy/core/trunk/test/repositories/IVY-1366/ivy.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/IVY-1366/ivy.xml?rev=1378882&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/repositories/IVY-1366/ivy.xml (added)
+++ ant/ivy/core/trunk/test/repositories/IVY-1366/ivy.xml Thu Aug 30 11:03:17 2012
@@ -0,0 +1,34 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.    
+-->
+<ivy-module version="2.0">
+<info
+	organisation="test"
+	module="test"/>
+	<configurations>
+		<conf name="runtime" extends="requires, compile" transitive="true"/>
+		<conf name="requires" />
+        <conf name="compile"/>
+	</configurations>
+	<dependencies>
+	   <dependency org="test" name="a" rev="1" conf="requires->#"/>
+	   <dependency org="test" name="c" rev="1" conf="requires->#"/>
+        
+	</dependencies>
+</ivy-module>
+

Added: ant/ivy/core/trunk/test/repositories/IVY-1366/ivysettings.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/IVY-1366/ivysettings.xml?rev=1378882&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/repositories/IVY-1366/ivysettings.xml (added)
+++ ant/ivy/core/trunk/test/repositories/IVY-1366/ivysettings.xml Thu Aug 30 11:03:17 2012
@@ -0,0 +1,27 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.    
+-->
+<ivysettings>
+    <settings defaultResolver="test"/>
+    <resolvers>
+        <filesystem name="test">
+            <ivy pattern="${ivy.settings.dir}/[module]/[revision]/ivy.xml" />
+            <artifact pattern="${ivy.settings.dir}/[module]/[revision]/[type]s/[artifact]-[revision].[ext]" />
+        </filesystem>
+    </resolvers>
+</ivysettings>
\ No newline at end of file