ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vanovc...@logica.com
Subject RE: echo and filesets
Date Mon, 13 Jan 2003 07:49:32 GMT
Matthew,

I wrote a task that takes a fileset and calls any ant target for each file
in the fileset. It passes several formats of the currently processed
filename in properties:

foreach.file--a full filename from the defined fileset,
foreach.dir--the directory of the file,
foreach.name.ext--the name of the file, without path but with extension,
foreach.name--the name of the file, without path and without extension

Example:

 <target name="foo">
   <foreach>
     <fileset dir="${server.src}" casesensitive="yes">
       <include name="**/*.java"/>
       <exclude name="**/*Test*"/>
     </fileset>
     <antcall target="bar">
       <param name="property1" value="aaaaa" />
       <param name="foo" value="bar" />
     </antcall>
   </foreach>
 </target>

 <target name="bar" depends="init">
   <echo message="prop is ${property1} ${foo}" />
   <echo message="foreach.file is ${foreach.file}" />
   <echo message="foreach.dir is ${foreach.dir}" />
   <echo message="foreach.name.ext is ${foreach.name.ext}" />
   <echo message="foreach.name is ${foreach.name}" />
 </target>

It is based on the core <delete> task.

Are you interested in it? Is there anyone else interested? (Wouldn't mind to
have it included in the Ant's distribution ;-))
Jan

> -----Original Message-----
> From: Inger, Matthew [mailto:inger@Synygy.com]
> Sent: Friday, January 10, 2003 8:25 PM
> To: 'ant-dev@jakarta.apache.org'
> Subject: echo and filesets
>
>
> Would it be possible (i would even be willing to write the code) to
> extend the echo task so that it could take a fileset argument?  And
> it would either echo the fileset to the standard output area, or to
> the file specified in the command?
>
> ie.
>
>
> <fileset id="myFs" dir="src" includes="**/*.java" />
>
> <echo file="fileList.txt">
>   <fileset refid="myFs" />
> </echo>
>
>
> Reason i ask is that right now, we are using the exec command
> and specifying an output file for a "cmd.exe /c dir /s /b
> *.java" command to
> get the filelist.  I'd rather do it in a more os independent manner.
>
> Once we have the file, we're passing the filename to the <ajc>
> (aspect java compiler) for processing.  It uses the contents of
> this file to actually build the project (it needs all java file names
> to completely aspect and produce appropriate class files).
>
> http://www.aspectj.org  for more info on aspectj
>
>
> 

This e-mail and any attachment is for authorised use by the intended recipient(s) only.  It
may contain proprietary material, confidential information and/or be subject to legal privilege.
 It should not be copied, disclosed to, retained or used by, any other party.  If you are
not an intended recipient then please promptly delete this e-mail and any attachment and all
copies and inform the sender.  Thank you.

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message