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-unsubscr...@ant.apache.org For additional commands, e-mail: user-h...@ant.apache.org