ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Vogel <>
Subject RE: inconsistency in top-level items; automatic init. task?
Date Mon, 21 May 2001 20:20:10 GMT
I agree that the inconsistency sucks.  For example, if you want
an "init" target that defines all the properties, you are screwed
if you want to set up a referenceable path because <path> is not
a valid subelement of <target>, so you have to define the <path>
as a subelement of <project> and that implies that all the properties
needed by <path> (i.e. directory properties used in filesets) 
have to also be subelements of <project> so they come out of 
the <init> target.

Personally, I think things should work like this:

<property> values defined in a target should take effect
for the duration of that target, while properties defined
outside of all targets take effect for the duration of 
the build.  This is especially relevant if you take my
suggestion that there should be an "export" attribute on
the property element to indicate that the property should be
an environment variable for the subprocesses invoked by
ant.  It allows an environment to be augmented by per-target
properties, while the top-level environment is defined where
it should be.

To an extent, this can obviate the need for the <classpath>
element, and start to move ant out of the java-centric world
it currently exists in.  If I want the classpath to be 
something from a <path> I defined at the toplevel, I could
do this:
	<property name=CLASSPATH valueref="project.classpath" export=true>

Something like this would  go a long way to making ant a more
flexible and powerful tool while doing away with a whole bunch
of inconsistencies that currently exist w.r.t which elements
are permitted where (for example, the <depend> task seems to not
like a nested <classpath> element in 1.3).

Peter A. Vogel
Manager+consultant, Configuration Management
Arsin Corporation, Professional Services  

> -----Original Message-----
> From: Daniel Barclay []
> Sent: Monday, May 21, 2001 1:03 PM
> To:
> Subject: Re: inconsistency in top-level items; automatic init. task?
> Stefan Bodewig wrote:
> > 
> > Daniel Barclay <> wrote:
> > 
> > > There seems to be an inconsistency in what can appear at the top
> > > level of a build file (not under any target).
> > 
> > You're observation is absolutely correct, and I'm sure, this is
> > something that will be addressed with Ant2 in one way or the other.
> > Blame it on historical cruft Ant1 is carrying around and 
> the curse of
> > backwards compatibility.
> Do you think Ant2 can be different?  Peter's reply wasn't 
> encouraging.  
> (Was he just talking about Ant1?:
>   >Why not either:
>   >- let any task appear at the top level, or
>   that was -1ed ages ago as could lead to heaps of 
> complexity. It could also
>   lead to target-less scripts.
>   >- define an initialization target (when a target has some 
> distinguished
>   >  name like "init" or something, every other target 
> implicitly depends
>   >  on it)
>   This was done and users screamed for blood ;) 
> )
> Daniel
> -- 
> Daniel Barclay
> Digital Focus

View raw message