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: local properties
Date Fri, 08 Oct 2004 11:07:05 GMT
Peter,

I just posted something on bug 23942 about a different approach
to this issue that I implemented on my machine at home.

It is a very small addition to macro and it does not require
any changes to the ANT machinery. I think everything we want
to be able to do in macros can be done this way.

The full implementation provides some additional features to
help you control the scope of <let/> on <antcall>s and such
but all is based on the current machinery. No changes to CORE at all.

If you allow me to post it, or if you look at the example, you can
get a flavor for it.

Cheers,

Jose Alberto

> -----Original Message-----
> From: Peter Reilly [mailto:peter.reilly@corvil.com] 
> Sent: 08 October 2004 10:37
> To: Ant Developers List
> Subject: local properties
> 
> 
> Hi,
> 
> I have had a proposal outstanding for a while for local properties:
> 
> http://issues.apache.org/bugzilla/show_bug.cgi?id=23942
> 
> I would like to see them included in ant.
> There has been a (lot) of discussions - see
> 
> http://marc.theaimsgroup.com/?t=108765926600001&r=1&w=2
> http://marc.theaimsgroup.com/?t=107030281800001&r=1&w=2
> http://marc.theaimsgroup.com/?t=106916956400008&r=1&w=2
> 
> My current feelings (and implemenation) is
> 
> 1) Syntax
> The proposal adds a local property to a enclosing 
> target/taskcontainer.
> 
> Example:
>    <target name="example">
>        <local name="prop" value="a local value"/>
>        <echo>prop is ${prop}</echo>
>    </target>
> 
>    <macrodef name="t2">
>        <attribute name="file"/>
>        <sequential>
>          <local name="dir"/>
>          <dirname property="dir" file="@{file}"/>
>          <mkdir dir="${dir}"/>
>          <touch file="@{file}"/>
>        </sequential>
>     </macrodef>
> 
> I think it is nicer to do this rather that having an explicit 
> local property container, or having special elements for 
> different types of structures (like for example a <local> 
> element at the same level as <attribute> in a <macrodef>).
> 
> 2) Shadowing of properties
> 
> The proposal allows local properties to shadow normal and 
> user properties. I feel that this is necessary to allow 
> macrodefs to be written without them failing sometimes. This 
> means that the following will work:
> 
> <project>
>   <import file="macros.xml"/>
>   <property name="dir" value="."/>
> 
>   <t2 file="${user.home}/.ant/lib/js.jar"/>
> </project>
> 
> ant -Ddir=/var/tmp
> 
> 3) Extent of local properties
> 
> local properties will be inherited to child projects (if 
> inheritall is 
> true).
> 
> Peter
> 
> Stephan Bodewig wrote:
> > Things we need to consider IMHO:
> 
> > (1) Syntax
> 
> >Your proposal uses a <local> task that sets up a local scope for a  
> >named property until the enclosing target/sequential 
> finishes.  Jose  
> >Alberto suggested to use a <local> TaskContainer instead, something  
> >like
> 
> > <local>
> >  <local-property name="...."/>
> > </local>
> 
> > which would essentially just add an explicit (and 
> differently named) 
> > <seqential> to your proposal.  I think I prefer the more explicit, 
> > even if more verbose syntax of the second form.
> 
> > (2) Shadowing of properties
> 
> > Your updated proposal ensures that local properties do not override 
> > "global" user properties.  I think they shouldn't be allowed to 
> > override any outer scope properties at all.
> 
> > (3) Extent of local properties
> 
> > You make the local properties available to <script> - will 
> they also 
> > be available for builds that get called with the <ant> 
> family of tasks 
> > (assuming inheritall is true)?  I think they should be.
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
> 
> 

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


Mime
View raw message