You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Murali Vemulapalli <mu...@wakesoft.com> on 2001/10/12 00:30:51 UTC
How do I iterate thorugh a directory and subdirectories looking for build.xml scripts and execute them
Hello !
I am building automated test scripts using ANT. I have a
directory hierarchy which contains a driver ANT script.
In a particular target, I need to look into all the subdirectories
looking for build.xml files and run them with default targets.
I know how to get all the build.xml scripts, like
<fileset dir="${test.dir}">
<include name="**/build.xml"/>
</fileset>
But how do I iterate through this list getting the directory for
each and run ant script there. My target for running build script
look like
<target name="build-a-testcase"
description="build a test case"
depends="prepare">
<ant antfile="build.xml"
dir="${src.testcase.dir}"
target="dist"
inheritAll="false">
</ant>
</target>
Please note that the ${src.testcase.dir} differs for each testcase
and it is the parent directory of the file build.xml
I have looked into ForEach custom task floating around the user
group. But I wasn't sure how I can use it for this example.
Is it for character strings only are for filesets also.
How do I use it to get the parent directory for each iterated
file.
Any suggestions, code examples are greatly appreciated.
Thanks a bunch in advance,
--
Murali
Re: How do I iterate thorugh a directory and subdirectories looking
for build.xml scripts and execute them
Posted by Mikko Kurki-Suonio <ma...@davisor.com>.
On Thu, 11 Oct 2001, Murali Vemulapalli wrote:
This should be in the FAQ...
You're thinking make-like.
Try not to. Ant is not make.
> I have looked into ForEach custom task floating around the user
> group. But I wasn't sure how I can use it for this example.
That's the closest you can get to an answer, I'd say.
> How do I use it to get the parent directory for each iterated
> file.
You don't. Run a system command, or store the value in a property file or
write a custom task.
> Any suggestions, code examples are greatly appreciated.
You're not going to like this, but: If you want 100% make-like behaviour,
use make.
Ant is not "XML makefiles".
//Mikko