incubator-ivy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xav...@apache.org
Subject svn commit: r573324 - in /incubator/ivy/core/trunk: ./ src/java/org/apache/ivy/plugins/resolver/ test/java/org/apache/ivy/core/resolve/ test/repositories/ test/repositories/1/org9/mod9.2/ivys/
Date Thu, 06 Sep 2007 17:07:32 GMT
Author: xavier
Date: Thu Sep  6 10:07:31 2007
New Revision: 573324

URL: http://svn.apache.org/viewvc?rev=573324&view=rev
Log:
FIX: Resolving dynamic version fails when using multiple patterns if only one pattern find
a revision and others don't (IVY-602)

Added:
    incubator/ivy/core/trunk/test/repositories/1/org9/mod9.2/ivys/ivy-1.3.xml   (with props)
    incubator/ivy/core/trunk/test/repositories/ivysettings-IVY602.xml   (with props)
Modified:
    incubator/ivy/core/trunk/CHANGES.txt
    incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResourceResolver.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?rev=573324&r1=573323&r2=573324&view=diff
==============================================================================
--- incubator/ivy/core/trunk/CHANGES.txt (original)
+++ incubator/ivy/core/trunk/CHANGES.txt Thu Sep  6 10:07:31 2007
@@ -53,6 +53,7 @@
 =====================================
 - FIX: NullPointerException whilst resolving transitive dependencies (IVY-590)
 - FIX: cachepath based on a resolve done in a previous build broken (IVY-583)
+- FIX: Resolving dynamic version fails when using multiple patterns if only one pattern find
a revision and others don't (IVY-602)
 
 - IMPROVEMENT: artifactproperty should not overwrite the existing properties (IVY-587)
 - IMPROVEMENT: Support *(private) and *(public) in the confs parameter of the resolve (IVY-588)

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResourceResolver.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResourceResolver.java?rev=573324&r1=573323&r2=573324&view=diff
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResourceResolver.java
(original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResourceResolver.java
Thu Sep  6 10:07:31 2007
@@ -84,14 +84,13 @@
 
     protected ResolvedResource findResourceUsingPatterns(ModuleRevisionId moduleRevision,
             List patternList, Artifact artifact, ResourceMDParser rmdparser, Date date) {
-        ResolvedResource rres = null;
-
         List resolvedResources = new ArrayList();
         boolean dynamic = getSettings().getVersionMatcher().isDynamic(moduleRevision);
         boolean stop = false;
         for (Iterator iter = patternList.iterator(); iter.hasNext() && !stop;) {
             String pattern = (String) iter.next();
-            rres = findResourceUsingPattern(moduleRevision, pattern, artifact, rmdparser,
date);
+            ResolvedResource rres = findResourceUsingPattern(
+                moduleRevision, pattern, artifact, rmdparser, date);
             if (rres != null) {
                 resolvedResources.add(rres);
                 stop = !dynamic; // stop iterating if we are not searching a dynamic revision
@@ -101,11 +100,13 @@
         if (resolvedResources.size() > 1) {
             ResolvedResource[] rress = (ResolvedResource[]) resolvedResources
                     .toArray(new ResolvedResource[resolvedResources.size()]);
-            rres = findResource(rress, getName(), getLatestStrategy(), getSettings()
+            return findResource(rress, getName(), getLatestStrategy(), getSettings()
                     .getVersionMatcher(), rmdparser, moduleRevision, date);
+        } else if (resolvedResources.size() == 1) {
+            return (ResolvedResource) resolvedResources.get(0);
+        } else {
+            return null;
         }
-
-        return rres;
     }
 
     protected abstract ResolvedResource findResourceUsingPattern(ModuleRevisionId mrid,

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?rev=573324&r1=573323&r2=573324&view=diff
==============================================================================
--- 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 Thu Sep
 6 10:07:31 2007
@@ -2211,6 +2211,24 @@
             ModuleRevisionId.newInstance("org1", "mod_released", "1.1")).exists());
     }
 
+    public void testLatestWithMultiplePatterns() throws Exception {
+        // The test verify that latest.integration dependencies can be resolved 
+        // when using a resolver with multiple patterns, when only the first pattern 
+        // finds something - test case for IVY-602
+
+        // mod9.2 depends on latest.integration of mod6.2
+        Ivy ivy = Ivy.newInstance();
+        ivy.configure(new File("test/repositories/ivysettings-IVY602.xml"));
+
+        ResolveReport report = ivy.resolve(new File(
+            "test/repositories/1/org9/mod9.2/ivys/ivy-1.3.xml").toURL(),
+            getResolveOptions(new String[] {"default"}));
+        assertNotNull(report);
+        assertFalse(report.hasError());
+
+        assertTrue(getArchiveFileInCache("org6", "mod6.2", "2.0", "mod6.2", "jar", "jar").exists());
+    }
+
     public void testVersionRange1() throws Exception {
         // mod 1.4 depends on mod1.2 [1.0,2.0[
         ResolveReport report = ivy.resolve(new File(

Added: incubator/ivy/core/trunk/test/repositories/1/org9/mod9.2/ivys/ivy-1.3.xml
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/repositories/1/org9/mod9.2/ivys/ivy-1.3.xml?rev=573324&view=auto
==============================================================================
--- incubator/ivy/core/trunk/test/repositories/1/org9/mod9.2/ivys/ivy-1.3.xml (added)
+++ incubator/ivy/core/trunk/test/repositories/1/org9/mod9.2/ivys/ivy-1.3.xml Thu Sep  6 10:07:31
2007
@@ -0,0 +1,29 @@
+<!--
+   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="1.0">
+	<info organisation="org9"
+	       module="mod9.2"
+	       revision="1.3"
+	       status="integration"
+	       publication="20061026110000"
+	/>
+	<dependencies>
+		<dependency org="org6" name="mod6.2" rev="latest.integration"/>
+	</dependencies>
+</ivy-module>

Propchange: incubator/ivy/core/trunk/test/repositories/1/org9/mod9.2/ivys/ivy-1.3.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/ivy/core/trunk/test/repositories/ivysettings-IVY602.xml
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/repositories/ivysettings-IVY602.xml?rev=573324&view=auto
==============================================================================
--- incubator/ivy/core/trunk/test/repositories/ivysettings-IVY602.xml (added)
+++ incubator/ivy/core/trunk/test/repositories/ivysettings-IVY602.xml Thu Sep  6 10:07:31
2007
@@ -0,0 +1,44 @@
+<!--
+   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>
+	<properties file="${ivy.settings.dir}/ivysettings.properties" />
+	<settings defaultCache="${cache.dir}" defaultResolver="test"/>
+	<resolvers>
+		<chain name="test">
+			<filesystem name="1">
+				<ivy pattern="${ivy.settings.dir}/1/[organisation]/[module]/ivys/ivy-[revision].xml"/>
+				<ivy pattern="${ivy.settings.dir}/1/unusedpattern"/>
+				<artifact pattern="${ivy.settings.dir}/1/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
+			</filesystem>
+			<dual name="2">
+				<filesystem name="2-ivy">
+					<ivy pattern="${ivy.settings.dir}/2/[module]/ivy-[revision].xml"/>
+				</filesystem>
+				<filesystem name="2-artifact">
+					<artifact pattern="${ivy.settings.dir}/2/[module]/[artifact]-[revision].[ext]"/>
+					<artifact pattern="${ivy.settings.dir}/2/[module]/[artifact].[ext]"/>
+				</filesystem>
+			</dual>
+		</chain>
+		<filesystem name="install">
+			<ivy pattern="build/test/install/[organisation]/[module]/[artifact]-[revision].[ext]"/>
+			<artifact pattern="build/test/install/[organisation]/[module]/[artifact]-[revision].[ext]"/>
+		</filesystem>
+	</resolvers>
+</ivysettings>

Propchange: incubator/ivy/core/trunk/test/repositories/ivysettings-IVY602.xml
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message