ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maart...@apache.org
Subject svn commit: r885611 - in /ant/ivy/core/trunk: CHANGES.txt src/java/org/apache/ivy/ant/IvyListModules.java
Date Mon, 30 Nov 2009 23:03:21 GMT
Author: maartenc
Date: Mon Nov 30 23:03:21 2009
New Revision: 885611

URL: http://svn.apache.org/viewvc?rev=885611&view=rev
Log:
IMPROVEMENT: resolver attribute for ivy:listmodules task (IVY-1057)

Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyListModules.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=885611&r1=885610&r2=885611&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Mon Nov 30 23:03:21 2009
@@ -95,6 +95,7 @@
 	
    trunk
 =====================================
+- IMPROVEMENT: resolver attribute for listmodules task (IVY-1057)
 - IMPROVEMENT: discover 'src' sources in maven repos (IVY-1138)
 - 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)

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyListModules.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyListModules.java?rev=885611&r1=885610&r2=885611&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyListModules.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyListModules.java Mon Nov 30 23:03:21
2009
@@ -20,8 +20,10 @@
 import org.apache.ivy.Ivy;
 import org.apache.ivy.core.IvyPatternHelper;
 import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.core.search.SearchEngine;
 import org.apache.ivy.core.settings.IvySettings;
 import org.apache.ivy.plugins.matcher.PatternMatcher;
+import org.apache.ivy.plugins.resolver.DependencyResolver;
 import org.apache.tools.ant.BuildException;
 
 /**
@@ -42,6 +44,8 @@
     private String property;
 
     private String value;
+    
+    private String resolver;
 
     public String getMatcher() {
         return matcher;
@@ -98,6 +102,14 @@
     public void setBranch(String branch) {
         this.branch = branch;
     }
+    
+    public void setResolver(String resolver) {
+        this.resolver = resolver;
+    }
+    
+    public String getResolver() {
+        return resolver;
+    }
 
     public void doExecute() throws BuildException {
         if (organisation == null) {
@@ -115,10 +127,26 @@
         if (value == null) {
             throw new BuildException("no value provided for ivy listmodules task");
         }
+
         Ivy ivy = getIvyInstance();
         IvySettings settings = ivy.getSettings();
-        ModuleRevisionId[] mrids = ivy.listModules(ModuleRevisionId.newInstance(organisation,
-            module, branch, revision), settings.getMatcher(matcher));
+        
+        SearchEngine searcher = new SearchEngine(settings);
+        PatternMatcher patternMatcher = settings.getMatcher(matcher);
+        
+        ModuleRevisionId[] mrids;
+        if (resolver == null) {
+            mrids = searcher.listModules(ModuleRevisionId.newInstance(organisation,
+                module, branch, revision), patternMatcher);
+        } else {
+            DependencyResolver depResolver = settings.getResolver(resolver);
+            if (depResolver == null) {
+                throw new BuildException("Unknown resolver: " + resolver);
+            }
+            mrids = searcher.listModules(depResolver, ModuleRevisionId.newInstance(organisation,
+                module, branch, revision), patternMatcher);
+        }
+        
         for (int i = 0; i < mrids.length; i++) {
             String name = IvyPatternHelper.substitute(settings.substitute(property), mrids[i]);
             String value = IvyPatternHelper.substitute(settings.substitute(this.value), mrids[i]);



Mime
View raw message