Personally I prefer the abstract doExecute and the final execute because it make it clear which code is executed before and after the task. I fear that an event handler registered to the project will not be so clear.
Gilles > -----Original Message----- > From: Xavier Hanin [mailto:[EMAIL PROTECTED] > Sent: jeudi 10 mai 2007 15:23 > To: [email protected]; [EMAIL PROTECTED] > Subject: Re: "ant call trigger can only be used from an ant build" from > ant build > > On 5/10/07, Xavier Hanin <[EMAIL PROTECTED]> wrote: > > > > There is however a slight problem - this makes the API incompatible with > > > 2.0.0-alpha-1. It is possible to make doExecute not abstract in > IvyTask > > > and therefore validate all the other tasks that are kept by people, > but > > > this can lead to hard to find errors. > > > > > > breaking the API is not a major problem, Ivy 2.0 is already breaking a > lot > > of API, and we named our last release alpha because it is still subject > to > > API break (I tihnk we warn users against that in the release notes). So > I > > prefer having things like this, we may even declare execute final to > make > > sure it isn't overridden improperly. I'll review your patch soon and > apply > > it. > > > > I may have found another way of doing things before and after the task is > executed without breaking the API and the conventions when writing ant > task. > Indeed Ant fire events before starting a task and after finishing it (see > the perform method). So we may register as a listener of the project in > the > init method of IvyTask, then push on task started and pop on task > finished. > Each task would be responsible for its own events only. > The drawback of this approach is that if someone calls execute directly (a > public method) instead of perform, we won't get the correct context. This > is > not what programs are supposed to do, so I don't know if it's really a > problem or not (I realize I usually call execute instead of perform, which > is not a good thing :-( ). > > So, what do you think? > > Xavier > > Xavier > > > > Best Regards. > > > > > > --jw > > > > > > -- > > > Jaroslaw Wypychowski > > > Interdyscyplinarne Centrum Modelowania Matematycznego i Komputerowego > UW > > > > > > [EMAIL PROTECTED] > > > > > > > > > > > > -- > > Xavier Hanin - Independent Java Consultant > > Manage your dependencies with Ivy! > > http://incubator.apache.org/ivy/ > > > > > > -- > Xavier Hanin - Independent Java Consultant > Manage your dependencies with Ivy! > http://incubator.apache.org/ivy/
