ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <dona...@apache.org>
Subject Re: better reuse/extension of build files - How about an OO approach for build file definition?
Date Mon, 11 Jun 2001 16:01:46 GMT
At 05:12 PM 6/11/01 +0200, Jérôme Lacoste wrote:
>I've been using Ant for some time now, but I am not sure whether it can
>easily achieve what I would like to do with it.

In a word - no.

Not really at the moment, perhaps in the future.

...snip OO build file example ...

The OO method that you outline was proposed but it was decided against in
recent vote for Ant2 features. 

>--> Question: It is possible to achieve the same degree of flexibility and
>reusability with Ant? If so, how are you doing this reuse in your projects?

You can not achieve anywhere near that level of reuse with current ant. You
can use other tools to generate the build.xml files (In the past I used
XSLT to generate appropriate XML files). 

Techniques used include;

* include common blocks in multiple build files via DTD entity expansion
(See FAQ for details). 
* Create a "generic" build file and call it using <ant ../> task but
specifying different parameters.
* generation of build files (via XSLT or other)

most of them are ugly hacks with various limitations (personally I wouldn't
recomend any at this stage).

>--> If not, could we add a requirement for Ant2 to enforce the reusability
>and flexibility?
>This could of course perhaps be implemented as shown above or in a non-OO
>way.

Well the OO way has been -1'ed so we won't end up with that ;) 

It would be nice to provide a standard mechanism to enforce reusability.
>From my experience that part of the build process is often separated into
two parts;
- data or input
- rules or templates

So you have one file that specifies the rules/template with multiple
project input/data files. I am a big proponent of this methodlogy but it
looks unlikely to be provided by ant2. However you will be able to download
plugins from elsewhere to provide this functionality.

>--> Another idea: I think it would help a lot if there was some kind of
>small repository with a selection of - complete and complex - build
>examples.

Agreed - we talk about that as well as creating a "best practices" document
but it never got done ;) Some useful build files for looking at is the one
included in ant source or the ones from avalon project (ie
jakarta-avalon/build.xml). Both of these use the strengths of ant but avoid
weaknesses (except for distributions target which needs antcall due to
weakness in ants property scoping model).

Cheers,

Pete

*-----------------------------------------------------*
| "Faced with the choice between changing one's mind, |
| and proving that there is no need to do so - almost |
| everyone gets busy on the proof."                   |
|              - John Kenneth Galbraith               |
*-----------------------------------------------------*


Mime
View raw message