Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invoking Ivy Standalone with SCP Resolver plugin causes error #88

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion src/java/fr/jayasoft/ivy/xml/XmlModuleDescriptorParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion src/java/fr/jayasoft/ivy/xml/XmlModuleDescriptorUpdater.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
48 changes: 48 additions & 0 deletions test/java/fr/jayasoft/ivy/ant/IvyDeliverTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
10 changes: 10 additions & 0 deletions test/java/fr/jayasoft/ivy/ant/ivy-latest-branch.xml
Original file line number Diff line number Diff line change
@@ -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>
10 changes: 10 additions & 0 deletions test/java/fr/jayasoft/ivy/ant/ivy-latest-extra.xml
Original file line number Diff line number Diff line change
@@ -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>