ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: apply task with multiple filename mappings - how?
Date Sat, 19 Feb 2011 06:42:35 GMT
On 2011-02-18, david__schmidt wrote:

> I am having trouble seeing how I can get a job done with apply task.  I
> would like to give a fileset to apply, then send in several parameters based
> on variations of the filenames.  So, for example... given "filename.s", I'd
> like each command to look like this:
> ${assemblerPath}/ca65 -l filename.lst -m filename.map -o filename.o
> filename.s

> I can get one mapping pretty easily with a mapper:

> <apply executable="${assemblerPath}/ca65"
> dir="${projdir}/client/src/ip65/drivers" relative="true">
> 	<fileset dir="${projdir}/client/src/ip65/drivers" includes="**/*.s"/>
> 	<arg value="-l"/>
> 	<mapper type="glob" from="*.s" to="*.lst"/>
> 	<targetfile/>
> 	<srcfile/>
> </apply>

> but how can I do multiple mappings - multiple variations on the filename per
> invocation?  Or is there another way to approach the problem?

Since all your variations only differ in the extension, this here should
kind of work

<apply executable="${assemblerPath}/ca65"
       dir="${projdir}/client/src/ip65/drivers" relative="true">
   <fileset dir="${projdir}/client/src/ip65/drivers" includes="**/*.s"/>
   <mapper type="glob" from="*.s" to="*"/>
   <arg value="-l"/>
   <targetfile suffix=".lst"/>
   <arg value="-m"/>
   <targetfile suffix=".map"/>
   <arg value="-o"/>
   <targetfile suffix=".o"/>
   <srcfile/>
</apply>

Of course this would run ca65 on every build because the target file
doesn't exist.  To address this you could use something like

<touch>
   <fileset dir="${projdir}/client/src/ip65/drivers" includes="**/*.s"/>
   <mapper type="glob" from="*.s" to="*"/>
</touch>

right after the <apply> task to create dummy target files.  That way
you'd only rereun the command for sources that changed.

Hmm, come to think of it, you could map away the source file's extension
as well.  This one (not tested in any way) schould work with apply and
without any extra step.

<apply executable="${assemblerPath}/ca65"
       dir="${projdir}/client/src/ip65/drivers" relative="true">
   <mappedresources>
     <fileset dir="${projdir}/client/src/ip65/drivers" includes="**/*.s"/>
     <mapper type="glob" from="*.s" to="*"/>
   </mappedresources>
   <mapper type="glob" from="*" to="*.o"/>
   <arg value="-l"/>
   <srcfile suffix=".lst"/>
   <arg value="-m"/>
   <srcfile suffix=".map"/>
   <arg value="-o"/>
   <targetfile/>
   <srcfile suffix=".s"/>
</apply>

Stefan 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message