Author: maartenc
Date: Sun Nov 22 22:18:59 2009
New Revision: 883156
URL: http://svn.apache.org/viewvc?rev=883156&view=rev
Log:
FIX: ivy:retrieve sync="true" does nothing if first variable is optional
(IVY-1142) (thanks to Andreas Axelsson)
Modified:
ant/ivy/core/trunk/CHANGES.txt
ant/ivy/core/trunk/src/java/org/apache/ivy/core/IvyPatternHelper.java
ant/ivy/core/trunk/test/java/org/apache/ivy/util/IvyPatternHelperTest.java
Modified: ant/ivy/core/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=883156&r1=883155&r2=883156&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Sun Nov 22 22:18:59 2009
@@ -16,6 +16,7 @@
Ingo Adler
alex322
Mathieu Anquetin
+ Andreas Axelsson
Stephane Bailliez
Karl Baum
Mikkel Bjerg
@@ -98,6 +99,7 @@
- IMPROVEMENT: Trace a message when a property file referenced from the
settings doesn't exixts (IVY-1074)
- IMPROVEMENT: use defaultconf in combination with defaultconfmapping
(IVY-1135) (thanks to Jon Schneider)
+- FIX: ivy:retrieve sync="true" does nothing if first variable is optional
(IVY-1142) (thanks to Andreas Axelsson)
- FIX: Latest Compatible Conflict Manager + Extra Attributes in Dependencies'
IVY files == infinite loop (IVY-956)
- FIX: Resolve with Extra Attributes, Forced Dependencies causes invalid
delivered ivy file (IVY-1079)
- FIX: ResolveEngine.getDependencies does not work using extra attributes
(IVY-1115)
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/IvyPatternHelper.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/IvyPatternHelper.java?rev=883156&r1=883155&r2=883156&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/IvyPatternHelper.java
(original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/IvyPatternHelper.java Sun
Nov 22 22:18:59 2009
@@ -475,6 +475,12 @@
if (index == -1) {
return pattern;
} else {
+ // it could be that pattern is something like
"lib/([optional]/)[module]"
+ // we don't want the '(' in the result
+ int optionalIndex = pattern.indexOf('(');
+ if (optionalIndex >= 0) {
+ index = Math.min(index, optionalIndex);
+ }
return pattern.substring(0, index);
}
}
Modified:
ant/ivy/core/trunk/test/java/org/apache/ivy/util/IvyPatternHelperTest.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/util/IvyPatternHelperTest.java?rev=883156&r1=883155&r2=883156&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/util/IvyPatternHelperTest.java
(original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/util/IvyPatternHelperTest.java
Sun Nov 22 22:18:59 2009
@@ -69,4 +69,13 @@
pattern, "apache", "Test", "1.0", "test", "jar", "jar"));
}
+ public void testTokenRoot() {
+ String pattern = "lib/[type]/[artifact].[ext]";
+ assertEquals("lib/", IvyPatternHelper.getTokenRoot(pattern));
+ }
+
+ public void testTokenRootWithOptionalFirstToken() {
+ String pattern = "lib/([type]/)[artifact].[ext]";
+ assertEquals("lib/", IvyPatternHelper.getTokenRoot(pattern));
+ }
}