From dev-return-49344-apmail-ant-dev-archive=ant.apache.org@ant.apache.org Sat Aug 09 13:45:39 2003 Return-Path: Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 31367 invoked by uid 500); 9 Aug 2003 13:45:38 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 31342 invoked from network); 9 Aug 2003 13:45:37 -0000 Received: from mta06bw.bigpond.com (144.135.24.156) by daedalus.apache.org with SMTP; 9 Aug 2003 13:45:37 -0000 Received: from asert.com.au ([144.135.24.72]) by mta06bw.email.bigpond.com (iPlanet Messaging Server 5.2 HotFix 1.14 (built Mar 18 2003)) with SMTP id <0HJC00AFTU81AO@mta06bw.email.bigpond.com> for dev@ant.apache.org; Sat, 09 Aug 2003 23:45:38 +1000 (EST) Received: from ess-p-144-138-69-58.mega.tmns.net.au ([144.138.69.58]) by bwmam02.bigpond.com(MAM REL_3_3_2c 11/5633510); Sat, 09 Aug 2003 23:45:37 +0000 Date: Sat, 09 Aug 2003 23:45:31 +1000 From: Paul King Subject: Re: override In-reply-to: To: Ant Developers List Message-id: <3F34FAFB.9080906@asert.com.au> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-transfer-encoding: 7BIT X-Accept-Language: en-us, en User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 References: <747F247264ECE34CA60E323FEF0CCC0C0F5128@london.cellectivity.com> X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Costin Manolache wrote: > IMHO ant should try to be a bit easier to use than XSLT. I was playing with some examples to capture the use cases which have been discussed for include and import with a view to getting a/some simple models straight in my head. I am attempting in part to explain the use cases and capture how parts of it are currently working/proposed and in part to try to come up with a suggestion for an improved way to handle the various cases. I don't think I have quite got it yet (there are some big gaps in my knowledge of some 1.6 aspects of ant!) but the examples have got me further than where I was before. Perhaps some of the gurus can point me in the right direction and help me understand if I am on the right track. In particular, I am unsure about how to deal with top-level tasks. I have been thinking about properties, path references and fileset references etc. and normal targets. I haven't thought about antlib namespaces either. First off, two small sample files to be "reused" later. Each one has a couple of properties, a couple of path references (I assume filesets and other types would be similar) and a couple of targets. common1.xml: common2.xml: Now for examples of attempts to "reuse". main1.xml: For 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). 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. So, for main1 above, running target3 will indirectly cause the dependency for target1 to be checked - and target2 would be checked if I reversed the order of the includes. main2.xml 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? --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org