ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From William Uther <>
Subject <Ant /> on multiple sub-projects
Date Fri, 03 Mar 2000 00:39:48 GMT
Hi all,

  I had just given up hope on a <ForEach /> and started to implement
includes="" functionality in the <Ant > task when I came across a problem.

So you can view this email in one of two ways:

 i) a call for help in designing a task that uses the 'preferred'

 ii) an example of why it can be nice to separate the 'ForEach'
functionality from the individual tasks.

Anyway, on with the story.

The <Ant /> task handles <property > tags.  At the moment it does this as

>     public Task createProperty() {
>         Property p=(Property)p1.createTask("property");
>         p.setUserProperty(true);
>         properties.addElement( p );
>         return p;
>     }

where 'p1' is a Project - the sub-project we'll be calling.  (This works
because init() is called after setXxxx() is called for arguments, but
before createXxxx() is called for elements.  The init() method can create
the sub-project.)

As you can see it creates the required 'property' task using the
sub-project it will call.  This will break in two ways with the
inlcludes="" functionality.  i) we wont have the sub-projects yet, because
the includes information is not complete yet.  ii) we want to intialize the
property for each sub-project, not just one of them.  Conceptually we want
to return a list of objects that all get initialized from the same

Can anyone see a neat way to implement this?  (without using nested tasks -
that would make it trivial.)

My current thought is to make a 'pseudoProperty' object that stores the
data.  This would be used to create the true property objects in the
sub-project during the execute() method.

This means that the interface to the pseudoProperty method is going to have
to be kept in sync with the true property interface manually.  I'd really
like a way around that.

Essentially the problem I see myself encountering is that I need to embed
the <ForEach > functionality into the <Ant > task.  The sub-task
implementation I posted previously kept the DOM around to re-make the
subtasks each iteration.  I'm going to have to do the same thing, but
without the guarantee that I'm capturing all the information.


\x/ill          :-}

P.S.  This only seems to be a problem for tasks that want to use nested
tags and MatchingTask.  I seem to have stumbled upon the only Task that
currently uses nested tags except for MatchingTask.  sigh.

View raw message