Author: xavier
Date: Wed Mar  7 02:27:11 2007
New Revision: 515516

URL: http://svn.apache.org/viewvc?view=rev&rev=515516
Log:
backport IVY-404 and IVY-415 fixes

Added:
    
incubator/ivy/core/branches/1.4.x/test/java/fr/jayasoft/ivy/ant/ivy-latest-branch.xml
    
incubator/ivy/core/branches/1.4.x/test/java/fr/jayasoft/ivy/ant/ivy-latest-extra.xml
Modified:
    incubator/ivy/core/branches/1.4.x/CHANGES.txt
    
incubator/ivy/core/branches/1.4.x/src/java/fr/jayasoft/ivy/xml/XmlModuleDescriptorParser.java
    
incubator/ivy/core/branches/1.4.x/src/java/fr/jayasoft/ivy/xml/XmlModuleDescriptorUpdater.java
    
incubator/ivy/core/branches/1.4.x/test/java/fr/jayasoft/ivy/ant/IvyDeliverTest.java

Modified: incubator/ivy/core/branches/1.4.x/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/incubator/ivy/core/branches/1.4.x/CHANGES.txt?view=diff&rev=515516&r1=515515&r2=515516
==============================================================================
--- incubator/ivy/core/branches/1.4.x/CHANGES.txt (original)
+++ incubator/ivy/core/branches/1.4.x/CHANGES.txt Wed Mar  7 02:27:11 2007
@@ -5,6 +5,11 @@
                                
 for detailed view of each issue, please consult http://jira.jayasoft.org/
 
+   version 1.4.2 - not yet released
+=====================================
+- FIX: Static revision replacement is not working when delivering an artifact 
with a dependency having extra attributes (IVY-415)
+- FIX: Static revision replacement is not working when delivering an artifact 
with a dependency on a branch (IVY-404)
+
    version 1.4.1 - 2006-11-09
 =====================================
 - IMPROVE: ability to rebuild all dependent projects from a leaf (IVY-101)

Modified: 
incubator/ivy/core/branches/1.4.x/src/java/fr/jayasoft/ivy/xml/XmlModuleDescriptorParser.java
URL: 
http://svn.apache.org/viewvc/incubator/ivy/core/branches/1.4.x/src/java/fr/jayasoft/ivy/xml/XmlModuleDescriptorParser.java?view=diff&rev=515516&r1=515515&r2=515516
==============================================================================
--- 
incubator/ivy/core/branches/1.4.x/src/java/fr/jayasoft/ivy/xml/XmlModuleDescriptorParser.java
 (original)
+++ 
incubator/ivy/core/branches/1.4.x/src/java/fr/jayasoft/ivy/xml/XmlModuleDescriptorParser.java
 Wed Mar  7 02:27:11 2007
@@ -53,6 +53,7 @@
  *
  */
 public class XmlModuleDescriptorParser extends AbstractModuleDescriptorParser {
+    static final String[] DEPENDENCY_REGULAR_ATTRIBUTES = new String[] {"org", 
"name", "branch", "rev", "force", "transitive", "changing", "conf"};
     private static XmlModuleDescriptorParser INSTANCE = new 
XmlModuleDescriptorParser();
     
     public static XmlModuleDescriptorParser getInstance() {
@@ -295,7 +296,7 @@
                 String name = _ivy.substitute(attributes.getValue("name"));
                 String branch = _ivy.substitute(attributes.getValue("branch"));
                 String rev = _ivy.substitute(attributes.getValue("rev"));
-                _dd = new DefaultDependencyDescriptor(_md, 
ModuleRevisionId.newInstance(org, name, branch, rev, 
ExtendableItemHelper.getExtraAttributes(attributes, new String[] {"org", 
"name", "rev", "force", "transitive", "changing", "conf"})), force, changing, 
transitive);
+                _dd = new DefaultDependencyDescriptor(_md, 
ModuleRevisionId.newInstance(org, name, branch, rev, 
ExtendableItemHelper.getExtraAttributes(attributes, 
DEPENDENCY_REGULAR_ATTRIBUTES)), force, changing, transitive);
                 _md.addDependency(_dd);
                 String confs = _ivy.substitute(attributes.getValue("conf"));
                 if (confs != null && confs.length() > 0) {

Modified: 
incubator/ivy/core/branches/1.4.x/src/java/fr/jayasoft/ivy/xml/XmlModuleDescriptorUpdater.java
URL: 
http://svn.apache.org/viewvc/incubator/ivy/core/branches/1.4.x/src/java/fr/jayasoft/ivy/xml/XmlModuleDescriptorUpdater.java?view=diff&rev=515516&r1=515515&r2=515516
==============================================================================
--- 
incubator/ivy/core/branches/1.4.x/src/java/fr/jayasoft/ivy/xml/XmlModuleDescriptorUpdater.java
 (original)
+++ 
incubator/ivy/core/branches/1.4.x/src/java/fr/jayasoft/ivy/xml/XmlModuleDescriptorUpdater.java
 Wed Mar  7 02:27:11 2007
@@ -34,6 +34,7 @@
 import fr.jayasoft.ivy.namespace.Namespace;
 import fr.jayasoft.ivy.util.Message;
 import fr.jayasoft.ivy.util.XMLHelper;
+import fr.jayasoft.ivy.extendable.ExtendableItemHelper;
 
 /**
  * Used to update ivy files. Uses ivy file as source and not ModuleDescriptor 
to preserve
@@ -190,7 +191,7 @@
                         String module = substitute(ivy, 
attributes.getValue("name"));
                         String branch = substitute(ivy, 
attributes.getValue("branch"));
                         String revision = substitute(ivy, 
attributes.getValue("rev"));
-                        ModuleRevisionId localMid = 
ModuleRevisionId.newInstance(org, module, branch, revision);
+                        ModuleRevisionId localMid = 
ModuleRevisionId.newInstance(org, module, branch, revision, 
ExtendableItemHelper.getExtraAttributes(attributes, 
XmlModuleDescriptorParser.DEPENDENCY_REGULAR_ATTRIBUTES));
                         ModuleRevisionId systemMid = ns == null ? 
                                 localMid : 
                                 
ns.getToSystemTransformer().transform(localMid);

Modified: 
incubator/ivy/core/branches/1.4.x/test/java/fr/jayasoft/ivy/ant/IvyDeliverTest.java
URL: 
http://svn.apache.org/viewvc/incubator/ivy/core/branches/1.4.x/test/java/fr/jayasoft/ivy/ant/IvyDeliverTest.java?view=diff&rev=515516&r1=515515&r2=515516
==============================================================================
--- 
incubator/ivy/core/branches/1.4.x/test/java/fr/jayasoft/ivy/ant/IvyDeliverTest.java
 (original)
+++ 
incubator/ivy/core/branches/1.4.x/test/java/fr/jayasoft/ivy/ant/IvyDeliverTest.java
 Wed Mar  7 02:27:11 2007
@@ -5,6 +5,8 @@
  */
 package fr.jayasoft.ivy.ant;
 
+import java.util.Map;
+import java.util.HashMap;
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileReader;
@@ -89,6 +91,52 @@
         DependencyDescriptor[] dds = md.getDependencies();
         assertEquals(1, dds.length);
         assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "2.2"), 
dds[0].getDependencyRevisionId());
+    }
+
+    public void testWithBranch() throws Exception {
+       // test case for IVY-404
+        _project.setProperty("ivy.dep.file", 
"test/java/fr/jayasoft/ivy/ant/ivy-latest-branch.xml");
+        IvyResolve res = new IvyResolve();
+        res.setProject(_project);
+        res.execute();
+        
+        _deliver.setPubrevision("1.2");
+        _deliver.setDeliverpattern("build/test/deliver/ivy-[revision].xml");
+        _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 Ivy(), 
deliveredIvyFile.toURL(), true);
+        assertEquals(ModuleRevisionId.newInstance("apache", "resolve-latest", 
"1.2"), md.getModuleRevisionId());
+        DependencyDescriptor[] dds = md.getDependencies();
+        assertEquals(1, dds.length);
+        assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "TRUNK", 
"2.2"), dds[0].getDependencyRevisionId());
+    }
+
+    public void testWithExtraAttributes() throws Exception {
+       // test case for IVY-415
+        _project.setProperty("ivy.dep.file", 
"test/java/fr/jayasoft/ivy/ant/ivy-latest-extra.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 Ivy(), 
deliveredIvyFile.toURL(), false);
+        assertEquals(ModuleRevisionId.newInstance("apache", "resolve-latest", 
"1.2"), md.getModuleRevisionId());
+        DependencyDescriptor[] dds = md.getDependencies();
+        assertEquals(1, dds.length);
+        Map extraAtt = new HashMap();
+        extraAtt.put("myExtraAtt", "myValue");
+        assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "2.2", 
extraAtt), dds[0].getDependencyRevisionId());
     }
 
     public void testReplaceImportedConfigurations() throws Exception {

Added: 
incubator/ivy/core/branches/1.4.x/test/java/fr/jayasoft/ivy/ant/ivy-latest-branch.xml
URL: 
http://svn.apache.org/viewvc/incubator/ivy/core/branches/1.4.x/test/java/fr/jayasoft/ivy/ant/ivy-latest-branch.xml?view=auto&rev=515516
==============================================================================
--- 
incubator/ivy/core/branches/1.4.x/test/java/fr/jayasoft/ivy/ant/ivy-latest-branch.xml
 (added)
+++ 
incubator/ivy/core/branches/1.4.x/test/java/fr/jayasoft/ivy/ant/ivy-latest-branch.xml
 Wed Mar  7 02:27:11 2007
@@ -0,0 +1,10 @@
+<ivy-module version="1.0"> 
+       <info organisation="apache"
+              module="resolve-latest"
+              revision="1.0"
+              status="release"
+       />
+       <dependencies>
+               <dependency org="org1" name="mod1.2" rev="latest.integration" 
branch="TRUNK" />
+       </dependencies>
+</ivy-module>

Added: 
incubator/ivy/core/branches/1.4.x/test/java/fr/jayasoft/ivy/ant/ivy-latest-extra.xml
URL: 
http://svn.apache.org/viewvc/incubator/ivy/core/branches/1.4.x/test/java/fr/jayasoft/ivy/ant/ivy-latest-extra.xml?view=auto&rev=515516
==============================================================================
--- 
incubator/ivy/core/branches/1.4.x/test/java/fr/jayasoft/ivy/ant/ivy-latest-extra.xml
 (added)
+++ 
incubator/ivy/core/branches/1.4.x/test/java/fr/jayasoft/ivy/ant/ivy-latest-extra.xml
 Wed Mar  7 02:27:11 2007
@@ -0,0 +1,10 @@
+<ivy-module version="1.0"> 
+       <info organisation="apache"
+              module="resolve-latest"
+              revision="1.0"
+              status="release"
+       />
+       <dependencies>
+               <dependency org="org1" name="mod1.2" rev="latest.integration" 
myExtraAtt="myValue" />
+       </dependencies>
+</ivy-module>


Reply via email to