ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jose Alberto Fernandez" <jalbe...@cellectivity.com>
Subject RE: override
Date Mon, 04 Aug 2003 10:10:20 GMT
> From: Conor MacNeill [mailto:conor@cortexebusiness.com.au]
> 
> On Fri, 1 Aug 2003 07:40 pm, Jose Alberto Fernandez wrote:
> >
> > OK, lets get on the nitty gritty of the matter. :-)
> >
> > What do you mean by unrelated imports? If they are 
> unrelated why do you
> > need to import them toghether? 
> 
> They may be unrelated because they are written by different people. 
> 
> I will give an example. Let's say one person distributes a 
> build fragment, a 
> template really, for building a Java project. Someone else 
> distributes a 
> fragment to do documentation generation. In both cases I want 
> to use the bulk 
> of the template as is but I need to override some of the 
> steps. In the java 
> generation fragment I wish to add an xdoclet step before the 
> compile step 
> whereas in the documetation generation I have some funky logo 
> processing that 
> needs to be inserted into the document generation workflow.
> 
> So it is this overriding that prevents me from using straight 
> <ant>. The 
> authors of the fragments can't know my special requirements 
> but that is no 
> problem as I can override some individual steps. The authors 
> may have even 
> inserted empty targets to make overriding easy - classic 
> template method 
> pattern.
> 

What stops you from writing two separate buildfiles one for each
that perform the import and do the respective override. From your
main build you just <ant/> these new files.

> Unfortunately the authors of the two build fragments don't 
> know of the 
> existence of each other and used the same target names in 
> their fragments 
> whether it is a simple "init", "compile", "clean" or any of 
> the other very 
> common names you find in builds.
> 
> > Why don't you use <ant/> to call between the
> > unrelated targets? In other words, the now famous example of "bad"
> > crosstalk, I could argue is due to bad usage of the 
> <import/> feature. 
> 
> You could argue that but you'd be wrong :-)
> 

My point in all these is that <import>ing all files toghether
may not be the only way (or the correct way) to solve every problem.
And the more I see at these examples the more I think that we are
going the spaggetti way; I think I preffered a well layered lassagna :-)

> > The
> > build should not have imported files A and B, but just 
> <ant/> them. You
> > should have gotten the desired effect.
> 
> No override - back to copy, paste and hack. I lose all the benefits.
> 
> >
> > On the other hand, if you have to import them, then it is 
> because they have
> > to share something or one defines some target for the 
> other, or something.
> 
> I disagree. Importing them into a common build does not imply 
> they have 
> something in common other than they are both fragments I wish 
> to use in my 
> build process. If you want them to interact you should achieve that 
> *explicitly* by operations in the importing build file not by 
> some implicit 
> coincidence of names.
> 

Well that is the way it works in OO programming. If you redefine
a signature, implicitly, you get the new behavior.

BTW, I am not against having some different approach as long as it is 
well defined and not something that works for the two or three
scenarios that come to mind and breaks all over when users
try to do something interesting.

I would argue rewriting is not the solution. If we want what you
are saying, then we need a more richer execution context framework
where dependencies are selected depending on the target that
is citing them (and not just by name). All that is possible by just
managing better the symbol tables for targets.

Jose Alberto

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


Mime
View raw message