From 982db474ca24f7c65bcc07ab553f100b4f39b3e0 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Wed, 6 Sep 2000 12:03:16 +0000 Subject: [PATCH] Added a type attribute to and . It can take the values "file", "dir" and "both" and deteremines, whether the task should work on plain files only (the default), directories only or both. Suggested by: Peter Donald , Kitching Simon git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@267969 13f79535-47bb-0310-9956-ffa450edef68 --- docs/index.html | 24 +++++++++++--- .../apache/tools/ant/taskdefs/ExecuteOn.java | 33 +++++++++++++++++-- 2 files changed, 50 insertions(+), 7 deletions(-) diff --git a/docs/index.html b/docs/index.html index 2f437bc82..36d6cf078 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1059,6 +1059,14 @@ elements.

chmod command. Defaults to true. No + + 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 +

Examples

@@ -1548,10 +1556,10 @@ system command.

Executes a system command. When the os attribute is specified, then the command is only executed when Ant is run on one of the specified operating systems.

-

The files of a number of FileSets are passed -as arguments to the system command. At least one nested -<fileset> or <filesetref> is -required.

+

The files and/or directories of a number of FileSets are passed as arguments to the system +command. At least one nested <fileset> or +<filesetref> is required.

Parameters

@@ -1601,6 +1609,14 @@ required.

once for every file. + + + + +
No
typeOne 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.No, default is file

Parameters specified as nested elements

fileset and filesetref

diff --git a/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java b/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java index b96b520db..baca677be 100644 --- a/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java +++ b/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java @@ -71,6 +71,7 @@ public class ExecuteOn extends ExecTask { protected Vector filesets = new Vector(); private boolean parallel = false; + protected String type = "file"; /** * Adds a set of files (nested fileset attribute). @@ -93,6 +94,13 @@ public class ExecuteOn extends ExecTask { this.parallel = parallel; } + /** + * Shall the command work only on files, directories or both? + */ + public void setType(FileDirBoth type) { + this.type = type.getValue(); + } + protected void checkConfiguration() { super.checkConfiguration(); if (filesets.size() == 0) { @@ -122,9 +130,18 @@ public class ExecuteOn extends ExecTask { } DirectoryScanner ds = fs.getDirectoryScanner(project); - String[] s = ds.getIncludedFiles(); - for (int j=0; j