From 1488ebc81b57117497862f36dadad123fa369dcb Mon Sep 17 00:00:00 2001 From: Xavier Hanin Date: Sun, 17 Dec 2006 17:02:08 +0000 Subject: [PATCH 1/5] tag 1.4.1 version git-svn-id: https://svn.apache.org/repos/asf/incubator/ivy/tags/1.4.1@488009 13f79535-47bb-0310-9956-ffa450edef68 From 2e90690057aed8157df0451556709fa4f7bbd6f0 Mon Sep 17 00:00:00 2001 From: Xavier Hanin Date: Wed, 24 Jan 2007 18:30:33 +0000 Subject: [PATCH 2/5] move Ivy core to a core directory, and prepare IvyDE structure git-svn-id: https://svn.apache.org/repos/asf/incubator/ivy/core/tags/1.4.1@499509 13f79535-47bb-0310-9956-ffa450edef68 From 037a1d7b1c0163873df02eaa74de645d52770a73 Mon Sep 17 00:00:00 2001 From: Xavier Hanin Date: Wed, 7 Mar 2007 10:09:12 +0000 Subject: [PATCH 3/5] create 1.4.x branch git-svn-id: https://svn.apache.org/repos/asf/incubator/ivy/core/branches/1.4.x@515511 13f79535-47bb-0310-9956-ffa450edef68 From 8e5a9ca890a1eb6f7c665ff477cb72bbd3f4bdb7 Mon Sep 17 00:00:00 2001 From: Xavier Hanin Date: Wed, 7 Mar 2007 10:27:11 +0000 Subject: [PATCH 4/5] backport IVY-404 and IVY-415 fixes git-svn-id: https://svn.apache.org/repos/asf/incubator/ivy/core/branches/1.4.x@515516 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 5 ++ .../ivy/xml/XmlModuleDescriptorParser.java | 3 +- .../ivy/xml/XmlModuleDescriptorUpdater.java | 3 +- .../fr/jayasoft/ivy/ant/IvyDeliverTest.java | 48 +++++++++++++++++++ .../fr/jayasoft/ivy/ant/ivy-latest-branch.xml | 10 ++++ .../fr/jayasoft/ivy/ant/ivy-latest-extra.xml | 10 ++++ 6 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 test/java/fr/jayasoft/ivy/ant/ivy-latest-branch.xml create mode 100644 test/java/fr/jayasoft/ivy/ant/ivy-latest-extra.xml 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 @@ + + + + + + From 8708023f0298629e561c1dd742dd0f4e446ca016 Mon Sep 17 00:00:00 2001 From: Xavier Hanin Date: Sun, 2 Dec 2007 03:16:09 +0000 Subject: [PATCH 5/5] move Ivy codebase to Ant git-svn-id: https://svn.apache.org/repos/asf/ant/ivy/core/branches/1.4.x@600230 13f79535-47bb-0310-9956-ffa450edef68