ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maart...@apache.org
Subject svn commit: r605343 - in /ant/ivy/core/trunk: CHANGES.txt src/java/org/apache/ivy/plugins/resolver/AbstractResourceResolver.java test/java/org/apache/ivy/plugins/resolver/FileSystemResolverTest.java
Date Tue, 18 Dec 2007 22:20:58 GMT
Author: maartenc
Date: Tue Dec 18 14:20:56 2007
New Revision: 605343

URL: http://svn.apache.org/viewvc?rev=605343&view=rev
Log:
FIX: Ivy doesn't respect the order of the ivy patterns as defined in the settings (IVY-676)

Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResourceResolver.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/FileSystemResolverTest.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=605343&r1=605342&r2=605343&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Tue Dec 18 14:20:56 2007
@@ -61,6 +61,7 @@
 
 - IMPROVEMENT: Decrease memory footprint (IVY-662)
 
+- FIX: Ivy doesn't respect the order of the ivy patterns as defined in the settings (IVY-676)
 - FIX: XmlModuleDescriptorWriter doesn't write the deprecated attribute of the "ivy-module/configurations/conf"
element (IVY-664)
 - FIX: XMLModuleDescriptorWriter does not write extra attributes (IVY-471) (with contribution
from Mikkel Bjerg)
 - FIX: latest compatible conflict manager fails with circular dependencies and dynamic revision
(IVY-663)

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResourceResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResourceResolver.java?rev=605343&r1=605342&r2=605343&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResourceResolver.java
(original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResourceResolver.java
Tue Dec 18 14:20:56 2007
@@ -27,6 +27,7 @@
 import java.util.List;
 import java.util.ListIterator;
 import java.util.Map;
+import java.util.Set;
 
 import org.apache.ivy.core.IvyContext;
 import org.apache.ivy.core.IvyPatternHelper;
@@ -88,13 +89,16 @@
     protected ResolvedResource findResourceUsingPatterns(ModuleRevisionId moduleRevision,
             List patternList, Artifact artifact, ResourceMDParser rmdparser, Date date) {
         List resolvedResources = new ArrayList();
+        Set foundRevisions = new HashSet();
         boolean dynamic = getSettings().getVersionMatcher().isDynamic(moduleRevision);
         boolean stop = false;
         for (Iterator iter = patternList.iterator(); iter.hasNext() && !stop;) {
             String pattern = (String) iter.next();
             ResolvedResource rres = findResourceUsingPattern(
                 moduleRevision, pattern, artifact, rmdparser, date);
-            if (rres != null) {
+            if ((rres != null) && !foundRevisions.contains(rres.getRevision())) {
+                // only add the first found ResolvedResource for each revision
+                foundRevisions.add(rres.getRevision());
                 resolvedResources.add(rres);
                 stop = !dynamic; // stop iterating if we are not searching a dynamic revision
             }

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/FileSystemResolverTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/FileSystemResolverTest.java?rev=605343&r1=605342&r2=605343&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/FileSystemResolverTest.java
(original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/FileSystemResolverTest.java
Tue Dec 18 14:20:56 2007
@@ -46,6 +46,7 @@
 import org.apache.ivy.core.sort.SortEngine;
 import org.apache.ivy.plugins.latest.LatestRevisionStrategy;
 import org.apache.ivy.plugins.latest.LatestTimeStrategy;
+import org.apache.ivy.plugins.resolver.util.ResolvedResource;
 import org.apache.ivy.util.CacheCleaner;
 import org.apache.ivy.util.FileUtil;
 
@@ -147,6 +148,23 @@
 
         assertEquals(artifact, ar.getArtifact());
         assertEquals(DownloadStatus.NO, ar.getDownloadStatus());
+    }
+    
+    public void testFindIvyFileRefWithMultipleIvyPatterns() throws Exception {
+        // cfr IVY-676
+        FileSystemResolver resolver = new FileSystemResolver();
+        resolver.setName("test");
+        resolver.setSettings(settings);
+        resolver.addIvyPattern("test/repositories/multi-ivypattern/ivy1/ivy-[revision].xml");
+        resolver.addIvyPattern("test/repositories/multi-ivypattern/ivy2/ivy-[revision].xml");
+        
+        ModuleRevisionId mrid = ModuleRevisionId.newInstance("org1", "mod1.1", "1.0+");
+        ResolvedResource ivyRef = resolver.findIvyFileRef(
+            new DefaultDependencyDescriptor(mrid, false), data);
+        
+        // check that the found ivy file is the one from the first pattern!
+        assertEquals("test/repositories/multi-ivypattern/ivy1/ivy-1.0.xml", 
+            ivyRef.getResource().getName().replace('\\', '/'));
     }
 
     private DownloadOptions getDownloadOptions(boolean useOrigin) {



Mime
View raw message