Author: mbenson
Date: Wed Sep 28 12:11:52 2005
New Revision: 292262

URL: http://svn.apache.org/viewcvs?rev=292262&view=rev
Log:
Handle filesets added via add(ResourceCollection)
by sending back to addFileset().  remove tabs.

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java
URL: 
http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java?rev=292262&r1=292261&r2=292262&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java 
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java Wed 
Sep 28 12:11:52 2005
@@ -103,7 +103,7 @@
      * @param list the FileList to add.
      */
     public void addFilelist(FileList list) {
-       add(list);
+        add(list);
     }
 
     /**
@@ -112,9 +112,11 @@
      * @since Ant 1.7
      */
     public void add(ResourceCollection rc) {
-       if (rc instanceof FileSet)
-           throw new BuildException("Huh?");
-       resources.add(rc);
+        if (rc instanceof FileSet) {
+            addFileset((FileSet) rc);
+        } else {
+            resources.add(rc);
+        }
     }
 
     /**
@@ -415,67 +417,67 @@
                     baseDirs.removeAllElements();
                 }
             }
-       
-           Iterator iter = resources.iterator();
-           while (iter.hasNext()) {
-               Resource res = (Resource) iter.next();
-
-               if (!res.isExists() && ignoreMissing) {
-                   continue;
-               }
-
-               File base = null;
-               String name = res.getName();
-               if (res instanceof FileResource) {
-                   FileResource fr = (FileResource) res;
-                   base = fr.getBaseDir();
-                   if (base == null) {
-                       name = fr.getFile().getAbsolutePath();
-                   }
-               }
-
-               if (restrict(new String[] {name}, base).length == 0) {
-                   continue;
-               }
-
-               if ((!res.isDirectory() || !res.isExists())
-                   && !FileDirBoth.DIR.equals(type)) {
-                   totalFiles++;
-               } else if (res.isDirectory() && !FileDirBoth.FILE.equals(type)) 
{
-                   totalDirs++;
-               } else {
-                   continue;
-               }
 
-               baseDirs.add(base);
-               fileNames.add(name);
+            Iterator iter = resources.iterator();
+            while (iter.hasNext()) {
+                Resource res = (Resource) iter.next();
+
+                if (!res.isExists() && ignoreMissing) {
+                    continue;
+                }
+
+                File base = null;
+                String name = res.getName();
+                if (res instanceof FileResource) {
+                    FileResource fr = (FileResource) res;
+                    base = fr.getBaseDir();
+                    if (base == null) {
+                        name = fr.getFile().getAbsolutePath();
+                    }
+                }
+
+                if (restrict(new String[] {name}, base).length == 0) {
+                    continue;
+                }
+
+                if ((!res.isDirectory() || !res.isExists())
+                    && !FileDirBoth.DIR.equals(type)) {
+                    totalFiles++;
+                } else if (res.isDirectory() && 
!FileDirBoth.FILE.equals(type)) {
+                    totalDirs++;
+                } else {
+                    continue;
+                }
+
+                baseDirs.add(base);
+                fileNames.add(name);
 
                 if (!parallel) {
-                   String[] command = getCommandline(name, base);
-                   log(Commandline.describeCommand(command),
-                       Project.MSG_VERBOSE);
-                   exe.setCommandline(command);
-
-                   if (redirectorElement != null) {
-                       setupRedirector();
-                       redirectorElement.configure(redirector, name);
-                   }
-                   if (redirectorElement != null || haveExecuted) {
-                       // need to reset the stream handler to restart
-                       // reading of pipes;
-                       // go ahead and do it always w/ nested redirectors
-                       exe.setStreamHandler(redirector.createHandler());
-                   }
-                   runExecute(exe);
-                   haveExecuted = true;
-                   fileNames.removeAllElements();
-                   baseDirs.removeAllElements();
-               }
+                    String[] command = getCommandline(name, base);
+                    log(Commandline.describeCommand(command),
+                    Project.MSG_VERBOSE);
+                    exe.setCommandline(command);
+
+                    if (redirectorElement != null) {
+                        setupRedirector();
+                        redirectorElement.configure(redirector, name);
+                    }
+                    if (redirectorElement != null || haveExecuted) {
+                        // need to reset the stream handler to restart
+                        // reading of pipes;
+                        // go ahead and do it always w/ nested redirectors
+                        exe.setStreamHandler(redirector.createHandler());
+                    }
+                    runExecute(exe);
+                    haveExecuted = true;
+                    fileNames.removeAllElements();
+                    baseDirs.removeAllElements();
+                }
             }
             if (parallel && (fileNames.size() > 0 || !skipEmpty)) {
                 runParallel(exe, fileNames, baseDirs);
                 haveExecuted = true;
-           }
+            }
             if (haveExecuted) {
                 log("Applied " + cmdl.getExecutable() + " to "
                     + totalFiles + " file"
@@ -719,8 +721,8 @@
      * for the type attribute.
      */
     public static class FileDirBoth extends EnumeratedAttribute {
-       public static final String FILE = "file";
-       public static final String DIR = "dir";
+        public static final String FILE = "file";
+        public static final String DIR = "dir";
         /**
          * @see EnumeratedAttribute#getValues
          */



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to