You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Michael George <md...@cs.cornell.edu> on 2009/07/20 14:24:46 UTC
how to process new UnknownElements
Hello,
I'm trying to write an ant task that does substitution like macroDef or
ant-contrib:foreach does. I want to take something like this:
<choice property="foo">
<condition> <available file="@{foo}/foo.txt" /> </condition>
<option value="${env.FOO}" />
<option value="${basedir}/foo" />
<option>
<dirset dir="/usr" includes="**/foo*"/>
</option>
</choice>
and evaluate the <condition> tag, substituting each option into the
condition for @{foo}. However, I'm having trouble getting this to work.
I first tried following the lead of foreach by simply internally
creating a macroDef and using that, however the condition doesn't hold
tasks, but rather Conditions.
I then tried making my <condition> into a TaskContainer (like
MacroDef.NestedSequential), and collecting up the UnknownElements and
then cloning them and doing the substitution. However, I don't know how
to then turn them into a Condition object and evaluate them. I've
attached my current efforts.
Any thoughts?
Thanks,
--Mike
Re: how to process new UnknownElements
Posted by Stefan Bodewig <bo...@apache.org>.
Hi Michael
it's been a few years since I last looked at the inner workings of
macrodef so I can't really comment on it right away.
On 2009-07-20, Michael George <md...@cs.cornell.edu> wrote:
> I then tried making my <condition> into a TaskContainer (like
> MacroDef.NestedSequential), and collecting up the UnknownElements and
> then cloning them and doing the substitution. However, I don't know
> how to then turn them into a Condition object and evaluate them.
I think it really only takes calling maybeConfigure() on your
UnknownElement (after you've set up the RuntimeConfigurable) and the
getRealThing to make it return the Condition instance.
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org