Paul King wrote, On 09/08/2003 15.45: ...
For <include> the conceptual model is one of textual inclusion
(or XML entity inclusion if you are that way inclined).
The ant way states (at least for properties) that whoever sets
things first "wins". I would argue that would be the simplest
model for everything else too (but there has been some talk of
failing the build if nameclashes occur).
The trick in understanding is to put all these files in one file and run "ant". Ant now indeed works as you suggest, as multiple targets do not collide, but the first one wins.
I would suggest that
whoever is first wins could apply to path references, targets etc. Depending on my settings I will get a warning and arguably ant could be run in a "strict" mode which could fail if a property, path, target was adjusted later. The implication of this is that even within the one file you could (though never recommended) have two targets with the same name - the second would be ignored.
Exactly what happens with the latest Ant CVS.
But this, as Conor has shown, creates problems that are not easily understandable by users.
The example was about all imported files having a target with the same name, and other targets depending on it. All imported files would then use the first decalred one in the first file, which may not be what was intended.
I have seen some of the import, super, override discussions but can't see an easy conceptual model following ant's similar but not exactly equivalent notion of inheritance. So, what I want to achieve is the equivalent of Java's delegation trick/pattern used to mimic multiple inheritance. In Java I wouldn't use inheritance at all but would instead have two instance variables (the delegates) and I would pass any method calls on to the appropriate delegate.
This is where things aren't clear to me. In the example I have used two antref tags. I am trying to avoid the nameclash issue altogether - conceptually I either have some new targets but only full qualified and perhaps not visible or I may need "target references" to some targets. Now I can declare my own targets and refer to the original targets in some fashion either by their fully-qualified names or using the target reference. I have used a pseudo task called targetref - kind of like super which has been discussed before but perhaps I could use (an extended) antcall with a refid?
Any suggestions? Does this help anyone?
I don't think I follow you. It seems that you are describing how import works now, with first-target wins, and access to all the targets with "fully qualified" names. Look in CVS manual for the import task... is that what you mean?
-- Nicola Ken Barozzi [EMAIL PROTECTED] - verba volant, scripta manent - (discussions get forgotten, just code remains) ---------------------------------------------------------------------
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]