diff --git a/CHANGES.txt b/CHANGES.txt
index 8966753fa..78cdc70ee 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -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)
diff --git a/src/java/fr/jayasoft/ivy/xml/XmlModuleDescriptorParser.java b/src/java/fr/jayasoft/ivy/xml/XmlModuleDescriptorParser.java
index 976c7745b..7c0ab50e3 100644
--- a/src/java/fr/jayasoft/ivy/xml/XmlModuleDescriptorParser.java
+++ b/src/java/fr/jayasoft/ivy/xml/XmlModuleDescriptorParser.java
@@ -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 @@ public void startElement(String uri, String localName, String qName, Attributes
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) {
diff --git a/src/java/fr/jayasoft/ivy/xml/XmlModuleDescriptorUpdater.java b/src/java/fr/jayasoft/ivy/xml/XmlModuleDescriptorUpdater.java
index 707c94185..0c1e628af 100644
--- a/src/java/fr/jayasoft/ivy/xml/XmlModuleDescriptorUpdater.java
+++ b/src/java/fr/jayasoft/ivy/xml/XmlModuleDescriptorUpdater.java
@@ -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 @@ public void startElement(String uri, String localName,
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);
diff --git a/test/java/fr/jayasoft/ivy/ant/IvyDeliverTest.java b/test/java/fr/jayasoft/ivy/ant/IvyDeliverTest.java
index 8b2578c79..3ebc94a51 100644
--- a/test/java/fr/jayasoft/ivy/ant/IvyDeliverTest.java
+++ b/test/java/fr/jayasoft/ivy/ant/IvyDeliverTest.java
@@ -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;
@@ -91,6 +93,52 @@ public void testSimple() throws Exception {
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 {
_project.setProperty("ivy.dep.file", "test/java/fr/jayasoft/ivy/ant/ivy-import-confs.xml");
IvyResolve res = new IvyResolve();
diff --git a/test/java/fr/jayasoft/ivy/ant/ivy-latest-branch.xml b/test/java/fr/jayasoft/ivy/ant/ivy-latest-branch.xml
new file mode 100644
index 000000000..69ca0ec6f
--- /dev/null
+++ b/test/java/fr/jayasoft/ivy/ant/ivy-latest-branch.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
diff --git a/test/java/fr/jayasoft/ivy/ant/ivy-latest-extra.xml b/test/java/fr/jayasoft/ivy/ant/ivy-latest-extra.xml
new file mode 100644
index 000000000..837eb6389
--- /dev/null
+++ b/test/java/fr/jayasoft/ivy/ant/ivy-latest-extra.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+