----- Original Message ----- From: "Mahmoud, Khairy" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, April 18, 2001 5:25 PM Subject: RE: AntCall
> Diane: > > Thank you very much for your time to reply. > yes i can use script to loop. > But I don't know how a script can iterate through a "fileset", to achieve a > loop passing the currentFileName as a parameter to each iteration. > > Any hints ??? > For example: <?xml version="1.0"?> <project name="PROJECT" default="test" basedir="."> <target name="test"> <script language="javascript"> <![CDATA[ file = new java.io.File('D:/temp'); path = PROJECT.createDataType('path'); fileset = PROJECT.createDataType('fileset'); fileset.setDir(file); fileset.setIncludes('*.java'); path.addFileset(fileset); files = path.list(); for (i = 0; i < files.length; i = i + 1) { antcall = PROJECT.createTask('antcall'); antcall.init(); antcall.setTarget('myecho'); antcallParam = antcall.createParam(); antcallParam.setName('myArg1'); antcallParam.setValue(files[i]); antcall.execute(); } ]]></script> </target> <target name="myecho"> <echo message="myArg1: ${myArg1}"/> </target> </project> D:\temp>ant Buildfile: build.xml test: myecho: [echo] myArg1: D:\temp\CLoddo.java myecho: [echo] myArg1: D:\temp\Test.java BUILD SUCCESSFUL Total time: 1 second D:\temp> Nico