I am more minded to put the subant in there, with perhaps some minor tweaks. The reason to use a separate task when there are major changes in functionality are
(a) we can have more sensible defaults (here: property inheritance, and what happens when you invoke a target called "" . I'd like that to be the default, but in <ant> you get the target called "" instead. (b) guarantee of zero backwards compatibility issues. If I start with adding <subant> to CVS, will you work with us to make sure your needs are met in the new task, which includes pasting in all the bits of this patch that help. I like the memory stuff, BTW -we do need to fight leakage here. -steve ----- Original Message ----- From: "Andrew Goodnough" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, March 13, 2003 07:26 Subject: [PATCH] Ant Task - Proposed Enhancement > The current ant task runs an ant process for a specified build file in a > specified directory. I wanted to be able to give it more than one > directory, and execute the build file found in each directory specified, > or give it a set of build files to execute. This can be really useful > for building projects on which this project depends (could be > sub-projects but doesn't have to be). I understand that this > enhancement overlaps with the proposed SubAnt task but I feel that this > function is really the domain of the existing Ant task, so rather than > adding another task, the Ant task should be enhanced - especially when > it only involves adding a couple contained types that users already know > how to use in other contexts. > > This enhancement adds the ability to specify multiple directories with > the addition of a contained <dirset> type or multiple files with the > addition of a contained <fileset> type. One can also specify both > DirSets and FileSets together, as well. This allows the task to run ant > processes on the directories specified (by appending the default > "antFile" to them), or on the set of files specified. {see > ANT_HOME\src\etc\testcases\taskdefs\ant.xml for examples in the attached > zip file} > > I've run all of the current and new tests on the task and all passed. > Most of the original logic flow is unchanged (although it doesn't seem > that way due to refactoring). In a nutshell, I added a for loop to the > execute method to loop through the each directory and each file > specifed, and execute the target on each. {see "diff.txt" in the > attached zip file} > > Tell me what you think. > > Andy > > > > Using directory structure > ************************* > /sub1 > build.xml > /sub2 > build.xml > /sub3 > build.xml > > > A typical build file could use the new task like this: > > <!-- excerpt from Project3/build.xml which depends on Project1 and > Project2 --> > <!-- in order to build correctly --> > <property name="subproject.dirs" value="Project1,Project2"/> > > <target name="compile-subprojects" if="subproject.dirs"> > <taskdef name="antnew" > classname="org.apache.tools.ant.taskdefs.AntNew"/> > <antnew inheritAll="false" target="compile"> > <dirset dir=".." includes="${subproject.dirs}"/> <!-- NEW > FEATURE --> > </antnew> > </target> > > <target name="compile" depends="compile-subprojects"> > ... > </target> > > > more examples pasted from testcases: > > <target name="test-dirset-inline-includes"> > <ant inheritAll="false" target="printMessage"> > <dirset dir="ant" includes="sub1,sub2,sub3"/> > </ant> > </target> > > <target name="test-dirset-contained-includes"> > <ant inheritAll="false" target="printMessage"> > <dirset dir="ant"> > <include name="sub*"/> > </dirset> > </ant> > </target> > > <target name="test-fileset-inline-includes"> > <ant inheritAll="false" target="printMessage"> > <fileset dir="ant" > includes="sub1/build.xml,sub2/build.xml,sub3/build.xml"/> > </ant> > </target> > > <target name="test-fileset-contained-includes"> > <ant inheritAll="false" target="printMessage"> > <fileset dir="ant"> > <include name="sub*/build.xml"/> > </fileset> > </ant> > </target> > > <target name="test-fileset-and-dirset"> > <ant inheritAll="false" target="printMessage"> > <fileset dir="ant"> > <include name="sub1/build.xml"/> > </fileset> > <dirset dir="ant" includes="sub2,sub3"/> > </ant> > </target> > ---------------------------------------------------------------------------- ---- > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED]