diff --git a/WHATSNEW b/WHATSNEW index 334839934..efe58a94c 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -335,13 +335,13 @@ Other changes: * has a new attribute encoding. Bugzilla Report 15434. * 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. * and mailloger support SMTP over TLS/SSL -Bugzilla Report 19180. + Bugzilla Report 19180. * 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 ommit the source file names from the command line. Bugzilla Report 13654. -* and now support nested s as well. - Bugzilla Report 15929. +* and now support nested s as well as s. + Bugzilla Reports 15929 and 20687. * and will display a summary if you set the new verbose attribute to true. Bugzilla Report 19883. diff --git a/docs/manual/CoreTasks/apply.html b/docs/manual/CoreTasks/apply.html index 1843f11fb..154fb42bc 100644 --- a/docs/manual/CoreTasks/apply.html +++ b/docs/manual/CoreTasks/apply.html @@ -15,9 +15,10 @@ compatibility.

the command is only executed when Ant is run on one of the specified operating systems.

The files and/or directories of a number of FileSets or FileLists are passed as arguments -to the system command.

+href="../CoreTypes/fileset.html">FileSets, DirSets (since Ant 1.6) +or FileLists (since Ant +1.6) are passed as arguments to the system command.

If you specify a nested mapper and the dest attribute, the timestamp of each source file is compared to the timestamp of a @@ -137,7 +138,10 @@ one mapper.

One of file, dir or both. If set to file, only the names of plain files will be sent to the command. If set to dir, only - the names of directories are considered. + the names of directories are considered.
+ Note: The type attribute does not apply to + nested dirsets - dirsets always implicitly + assume type to be dir. No, default is file @@ -191,6 +195,11 @@ elements to define the files for this task and refer to

You can use any number of nested <filelist> elements to define the files for this task and refer to <filelist>s defined elsewhere.

+

dirset

+

Since Ant 1.6

+

You can use any number of nested <dirset> +elements to define the directories for this task and refer to +<dirset>s defined elsewhere.

arg

Command line arguments should be specified as nested <arg> elements. See See the section on directory based tasks, on how the inclusion/exclusion of files works, and how to write patterns.

-

This task holds an implicit FileSet and -supports all of FileSet's attributes and nested elements -directly. More FileSets can be specified using nested -<fileset> elements.

+ +

This task holds an implicit FileSet and supports all of +FileSet's attributes and nested elements directly. More sets can be +specified using nested <fileset> or +<dirset> (since Ant 1.6) elements.

Starting with Ant 1.6, this task also supports nested filelists.

@@ -75,7 +77,10 @@ href="../CoreTypes/filelist.html">filelists.

One of file, dir or both. If set to file, only the permissions of plain files are going to be changed. If set to dir, only - the directories are considered. + the directories are considered.
+ Note: The type attribute does not apply to + nested dirsets - dirsets always implicitly + assume type to be dir. No, default is file @@ -100,7 +105,8 @@ href="../CoreTypes/filelist.html">filelists.

UNIX system.

-    <chmod dir="${dist}/bin" perm="ugo+rx" includes="**/*.sh"/>
+<chmod dir="${dist}/bin" perm="ugo+rx" 
+       includes="**/*.sh"/>
 

makes all ".sh" files below ${dist}/bin @@ -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 id other.shared.sources get the same permissions.

-

Copyright © 2000-2003 Apache Software Foundation. All rights -Reserved.

+ +
+
+<chmod perm="go-rwx" type="file">
+  <fileset dir="/web">
+    <include name="**/*.cgi"/>
+    <include name="**/*.old"/>
+  </fileset>
+  <dirset dir="/web">
+    <include name="**/private_*"/>
+  </dirset>
+</chmod>
+
+
+ +

keeps non-owners from touching cgi scripts, files with a .old +extension or directories begining with private_. A directory +ending in .old or a file begining with private_ would remain +unaffected.

+ +
+

Copyright © 2000-2003 Apache Software Foundation. +All rights Reserved.

diff --git a/docs/manual/OptionalTasks/attrib.html b/docs/manual/OptionalTasks/attrib.html index 5cd01bc03..3c5f44453 100644 --- a/docs/manual/OptionalTasks/attrib.html +++ b/docs/manual/OptionalTasks/attrib.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.

-

FileSets or FileSets, +DirSets or FileLists can be specified using -nested <fileset> and <filelist> -elements.

+nested <fileset>, <dirset> and +<filelist> elements.

Parameters

@@ -56,7 +57,10 @@ elements.

+ If set to dir, only the directories are considered.
+ Note: The type attribute does not apply to + nested dirsets - dirsets always implicitly + assume type to be dir. diff --git a/docs/manual/OptionalTasks/chgrp.html b/docs/manual/OptionalTasks/chgrp.html index b02bfa823..b37555cbe 100644 --- a/docs/manual/OptionalTasks/chgrp.html +++ b/docs/manual/OptionalTasks/chgrp.html @@ -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.

-

FileSets or FileSets, +DirSets or FileLists can be specified using -nested <fileset> and <filelist> -elements.

+nested <fileset>, <dirset> and +<filelist> elements.

Parameters

type One of file, dir or both. If set to file, only the permissions of plain files are going to be changed. - If set to dir, only the directories are considered. No, default is file
@@ -51,7 +52,10 @@ elements.

+ the directories are considered.
+ Note: The type attribute does not apply to + nested dirsets - dirsets always implicitly + assume type to be dir. @@ -78,9 +82,9 @@ elements.

UNIX system.

-    <chgrp group="coders">
-      <fileset dir="${dist}/bin" includes="**/*.sh"/>
-    </chgrp>
+<chgrp group="coders">
+  <fileset dir="${dist}/bin" includes="**/*.sh"/>
+</chgrp>
 

makes all ".sh" files below ${dist}/bin @@ -101,6 +105,26 @@ system. In addition all files belonging to a FileSet with id other.shared.sources get the same group.

+
+
+<chgrp group="webdev" type="file">
+  <fileset dir="/web">
+    <include name="**/*.test.jsp"/>
+    <include name="**/*.new"/>
+  </fileset>
+  <dirset dir="/web">
+    <include name="**/test_*"/>
+  </dirset>
+</chmod>
+
+
+ +

makes all .test.jsp, and .new files belong to +group webdev. Directories begining with test_ also will belong +to webdev, but if there is a directory that ends in .new or a file +that begins with test_ it will be unaffected.

+ +

Copyright © 2002-2003 Apache Software Foundation. All rights Reserved.

diff --git a/docs/manual/OptionalTasks/chown.html b/docs/manual/OptionalTasks/chown.html index c747b66c4..2eda7e3e9 100644 --- a/docs/manual/OptionalTasks/chown.html +++ b/docs/manual/OptionalTasks/chown.html @@ -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.

-

FileSets or FileSets, +DirSets or FileLists can be specified using -nested <fileset> and <filelist> -elements.

+nested <fileset>, <dirset> and +<filelist> elements.

+

Parameters

One of file, dir or both. If set to file, only the group of plain files are going to be changed. If set to dir, only - the directories are considered. No, default is file
@@ -51,7 +53,10 @@ elements.

+ the directories are considered.
+ Note: The type attribute does not apply to + nested dirsets - dirsets always implicitly + assume type to be dir. @@ -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 idother.shared.sources get the same owner.

+ +
+
+<chown owner="webadmin" type="file">
+  <fileset dir="/web">
+    <include name="**/*.cgi"/>
+    <include name="**/*.old"/>
+  </fileset>
+  <dirset dir="/web">
+    <include name="**/private_*"/>
+  </dirset>
+</chmod>
+
+
+ +

makes cgi scripts, files with a .old extension or +directories begining with private_ belong to the user named +webadmin. A directory ending in .old or a file begining with +private_ would remain unaffected.

+

Copyright © 2002-2003 Apache Software Foundation. All rights Reserved.

diff --git a/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java b/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java index 4c826edb4..d3c403e21 100644 --- a/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java +++ b/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java @@ -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. + * + *

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!

+ * + * @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" + + " not .", 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++;
One of file, dir or both. If set to file, only the owner of plain files are going to be changed. If set to dir, only - the directories are considered. No, default is file