ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maart...@apache.org
Subject svn commit: r720605 - /ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyBuildNumber.java
Date Tue, 25 Nov 2008 21:36:19 GMT
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++) {



Mime
View raw message