ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 23942] - Addition of a local property
Date Fri, 08 Oct 2004 10:52:36 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=23942>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=23942

Addition of a local property





------- Additional Comments From j_a_fernandez@yahoo.com  2004-10-08 10:52 -------
People, I think I have a much more clean solution to the isue of complex
macros and its necessary properties that does not affect the core of ANT at 
all.
It is a complete local solution to macrodef without spillovers. I cannot post 
it nor commit it until tonight since it is in my machine at home.

The basic approach is something I proposed here some time ago. Providing a 
<let> element in <macrodef> which defined guaranteed unique names for 
properties. The syntax is very simple:

<macrodef name="checkCondition">
 <let name="isTrue">
 <element name="cond">
 <sequential>
   <condition property="@{isTrue}" value="Hurray!!!">
     <cond/>
   </condition>
   <echo if="@{isTrue}">The condition is true: ${@{isTrue}}</echo>
   <echo unless="@{isTrue}">The condition is false</echo>
 <sequential>
</macro>

The macro above will be used as follows:

 <checkCondition>
   <cond>
    <available file="${myfile}/>
   </cond>
 </checkCondition>

And it will print whether the condition is true or not.

As you can see from the style of writing, <let/> just defines an attribute
( @{..} syntax) whose value is a name guaranteed to be unique within the JVM.
You can use this name as the name for a property, or whatever else.

Everytime you execute the macro, a new value is assigned to the let attribute
and you can have as many as you want. This is all the machinery you need to
write as complicated <macros> as you want, using recurtion or whatever.
And since it does not touch and does not rely on changes to the CORE there 
are no possible BC issues. 

So let me submit my proposal tonight and we can talk about any misgivings
on the particulars.

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


Mime
View raw message