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 2009/06/11 23:20:00 UTC

svn commit: r783914 - in /ant/ivy/core/trunk: CHANGES.txt src/java/org/apache/ivy/Main.java src/java/org/apache/ivy/util/filter/FilterHelper.java

Author: maartenc
Date: Thu Jun 11 21:20:00 2009
New Revision: 783914

URL: http://svn.apache.org/viewvc?rev=783914&view=rev
Log:
IMPROVEMENT: Standalone runner should accept all the same parameters as ant tasks (IVY-1090)

Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/src/java/org/apache/ivy/Main.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/util/filter/FilterHelper.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=783914&r1=783913&r2=783914&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Thu Jun 11 21:20:00 2009
@@ -89,6 +89,7 @@
 =====================================
 - NEW: configuration intersections (IVY-1093)
 
+- IMPROVEMENT: Standalone runner should accept all the same parameters as ant tasks (IVY-1090)
 - IMPROVEMENT: Pre and post retrieve artifact events (IVY-1084)
 
 - FIX: Ivy buildnumber task does not find artifact in Sonatype Nexus repo (IVY-1069)

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/Main.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/Main.java?rev=783914&r1=783913&r2=783914&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/Main.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/Main.java Thu Jun 11 21:20:00 2009
@@ -55,6 +55,7 @@
 import org.apache.ivy.util.cli.CommandLineParser;
 import org.apache.ivy.util.cli.OptionBuilder;
 import org.apache.ivy.util.cli.ParseException;
+import org.apache.ivy.util.filter.FilterHelper;
 import org.apache.ivy.util.url.CredentialsStore;
 import org.apache.ivy.util.url.URLHandler;
 import org.apache.ivy.util.url.URLHandlerDispatcher;
@@ -96,13 +97,23 @@
                     + "of the work with this as a dependency.").create())
             .addOption(new OptionBuilder("confs").arg("configurations").countArgs(false)
                 .description("resolve given configurations").create())
+            .addOption(new OptionBuilder("types").arg("types").countArgs(false)
+                .description("comma separated list of accepted artifact types").create())
+            .addOption(new OptionBuilder("mode").arg("resolvemode")
+                .description("the resolve mode to use").create())
+            .addOption(new OptionBuilder("notransitive")
+                .description("do not resolve dependencies transitively").create())
                 
             .addCategory("retrieve options")
             .addOption(new OptionBuilder("retrieve").arg("retrievepattern")
                 .description("use given pattern as retrieve pattern").create())
+            .addOption(new OptionBuilder("ivypattern").arg("pattern")
+                .description("use given pattern to copy the ivy files").create())
             .addOption(new OptionBuilder("sync")
                 .description("use sync mode for retrieve").create())
-            
+            .addOption(new OptionBuilder("symlink")
+                .description("create symbolic links").create())
+             
             .addCategory("cache path options")
             .addOption(new OptionBuilder("cachepath").arg("cachepathfile")
                 .description("outputs a classpath consisting of all dependencies in cache "
@@ -247,7 +258,12 @@
                 ivy.getSettings().useDeprecatedUseOrigin();
             }
             ResolveOptions resolveOptions = new ResolveOptions().setConfs(confs)
-                .setValidate(validate);
+                .setValidate(validate)
+                .setResolveMode(line.getOptionValue("mode"))
+                .setArtifactFilter(FilterHelper.getArtifactTypeFilter(line.getOptionValues("types")));
+            if (line.hasOption("notransitive")) {
+                resolveOptions.setTransitive(false);
+            }
             if (line.hasOption("refresh")) {
                 resolveOptions.setRefresh(true);
             }
@@ -265,9 +281,13 @@
                 if (retrievePattern.indexOf("[") == -1) {
                     retrievePattern = retrievePattern + "/lib/[conf]/[artifact].[ext]";
                 }
+                String ivyPattern = settings.substitute(line.getOptionValue("ivypattern"));
                 ivy.retrieve(md.getModuleRevisionId(), retrievePattern, new RetrieveOptions()
                         .setConfs(confs).setSync(line.hasOption("sync"))
-                        .setUseOrigin(line.hasOption("useOrigin")));
+                        .setUseOrigin(line.hasOption("useOrigin"))
+                        .setDestIvyPattern(ivyPattern)
+                        .setArtifactFilter(FilterHelper.getArtifactTypeFilter(line.getOptionValues("types")))
+                        .setMakeSymlinks(line.hasOption("symlink")));
             }
             if (line.hasOption("cachepath")) {
                 outputCachePath(ivy, cache, md, confs, line.getOptionValue("cachepath",

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/filter/FilterHelper.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/filter/FilterHelper.java?rev=783914&r1=783913&r2=783914&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/util/filter/FilterHelper.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/filter/FilterHelper.java Thu Jun 11 21:20:00 2009
@@ -33,9 +33,20 @@
             return NO_FILTER;
         }
         String[] t = types.split(",");
-        List acceptedTypes = new ArrayList(t.length); 
-        for (int i = 0; i < t.length; i++) {
-            acceptedTypes.add(t[i].trim());
+        return getArtifactTypeFilter(t);
+    }
+    
+    public static Filter getArtifactTypeFilter(String[] types) {
+        if (types == null || types.length == 0) {
+            return NO_FILTER;
+        }
+        List acceptedTypes = new ArrayList(types.length); 
+        for (int i = 0; i < types.length; i++) {
+            String current = types[i].trim();
+            if ("*".equals(current)) {
+                return NO_FILTER;
+            }
+            acceptedTypes.add(current);
         }
         return new ArtifactTypeFilter(acceptedTypes);
     }