You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by ma...@apache.org on 2008/11/25 22:36:19 UTC

svn commit: r720605 - /ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyBuildNumber.java

Author: maartenc
Date: Tue Nov 25 13:36:19 2008
New Revision: 720605

URL: http://svn.apache.org/viewvc?rev=720605&view=rev
Log:
Use exact matcher for organisation, module and branch to avoid unnecessary listing (and support ibiblio resolver which doesn't list organisations/modules)

Modified:
    ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyBuildNumber.java

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyBuildNumber.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyBuildNumber.java?rev=720605&r1=720604&r2=720605&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyBuildNumber.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyBuildNumber.java Tue Nov 25 13:36:19 2008
@@ -28,7 +28,11 @@
 import org.apache.ivy.core.settings.IvySettings;
 import org.apache.ivy.plugins.latest.ArtifactInfo;
 import org.apache.ivy.plugins.latest.LatestStrategy;
+import org.apache.ivy.plugins.matcher.ExactOrRegexpPatternMatcher;
+import org.apache.ivy.plugins.matcher.ExactPatternMatcher;
+import org.apache.ivy.plugins.matcher.Matcher;
 import org.apache.ivy.plugins.matcher.PatternMatcher;
+import org.apache.ivy.plugins.matcher.RegexpPatternMatcher;
 import org.apache.ivy.plugins.version.VersionMatcher;
 import org.apache.tools.ant.BuildException;
 
@@ -144,10 +148,25 @@
             prefix = prefix + ".";
         }
         
-        
         SearchEngine searcher = new SearchEngine(settings);
         ModuleRevisionId[] revisions = searcher.listModules(ModuleRevisionId.newInstance(organisation,
-            module, branch, ".*"), settings.getMatcher(PatternMatcher.EXACT_OR_REGEXP));
+            module, branch, ".*"), new PatternMatcher() {
+                private PatternMatcher exact = new ExactPatternMatcher();
+                private PatternMatcher regexp = new ExactOrRegexpPatternMatcher();
+            
+                public Matcher getMatcher(String expression) {
+                    if ((expression == organisation)
+                            || (expression == module)
+                            || (expression == branch)) {
+                        return exact.getMatcher(expression);
+                    }
+                    return regexp.getMatcher(expression);
+                }
+
+                public String getName() {
+                    return "buildnumber-matcher";
+                }
+            });
         
         ArtifactInfo[] infos = new ArtifactInfo[revisions.length];
         for (int i = 0; i < revisions.length; i++) {