ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xav...@apache.org
Subject svn commit: r688740 - in /ant/ivy/core/trunk: CHANGES.txt src/java/org/apache/ivy/core/resolve/ResolveEngine.java test/java/org/apache/ivy/ant/IvyDeliverTest.java test/java/org/apache/ivy/ant/ivy-dyn-evicted2.xml
Date Mon, 25 Aug 2008 14:51:27 GMT
Author: xavier
Date: Mon Aug 25 07:51:26 2008
New Revision: 688740

URL: http://svn.apache.org/viewvc?rev=688740&view=rev
Log:
FIX: Deliver delivers the wrong version when a dynamic revision is evicted before being resolved
(IVY-707)

Added:
    ant/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-dyn-evicted2.xml   (with props)
Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyDeliverTest.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=688740&r1=688739&r2=688740&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Mon Aug 25 07:51:26 2008
@@ -108,6 +108,7 @@
 - IMPROVEMENT: Add a memory cache for the module descriptor that are parsed from the cache
(IVY-883)
 - IMPROVEMENT: Improve performance (IVY-872)
 
+- FIX: Deliver delivers the wrong version when a dynamic revision is evicted before being
resolved (IVY-707)
 - FIX: Inconsistency with "multi-project" tutorial (IVY-667)
 - FIX: URLRepository does not allow some valid file scheme uri's (IVY-884)
 - FIX: Incorrect parsing artifactPattern attribute in a sftp resolver (IVY-661) (thanks to
Alexey Kiselev)

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=688740&r1=688739&r2=688740&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 Mon Aug 25
07:51:26 2008
@@ -63,6 +63,7 @@
 import org.apache.ivy.plugins.repository.url.URLResource;
 import org.apache.ivy.plugins.resolver.CacheResolver;
 import org.apache.ivy.plugins.resolver.DependencyResolver;
+import org.apache.ivy.plugins.version.VersionMatcher;
 import org.apache.ivy.util.Message;
 import org.apache.ivy.util.filter.Filter;
 
@@ -608,7 +609,18 @@
         VisitNode parentVisitNode = data.getCurrentVisitNode();
         
         data.setCurrentVisitNode(node);
-        resolveConflict(node, conf);
+        DependencyDescriptor dd = node.getDependencyDescriptor();
+        VersionMatcher versionMatcher = node.getNode().getData().getSettings().getVersionMatcher();
+        if (dd != null 
+                && !(node.getRoot() == node.getParent() 
+                        && versionMatcher.isDynamic(dd.getDependencyRevisionId())))
{
+            /*
+             * we don't resolve conflicts before loading data for direct dependencies on
dynamic
+             * revisions, so that direct dynamic revisions are always resolved, which is
mandatory
+             * for proper replacement of dynamic revisions during 'deliver'
+             */
+            resolveConflict(node, conf);
+        }
 
         if (node.loadData(conf, shouldBePublic)) {
             // we resolve conflict again now that we have all information loaded

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyDeliverTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyDeliverTest.java?rev=688740&r1=688739&r2=688740&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyDeliverTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyDeliverTest.java Mon Aug 25 07:51:26
2008
@@ -302,7 +302,7 @@
         File deliveredIvyFile = new File("build/test/deliver/ivy-1.2.xml");
         assertTrue(deliveredIvyFile.exists()); 
         ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(
-	    new IvySettings(), deliveredIvyFile.toURL(), false);
+        new IvySettings(), deliveredIvyFile.toURL(), false);
         assertEquals(ModuleRevisionId.newInstance("apache", "resolve-latest", "1.2"), 
             md.getModuleRevisionId());
         DependencyDescriptor[] dds = md.getDependencies();
@@ -311,6 +311,33 @@
             dds[0].getDependencyRevisionId());
     }
 
+    public void testWithDynEvicted2() throws Exception {
+        // same as previous but dynamic dependency is placed after the one causing the conflict
+        // test case for IVY-707
+        project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-dyn-evicted2.xml");
+        IvyResolve res = new IvyResolve();
+        res.setValidate(false);
+        res.setProject(project);
+        res.execute();
+        
+        deliver.setPubrevision("1.2");
+        deliver.setDeliverpattern("build/test/deliver/ivy-[revision].xml");
+        deliver.setValidate(false);
+        deliver.execute();
+        
+        // should have done the ivy delivering
+        File deliveredIvyFile = new File("build/test/deliver/ivy-1.2.xml");
+        assertTrue(deliveredIvyFile.exists()); 
+        ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(
+        new IvySettings(), deliveredIvyFile.toURL(), false);
+        assertEquals(ModuleRevisionId.newInstance("apache", "resolve-latest", "1.2"), 
+            md.getModuleRevisionId());
+        DependencyDescriptor[] dds = md.getDependencies();
+        assertEquals(2, dds.length);
+        assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "1.1"), 
+            dds[1].getDependencyRevisionId());
+    }
+
     public void testReplaceImportedConfigurations() throws Exception {
         project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-import-confs.xml");
         IvyResolve res = new IvyResolve();

Added: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-dyn-evicted2.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-dyn-evicted2.xml?rev=688740&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-dyn-evicted2.xml (added)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-dyn-evicted2.xml Mon Aug 25 07:51:26
2008
@@ -0,0 +1,11 @@
+<ivy-module version="1.0"> 
+	<info organisation="apache"
+	       module="resolve-latest"
+	       revision="1.0"
+	       status="release"
+	/>
+	<dependencies>
+		<dependency org="org6" name="mod6.1" rev="2.0" />
+		<dependency org="org1" name="mod1.2" rev="1+" />
+	</dependencies>
+</ivy-module>

Propchange: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-dyn-evicted2.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-dyn-evicted2.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message