bodewig 00/07/31 06:30:22
Modified: src/main/org/apache/tools/ant/taskdefs ExecuteOn.java
Log:
Added nested <filesetref> element to <execon>.
Using
<execon ...>
<filesetref refid="otherfileset" />
</execon>
you can reference a fileset with ID="otherfileset" defined anywhere
else in the build file.
Revision Changes Path
1.3 +23 -1
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java
Index: ExecuteOn.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ExecuteOn.java 2000/07/25 12:03:26 1.2
+++ ExecuteOn.java 2000/07/31 13:30:20 1.3
@@ -80,6 +80,13 @@
}
/**
+ * Adds a reference to a set of files (nested filesetref element).
+ */
+ public void addFilesetref(Reference ref) {
+ filesets.addElement(ref);
+ }
+
+ /**
* Shall the command work on all specified files in parallel?
*/
public void setParallel(boolean parallel) {
@@ -98,7 +105,22 @@
Vector v = new Vector();
for (int i=0; i<filesets.size(); i++) {
- FileSet fs = (FileSet) filesets.elementAt(i);
+
+ Object o = filesets.elementAt(i);
+ FileSet fs = null;
+ if (o instanceof FileSet) {
+ fs = (FileSet) o;
+ } else {
+ Reference r = (Reference) o;
+ o = r.getReferencedObject(project);
+ if (o instanceof FileSet) {
+ fs = (FileSet) o;
+ } else {
+ String msg = r.getRefId()+" doesn\'t denote a
fileset";
+ throw new BuildException(msg, location);
+ }
+ }
+
DirectoryScanner ds = fs.getDirectoryScanner(project);
String[] s = ds.getIncludedFiles();
for (int j=0; j<s.length; j++) {