Java Mailing List Archive

Apache Ant Archive

» Ant Users List
» Ant Developers List
buiild.xml & ant

buiild.xml & ant

2007-06-16       - By Erica A Ramsey
Reply:     1     2     3  

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;

  <resource name="image1.png" />

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;

  @(protected) ${generated_resources}
  <resource name="image1.png" />

"ant" would expand it into

<target name="package" depends="compile">
    <resource name="gen1.rsc" /><resource name="gen2.rsc" />
    <resource name="image1.png" />

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 "<-- @(protected)
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.

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: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 - Jax Systems, LLC, U.S.A.