subclass-tasks as well. PR: 20687 Submitted by: Gus Heck <gus dot heck at olin dot edu> git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274696 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -335,13 +335,13 @@ Other changes: | |||
| * <mail> has a new attribute encoding. Bugzilla Report 15434. | |||
| * <mail> has new attributes user and password for SMTP auth. | |||
| maillogger can also use this. | |||
| The implementation only with JavaMail (encoding="MIME"). | |||
| Implementation with plain mail remains to do. | |||
| Bugzilla Report 5969. | |||
| maillogger can also use this. | |||
| The implementation only works with JavaMail (encoding="MIME"). | |||
| Implementation with plain mail remains to do. | |||
| Bugzilla Report 5969. | |||
| * <mail> and mailloger support SMTP over TLS/SSL | |||
| Bugzilla Report 19180. | |||
| Bugzilla Report 19180. | |||
| * <zipfileset> can now be defined in the main body of a project | |||
| and referred to with refid="xyz". Bugzilla Report 17007. | |||
| @@ -404,8 +404,8 @@ Bugzilla Report 19180. | |||
| * With the new addsourcefile attribute, you can make <apply> ommit the | |||
| source file names from the command line. Bugzilla Report 13654. | |||
| * <apply> and <chmod> now support nested <filelist>s as well. | |||
| Bugzilla Report 15929. | |||
| * <apply> and <chmod> now support nested <filelist>s as well as <dirset>s. | |||
| Bugzilla Reports 15929 and 20687. | |||
| * <apply> and <chmod> will display a summary if you set the new | |||
| verbose attribute to true. Bugzilla Report 19883. | |||
| @@ -15,9 +15,10 @@ compatibility.</i></p> | |||
| the command is only executed when Ant is run on one of the specified operating | |||
| systems.</p> | |||
| <p>The files and/or directories of a number of <a | |||
| href="../CoreTypes/fileset.html">FileSet</a>s or <a | |||
| href="../CoreTypes/filelist.html">FileList</a>s are passed as arguments | |||
| to the system command.</p> | |||
| href="../CoreTypes/fileset.html">FileSet</a>s, <a | |||
| href="../CoreTypes/dirset.html">DirSet</a>s (<em>since Ant 1.6</em>) | |||
| or <a href="../CoreTypes/filelist.html">FileList</a>s (<em>since Ant | |||
| 1.6</em>) are passed as arguments to the system command.</p> | |||
| <p>If you specify a nested <a | |||
| href="../CoreTypes/mapper.html">mapper</a> and the <i>dest</i> attribute, | |||
| the timestamp of each source file is compared to the timestamp of a | |||
| @@ -137,7 +138,10 @@ one mapper.</p> | |||
| <td valign="top">One of <i>file</i>, <i>dir</i> or | |||
| <i>both</i>. If set to <i>file</i>, only the names of plain | |||
| files will be sent to the command. If set to <i>dir</i>, only | |||
| the names of directories are considered.</td> | |||
| the names of directories are considered.<br> | |||
| <strong>Note:</strong> The type attribute does not apply to | |||
| nested <i>dirset</i>s - <i>dirset</i>s always implicitly | |||
| assume type to be <i>dir</i>.</td> | |||
| <td align="center" valign="top">No, default is <i>file</i></td> | |||
| </tr> | |||
| <tr> | |||
| @@ -191,6 +195,11 @@ elements to define the files for this task and refer to | |||
| <p>You can use any number of nested <code><filelist></code> | |||
| elements to define the files for this task and refer to | |||
| <code><filelist></code>s defined elsewhere.</p> | |||
| <h4>dirset</h4> | |||
| <p><em>Since Ant 1.6</em></p> | |||
| <p>You can use any number of nested <code><dirset></code> | |||
| elements to define the directories for this task and refer to | |||
| <code><dirset></code>s defined elsewhere.</p> | |||
| <h4>arg</h4> | |||
| <p>Command line arguments should be specified as nested | |||
| <code><arg></code> elements. See <a | |||
| @@ -15,10 +15,12 @@ The permissions are also UNIX style, like the argument for the chmod command.</p | |||
| <p>See the section on <a href="../dirtasks.html#directorybasedtasks">directory based | |||
| tasks</a>, on how the inclusion/exclusion of files works, and how to | |||
| write patterns.</p> | |||
| <p>This task holds an implicit <a href="../CoreTypes/fileset.html">FileSet</a> and | |||
| supports all of FileSet's attributes and nested elements | |||
| directly. More FileSets can be specified using nested | |||
| <code><fileset></code> elements.</p> | |||
| <p>This task holds an implicit <a | |||
| href="../CoreTypes/fileset.html">FileSet</a> and supports all of | |||
| FileSet's attributes and nested elements directly. More sets can be | |||
| specified using nested <code><fileset></code> or | |||
| <code><dirset></code> (<em>since Ant 1.6</em>) elements. </p> | |||
| <p>Starting with Ant 1.6, this task also supports nested <a | |||
| href="../CoreTypes/filelist.html">filelist</a>s.</p> | |||
| @@ -75,7 +77,10 @@ href="../CoreTypes/filelist.html">filelist</a>s.</p> | |||
| <td valign="top">One of <i>file</i>, <i>dir</i> or | |||
| <i>both</i>. If set to <i>file</i>, only the permissions of | |||
| plain files are going to be changed. If set to <i>dir</i>, only | |||
| the directories are considered.</td> | |||
| the directories are considered.<br> | |||
| <strong>Note:</strong> The type attribute does not apply to | |||
| nested <i>dirset</i>s - <i>dirset</i>s always implicitly | |||
| assume type to be <i>dir</i>.</td> | |||
| <td align="center" valign="top">No, default is <i>file</i></td> | |||
| </tr> | |||
| <tr> | |||
| @@ -100,7 +105,8 @@ href="../CoreTypes/filelist.html">filelist</a>s.</p> | |||
| UNIX system.</p> | |||
| <blockquote> | |||
| <pre> | |||
| <chmod dir="${dist}/bin" perm="ugo+rx" includes="**/*.sh"/> | |||
| <chmod dir="${dist}/bin" perm="ugo+rx" | |||
| includes="**/*.sh"/> | |||
| </pre> | |||
| </blockquote> | |||
| <p>makes all ".sh" files below <code>${dist}/bin</code> | |||
| @@ -120,8 +126,29 @@ below any directory named trial) writable for members of the same | |||
| group on a UNIX system. In addition all files belonging to a FileSet | |||
| with <code>id</code> <code>other.shared.sources</code> get the same | |||
| permissions.</p> | |||
| <hr><p align="center">Copyright © 2000-2003 Apache Software Foundation. All rights | |||
| Reserved.</p> | |||
| <blockquote> | |||
| <pre> | |||
| <chmod perm="go-rwx" type="file"> | |||
| <fileset dir="/web"> | |||
| <include name="**/*.cgi"/> | |||
| <include name="**/*.old"/> | |||
| </fileset> | |||
| <dirset dir="/web"> | |||
| <include name="**/private_*"/> | |||
| </dirset> | |||
| </chmod> | |||
| </pre> | |||
| </blockquote> | |||
| <p>keeps non-owners from touching cgi scripts, files with a <code>.old</code> | |||
| extension or directories begining with <code>private_</code>. A directory | |||
| ending in <code>.old</code> or a file begining with private_ would remain | |||
| unaffected.</p> | |||
| <hr> | |||
| <p align="center">Copyright © 2000-2003 Apache Software Foundation. | |||
| All rights Reserved.</p> | |||
| </body> | |||
| </html> | |||
| @@ -16,10 +16,11 @@ directories. Right now it has effect only under Windows. Each of the | |||
| 4 possible permissions has its own attribute, matching the arguments | |||
| for the attrib command.</p> | |||
| <p><a href="../CoreTypes/fileset.html">FileSet</a>s or <a | |||
| <p><a href="../CoreTypes/fileset.html">FileSet</a>s, | |||
| <a href="../CoreTypes/dirset.html">DirSet</a>s or <a | |||
| href="../CoreTypes/filelist.html">FileList</a>s can be specified using | |||
| nested <code><fileset></code> and <code><filelist></code> | |||
| elements.</p> | |||
| nested <code><fileset></code>, <code><dirset></code> and | |||
| <code><filelist></code> elements.</p> | |||
| <h3>Parameters</h3> | |||
| <table border="1" cellpadding="2" cellspacing="0"> | |||
| @@ -56,7 +57,10 @@ elements.</p> | |||
| <td valign="top">type</td> | |||
| <td valign="top">One of <i>file</i>, <i>dir</i> or <i>both</i>. If set to | |||
| <i>file</i>, only the permissions of plain files are going to be changed. | |||
| If set to <i>dir</i>, only the directories are considered.</td> | |||
| If set to <i>dir</i>, only the directories are considered.<br> | |||
| <strong>Note:</strong> The type attribute does not apply to | |||
| nested <i>dirset</i>s - <i>dirset</i>s always implicitly | |||
| assume type to be <i>dir</i>.</td> | |||
| <td align="center" valign="top">No, default is <i>file</i></td> | |||
| </tr> | |||
| <tr> | |||
| @@ -16,10 +16,11 @@ directories. Right now it has effect only under Unix. The group | |||
| atribute is equivalent to the coresponding argument for the chgrp | |||
| command.</p> | |||
| <p><a href="../CoreTypes/fileset.html">FileSet</a>s or <a | |||
| <p><a href="../CoreTypes/fileset.html">FileSet</a>s, | |||
| <a href="../CoreTypes/dirset.html">DirSet</a>s or <a | |||
| href="../CoreTypes/filelist.html">FileList</a>s can be specified using | |||
| nested <code><fileset></code> and <code><filelist></code> | |||
| elements.</p> | |||
| nested <code><fileset></code>, <code><dirset></code> and | |||
| <code><filelist></code> elements.</p> | |||
| <h3>Parameters</h3> | |||
| <table border="1" cellpadding="2" cellspacing="0"> | |||
| @@ -51,7 +52,10 @@ elements.</p> | |||
| <td valign="top">One of <i>file</i>, <i>dir</i> or | |||
| <i>both</i>. If set to <i>file</i>, only the group of | |||
| plain files are going to be changed. If set to <i>dir</i>, only | |||
| the directories are considered.</td> | |||
| the directories are considered.<br> | |||
| <strong>Note:</strong> The type attribute does not apply to | |||
| nested <i>dirset</i>s - <i>dirset</i>s always implicitly | |||
| assume type to be <i>dir</i>.</td> | |||
| <td align="center" valign="top">No, default is <i>file</i></td> | |||
| </tr> | |||
| <tr> | |||
| @@ -78,9 +82,9 @@ elements.</p> | |||
| UNIX system.</p> | |||
| <blockquote> | |||
| <pre> | |||
| <chgrp group="coders"> | |||
| <fileset dir="${dist}/bin" includes="**/*.sh"/> | |||
| </chgrp> | |||
| <chgrp group="coders"> | |||
| <fileset dir="${dist}/bin" includes="**/*.sh"/> | |||
| </chgrp> | |||
| </pre> | |||
| </blockquote> | |||
| <p>makes all ".sh" files below <code>${dist}/bin</code> | |||
| @@ -101,6 +105,26 @@ system. In addition all files belonging to a FileSet | |||
| with <code>id</code> <code>other.shared.sources</code> get the same | |||
| group.</p> | |||
| <blockquote> | |||
| <pre> | |||
| <chgrp group="webdev" type="file"> | |||
| <fileset dir="/web"> | |||
| <include name="**/*.test.jsp"/> | |||
| <include name="**/*.new"/> | |||
| </fileset> | |||
| <dirset dir="/web"> | |||
| <include name="**/test_*"/> | |||
| </dirset> | |||
| </chmod> | |||
| </pre> | |||
| </blockquote> | |||
| <p>makes all <code>.test.jsp</code>, and <code>.new</code> files belong to | |||
| group webdev. Directories begining with <code>test_</code> also will belong | |||
| to webdev, but if there is a directory that ends in <code>.new</code> or a file | |||
| that begins with <code>test_</code> it will be unaffected.</p> | |||
| <hr> | |||
| <p align="center">Copyright © 2002-2003 Apache Software | |||
| Foundation. All rights Reserved.</p> | |||
| @@ -16,10 +16,12 @@ directories. Right now it has effect only under Unix. The owner | |||
| atribute is equivalent to the coresponding argument for the chown | |||
| command.</p> | |||
| <p><a href="../CoreTypes/fileset.html">FileSet</a>s or <a | |||
| <p><a href="../CoreTypes/fileset.html">FileSet</a>s, | |||
| <a href="../CoreTypes/dirset.html">DirSet</a>s or <a | |||
| href="../CoreTypes/filelist.html">FileList</a>s can be specified using | |||
| nested <code><fileset></code> and <code><filelist></code> | |||
| elements.</p> | |||
| nested <code><fileset></code>, <code><dirset></code> and | |||
| <code><filelist></code> elements.</p> | |||
| <h3>Parameters</h3> | |||
| <table border="1" cellpadding="2" cellspacing="0"> | |||
| @@ -51,7 +53,10 @@ elements.</p> | |||
| <td valign="top">One of <i>file</i>, <i>dir</i> or | |||
| <i>both</i>. If set to <i>file</i>, only the owner of | |||
| plain files are going to be changed. If set to <i>dir</i>, only | |||
| the directories are considered.</td> | |||
| the directories are considered.<br> | |||
| <strong>Note:</strong> The type attribute does not apply to | |||
| nested <i>dirset</i>s - <i>dirset</i>s always implicitly | |||
| assume type to be <i>dir</i>.</td> | |||
| <td align="center" valign="top">No, default is <i>file</i></td> | |||
| </tr> | |||
| <tr> | |||
| @@ -100,6 +105,26 @@ below any directory named trial) belong to coderjoe on a UNIX | |||
| system. In addition all files belonging to a FileSet | |||
| with <code>id</code> <code>other.shared.sources</code> get the same | |||
| owner.</p> | |||
| <blockquote> | |||
| <pre> | |||
| <chown owner="webadmin" type="file"> | |||
| <fileset dir="/web"> | |||
| <include name="**/*.cgi"/> | |||
| <include name="**/*.old"/> | |||
| </fileset> | |||
| <dirset dir="/web"> | |||
| <include name="**/private_*"/> | |||
| </dirset> | |||
| </chmod> | |||
| </pre> | |||
| </blockquote> | |||
| <p>makes cgi scripts, files with a <code>.old</code> extension or | |||
| directories begining with <code>private_</code> belong to the user named | |||
| webadmin. A directory ending in <code>.old</code> or a file begining with | |||
| <code>private_</code> would remain unaffected.</p> | |||
| <hr> | |||
| <p align="center">Copyright © 2002-2003 Apache Software | |||
| Foundation. All rights Reserved.</p> | |||
| @@ -62,6 +62,8 @@ import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.DirectoryScanner; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.types.Commandline; | |||
| import org.apache.tools.ant.types.AbstractFileSet; | |||
| import org.apache.tools.ant.types.DirSet; | |||
| import org.apache.tools.ant.types.EnumeratedAttribute; | |||
| import org.apache.tools.ant.types.FileList; | |||
| import org.apache.tools.ant.types.FileSet; | |||
| @@ -81,7 +83,8 @@ import org.apache.tools.ant.util.SourceFileScanner; | |||
| */ | |||
| public class ExecuteOn extends ExecTask { | |||
| protected Vector filesets = new Vector(); | |||
| protected Vector filesets = new Vector(); // contains AbstractFileSet | |||
| // (both DirSet and FileSet) | |||
| private Vector filelists = new Vector(); | |||
| private boolean relative = false; | |||
| private boolean parallel = false; | |||
| @@ -109,6 +112,20 @@ public class ExecuteOn extends ExecTask { | |||
| filesets.addElement(set); | |||
| } | |||
| /** | |||
| * Adds directories to operate on. | |||
| * | |||
| * <p><em>Note that the directories will be added to the build | |||
| * path in no particular order, so if order is significant, one | |||
| * should use a file list instead!</em></p> | |||
| * | |||
| * @param set the DirSet to add. | |||
| * | |||
| * @since Ant 1.6 | |||
| */ | |||
| public void addDirset(DirSet set) { | |||
| filesets.addElement(set); | |||
| } | |||
| /** | |||
| * Source files to operate upon. | |||
| */ | |||
| @@ -274,11 +291,21 @@ public class ExecuteOn extends ExecTask { | |||
| Vector fileNames = new Vector(); | |||
| Vector baseDirs = new Vector(); | |||
| for (int i = 0; i < filesets.size(); i++) { | |||
| FileSet fs = (FileSet) filesets.elementAt(i); | |||
| String currentType = type; | |||
| AbstractFileSet fs = (AbstractFileSet) filesets.elementAt(i); | |||
| if (fs instanceof DirSet) { | |||
| if (!"dir".equals(type)) { | |||
| log("Found a nested dirset but type is " + type + ". " | |||
| + "Temporarily switching to type=\"dir\" on the" + | |||
| " assumption that you really did mean" + | |||
| " <dirset> not <fileset>.", Project.MSG_DEBUG); | |||
| currentType = "dir"; | |||
| } | |||
| } | |||
| File base = fs.getDir(getProject()); | |||
| DirectoryScanner ds = fs.getDirectoryScanner(getProject()); | |||
| if (!"dir".equals(type)) { | |||
| if (!"dir".equals(currentType)) { | |||
| String[] s = getFiles(base, ds); | |||
| for (int j = 0; j < s.length; j++) { | |||
| totalFiles++; | |||
| @@ -287,7 +314,7 @@ public class ExecuteOn extends ExecTask { | |||
| } | |||
| } | |||
| if (!"file".equals(type)) { | |||
| if (!"file".equals(currentType)) { | |||
| String[] s = getDirs(base, ds);; | |||
| for (int j = 0; j < s.length; j++) { | |||
| totalDirs++; | |||