ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gus Heck <gus-ant...@cognition.olin.edu>
Subject Re: [new tasks] presetdef and macrodef
Date Thu, 21 Aug 2003 17:08:52 GMT
I'm not sure I buy your 3 things argument. In my mind there are 2 things 
in what is previously proposed...

properties and parameters

Templates appear to be something new, though I don't think I like them 
(see below)

>  (1) --> ${xyz}
>  (2) --> ${macroattr:xyz}
>  (3) --> ${macrotemplate:xyz}
>
>So for a definition like:
>
>  <property name="xyz" value="true"/>
>
Now ${xyz}" is true forevermore because properties are immutable

>  <macrodef name="abc">
>    <attribute name="pqr"/>
>    <sequential>
>      <javac debug="${xyz}" ... />
>
This line ${xyz} should get replaced

>      <javac debug="${macroattr:pqr}" ... />
>      <javac debug="${macrotemplate:xyz}" ... />
>    </sequential>
>  </macrodef>
>  
>
I'm not sure how you get a second level of expansion, or if it is desireable

>After this definition the macro that is actually expanded will look
>something like:
>
>    <attribute name="pqr"/>
>    <sequential>
>      <javac debug="true" ... />
>      <javac debug="${macroattr:pqr}" ... />
>      <javac debug="${xyz}" ... />
>    </sequential>
>
>which will be further expanded in a call frangment, maybe inside an
><ant> call:
>
>  <property name="xyz" value="false"/>
>  <abc pqr="true"/>
>  <abc pqr="false"/>
>
I'm not sure this makes sense (to me at least).... if it is part of an 
ant call, then the macrodef should be in the build file used in the 
antfile atribute...  in which case your first javac might also come out 
with debug=false (assuming inheritall=false, and the property definition 
was before the macro definition) or debug="${xyz}" (unexpanded, and 
causing the build to fail because it wasn't defined yet, if the property 
isn't before the macro definition, as you have shown). If the task does 
property replacement at invocation time, then you still should get
debug="false" for your first javac since the property won't have been 
expanded yet.

If macro definitions are available to sub builds, then your 3rd case 
might occur, but I don't think it would be good to allow macros to be 
called across build file boundaries. builds would be almost 
unintelligible without tracking down the macros from other files.

It would also bring up yet another scoping issue for 2 files that 
defined macros with the same name and then one called the other. Granted 
this might be an xml namespaces thing, but the more parts of ant that 
require namespaces the steeper the learning curve for new users.

>
>To effectively finish executing the following ANT fragment:
>
>    <property name="xyz" value="false"/>
>    <sequential>
>      <javac debug="true" ... />
>      <javac debug="true" ... />
>      <javac debug="${xyz}" ... />
>    </sequential>
>    <sequential>
>      <javac debug="true" ... />
>      <javac debug="false" ... />
>      <javac debug="${xyz}" ... />
>    </sequential>
>
>So, as long as we can acomplish something like this, and we do not add a
>bunch
>of new machinery in the process, I think it is a wonderful feature.
>
>Jose Alberto
>
>---------------------------------------------------------------------
>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