ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Murdoch <adammurd...@apache.org>
Subject Re: [Myrmidon] Overriding TargetTask for Ant1Compat.
Date Mon, 10 Jun 2002 06:53:01 GMT
On Mon, 10 Jun 2002 16:34, Darrell DeBoer wrote:
> On Sun, 9 Jun 2002 12:28, Peter Donald wrote:
> > At 01:55 AM 6/9/2002 +1000, you wrote:
> > >I've been playing around with an Ant1CompatTargetTask, which will handle
> > > "if" and "unless", without having to transform the model with <if>
> > > tasks. I thought this would be a cleaner solution, without having to
> > > introduce hidden tasks, which might confuse the user. (and I thought it
> > > would be cool to try out.)
> >
> > Sounds good to me.
> >
> > >Any ideas how I can import the Ant1Compat library before the first
> > > target is loaded? (It seems like I could provide Ant1CompatProject
> > > extends DefaultProject to import the Ant1Compat library when
> > > Module.createWorkspace() is called - is this the right track?) Or is
> > > this sort of thing just not going to be doable in any simple way?
> >
> > Hmmm .. not sure exactly what the best approach. I suppose the way you
> > describe would be the easiest as all you would need to do is
> >
> > void createWorkspace(...)
> > {
> >    Workspace w = super.createWorkspace(...);
> >    registerAnt1Tasks( w );
> >    return w;
> > }
>
> This will work, I reckon; but looking at it more closely, it requires a
> bunch of nasty changes to the ProjectBuilder used, and it doesn't provide a
> general solution to the problem of providing an alternate implementation of
> the <target> task. The only simple solution I can think of is
> (re)introducing an <import> directive to DefaultProject, which is processed
> *before* any of the targets are executed.

Another alternative (or more of a generalisation of this idea, really) is to 
change DefaultWorkspace so that it is responsible for executing the <init> 
target, before executing any other target.  Then, a project builder can add 
(or remove) whatever it wants from the init target - <import> or whatever.

-- 
Adam

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message