ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maart...@apache.org
Subject svn commit: r706421 - in /ant/ivy/core/trunk: CHANGES.txt src/java/org/apache/ivy/plugins/resolver/BasicResolver.java test/java/org/apache/ivy/core/resolve/ResolveTest.java test/repositories/extra-attributes/mymodule/task1/1854/ivy.xml
Date Mon, 20 Oct 2008 21:47:16 GMT
Author: maartenc
Date: Mon Oct 20 14:47:15 2008
New Revision: 706421

URL: http://svn.apache.org/viewvc?rev=706421&view=rev
Log:
FIX: Extra Attributes specified in the Dependency's Module Descriptor are not available to
resolvers (IVY-929) (thanks to Scott Hebert)

Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java
    ant/ivy/core/trunk/test/repositories/extra-attributes/mymodule/task1/1854/ivy.xml

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=706421&r1=706420&r2=706421&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Mon Oct 20 14:47:15 2008
@@ -31,6 +31,7 @@
 	Jacob Grydholt Jensen
 	Scott Goldstein
 	Pierre H├Ągnestrand
+	Scott Hebert
 	Tobias Himstedt
 	Ben Hale
 	Peter Hayes
@@ -106,6 +107,7 @@
 - FIX: Unable to resolve snapshot versions depending on xml elements order (IVY-940)
 - FIX: pre-resolve-dependency event doesn't export branch information (IVY-941) (thanks to
Jaroslaw Wypychowski)
 - FIX: cachefileset produces an empty fileset when the cache refers to libs in directories
that only have the root directory in common (IVY-948) (thanks to Chris Wood)
+- FIX: Extra Attributes specified in the Dependency's Module Descriptor are not available
to resolvers (IVY-929) (thanks to Scott Hebert)
 
    2.0.0-rc1
 =====================================

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java?rev=706421&r1=706420&r2=706421&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java Mon Oct
20 14:47:15 2008
@@ -472,23 +472,28 @@
 
     private ModuleRevisionId getRevision(ResolvedResource ivyRef, ModuleRevisionId askedMrid,
             ModuleDescriptor md) throws ParseException {
+        Map allAttributes = new HashMap();
+        allAttributes.putAll(md.getQualifiedExtraAttributes());
+        allAttributes.putAll(askedMrid.getQualifiedExtraAttributes());
+        
         String revision = ivyRef.getRevision();
         if (revision == null) {
             Message.debug("no revision found in reference for " + askedMrid);
             if (getSettings().getVersionMatcher().isDynamic(askedMrid)) {
                 if (md.getModuleRevisionId().getRevision() == null) {
-                    return ModuleRevisionId.newInstance(askedMrid, "working@" + getName());
+                    revision = "working@" + getName();
                 } else {
-                    Message.debug("using  " + askedMrid);
-                    return askedMrid;
+                    Message.debug("using " + askedMrid);
+                    revision = askedMrid.getRevision();
                 }
             } else {
-                Message.debug("using  " + askedMrid);
-                return askedMrid;
+                Message.debug("using " + askedMrid);
+                revision = askedMrid.getRevision();
             }
-        } else {
-            return ModuleRevisionId.newInstance(askedMrid, revision);
         }
+        
+        return ModuleRevisionId.newInstance(askedMrid.getOrganisation(), askedMrid.getName(),
+                    askedMrid.getBranch(), revision, allAttributes);
     }
 
     public ResolvedModuleRevision parse(final ResolvedResource mdRef, DependencyDescriptor
dd,

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=706421&r1=706420&r2=706421&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 Mon Oct 20 14:47:15
2008
@@ -27,6 +27,7 @@
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
@@ -4148,6 +4149,9 @@
         Ivy ivy = new Ivy();
         ivy.configure(new File("test/repositories/extra-attributes/ivysettings.xml"));
         ivy.getSettings().setDefaultCache(cache);
+        
+        FileSystemResolver fResolver = (FileSystemResolver) ivy.getSettings().getDefaultResolver();
+        fResolver.setCheckconsistency(false); // important for testing IVY-929
 
         ResolveReport report = ivy.resolve(ResolveTest.class.getResource("ivy-extra-att.xml"),
             getResolveOptions(ivy.getSettings(), new String[] {"*"}).setValidate(false));
@@ -4156,6 +4160,15 @@
         assertTrue(new File(cache, "apache/mymodule/task1/1854/ivy.xml").exists());
         assertTrue(new File(cache, "apache/mymodule/task1/1854/mymodule-windows.jar").exists());
         assertTrue(new File(cache, "apache/mymodule/task1/1854/mymodule-linux.jar").exists());
+        
+        Set moduleRevisions = report.getConfigurationReport("default").getModuleRevisionIds();
+        assertEquals(1, moduleRevisions.size());
+        ModuleRevisionId resolveModRevId = (ModuleRevisionId) moduleRevisions.iterator().next();
+        assertEquals("apache", resolveModRevId.getOrganisation());
+        assertEquals("mymodule", resolveModRevId.getName());
+        assertEquals("1854", resolveModRevId.getRevision());
+        assertEquals("task1", resolveModRevId.getExtraAttribute("eatt"));
+        assertEquals("another", resolveModRevId.getExtraAttribute("eatt2"));
     }
 
     public void testExtraAttributes2() throws Exception {

Modified: ant/ivy/core/trunk/test/repositories/extra-attributes/mymodule/task1/1854/ivy.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/extra-attributes/mymodule/task1/1854/ivy.xml?rev=706421&r1=706420&r2=706421&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/repositories/extra-attributes/mymodule/task1/1854/ivy.xml (original)
+++ ant/ivy/core/trunk/test/repositories/extra-attributes/mymodule/task1/1854/ivy.xml Mon
Oct 20 14:47:15 2008
@@ -22,6 +22,7 @@
         organisation="apache"
         module="mymodule"
         eatt="task1"
+        eatt2="another"
         revision="1854"
         status="integration">
 	</info>



Mime
View raw message