Author: maartenc Date: Wed Sep 3 23:08:00 2008 New Revision: 691877 URL: http://svn.apache.org/viewvc?rev=691877&view=rev Log: FIX: Enable consistent support of the configuration negation operator (IVY-894)
Modified: ant/ivy/core/trunk/CHANGES.txt ant/ivy/core/trunk/src/java/org/apache/ivy/util/ConfigurationUtils.java ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyResolveTest.java Modified: ant/ivy/core/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=691877&r1=691876&r2=691877&view=diff ============================================================================== --- ant/ivy/core/trunk/CHANGES.txt (original) +++ ant/ivy/core/trunk/CHANGES.txt Wed Sep 3 23:08:00 2008 @@ -111,6 +111,7 @@ - IMPROVEMENT: Add a memory cache for the module descriptor that are parsed from the cache (IVY-883) - IMPROVEMENT: Improve performance (IVY-872) +- FIX: Enable consistent support of the configuration negation operator (IVY-894) - FIX: add variable expansion in extra attributes (IVY-798) - FIX: Invalid URL when using dynamic ranges (IVY-885) - FIX: can't use gotoNode with a node which has not been visited yet (IVY-874) Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/ConfigurationUtils.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/ConfigurationUtils.java?rev=691877&r1=691876&r2=691877&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/util/ConfigurationUtils.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/ConfigurationUtils.java Wed Sep 3 23:08:00 2008 @@ -20,6 +20,7 @@ import java.util.Arrays; import java.util.LinkedHashSet; import java.util.Set; +import java.util.Iterator; import org.apache.ivy.core.module.descriptor.Configuration; import org.apache.ivy.core.module.descriptor.ModuleDescriptor; @@ -61,6 +62,7 @@ } Set result = new LinkedHashSet(); + Set excluded = new LinkedHashSet(); for (int i = 0; i < confs.length; i++) { if ("*".equals(confs[i])) { result.addAll(Arrays.asList(md.getConfigurationsNames())); @@ -78,10 +80,15 @@ result.add(all[j].getName()); } } + } else if (confs[i].startsWith("!")) { + excluded.add(confs[i].substring( 1 )); } else { result.add(confs[i]); } } + for (Iterator iter = excluded.iterator(); iter.hasNext();) { + result.remove(iter.next()); + } return (String[]) result.toArray(new String[result.size()]); } Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyResolveTest.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyResolveTest.java?rev=691877&r1=691876&r2=691877&view=diff ============================================================================== --- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyResolveTest.java (original) +++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyResolveTest.java Wed Sep 3 23:08:00 2008 @@ -388,6 +388,17 @@ assertNotNull(project.getReference("ivy.resolved.configurations.ref.testWithResolveId")); } + public void testExcludedConf() throws Exception { + resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-multiconf.xml")); + resolve.setConf("*,!default"); + resolve.execute(); + + assertTrue(getIvyFileInCache( + ModuleRevisionId.newInstance("org1", "mod1.1", "2.0")).exists()); + assertFalse(getIvyFileInCache( + ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists()); + } + public void testResolveWithAbsoluteFile() { // IVY-396 File ivyFile = new File("test/java/org/apache/ivy/ant/ivy-simple.xml");