ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Rich <>
Subject Re: buiild.xml & ant
Date Sat, 16 Jun 2007 15:38:50 GMT
Hello Erica,
Have you tried to use the <apply> task? It might help here to <apply> 
your <ndspackage> task to each file in a list.

If that does not work and you are not opposed to adding antcontrib to 
your process, the following example may help using the <for> task from 
|<ac:for list="${projXLFileList}"
|  <sequential>
|   <getoutputname listitem="@{targetfile}"
   ||   <copy tofile="${TARGETFILESDIR}/${PRODUCT}/${{targetfile}}"
   |   </sequential>
|  </ac:for>

In the example,
||projXLFileList is a semi-colon delimited list of file information 
where each element contains several forms of the file name (one being 
the desired output file name),
||||getoutputname  is a macro that knows how to extract the desired 
output file name from an element of the list

HTH Bill

Erica A Ramsey wrote:
> hello, it's me again with another problem. I am using tasks provided by oem.
> One of these tasks is the <ndspackage> task. Inside this task I specify
> resource files as follows;
> <ndspackage>
>    <resource name="image1.png" />
> </ndspackage>
> Problem is that I have a macrodef that generates resources. I don't know the
> names of the resource files ahead of time. And they need to specified inside
> of the <ndspackage>; however, I can't nest anything ant tasks, for example
> <fileset>,  inside of it to include the generated files. I even tried using
> a macrodef inside of it and that didn't work either.
> Is there a way to have "ant" preprocess the "build.xml" and have it expand a
> symbol, whose value that I define, before invoking the <ndspackage> task?
> Then I would have the generate resource <macrodef> to create a tmp file and
> append it with the string "<resource name=\"some_generated_rsc.rsc\"/>".
> Then I would use the <loadfile> to read in the element tags into an symbol.
> (I put '<resource name="..." />' and load them into symbol with <loadfile>
> because I can't specify "< or >" inside of "value=" of <property> task. )
> Then I would add the following line to build file;
> <ndspackage>
>    @expand ${generated_resources}
>    <resource name="image1.png" />
> </ndspackage>
> "ant" would expand it into
> <target name="package" depends="compile">
>   <ndspackage>
>      <resource name="gen1.rsc" /><resource name="gen2.rsc" />
>      <resource name="image1.png" />
>   </ndspackage>
> </target>
> and invoke the <ndspackate> task and it couldn't complain because the data
> was expanded before it was invoked.
> Also, I was thinking about creating selfmodifying build file that would
> first <copy> itself, using <replaceregex>, looking  for the "<-- @replace
> me -->" pattern and substitute it with the <resource name=".."/> tags. It
> would copy it to an intermediate build file, build.tmp, and then invoke ant
> on it with the command argument -Dnocopy. This argument would flag the new
> build file not to copy itself again so I don't go into an infinite loop, of
> course I could always strip out the self copy tasks as well. I think that
> this might work but I prefer to use the first method.
> Please, If someone knows a better way please help me. Please note that I am
> trying to use "ant 1.6.1" because that is the environment it must run in.
> Thanks!
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.472 / Virus Database: 269.8.17/850 - Release Date: 6/15/2007
> 11:31 AM
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message