ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jose Alberto Fernandez <j_a_fernan...@yahoo.com>
Subject Re: <import> enhancement, it's done, but do you like how it works?
Date Thu, 11 Jul 2002 15:01:01 GMT
 --- Nicola Ken Barozzi <nicolaken@apache.org> wrote:
> 
> Jose Alberto Fernandez wrote:
> >  --- Nicola Ken Barozzi <nicolaken@apache.org>
> wrote:
>> With respect to the syntax of "super" what I would
>> probably do instead of denoting it just as the
string
>> "super.XXXX" I would use some different notation,
>> for example:
>> 
>>   <target name="mytarget" 
>>      depends="${ant::super(mytarget)}">
>>     <dostuff1/>
>>   </target>

>For Java writers super. is more easy to see, and
>less intimidating than 
>:: ...
>
>Hey, but it's a property... hmmm...
>

By being a property it means that its value will be
computed somehow (you can think of their values to be
defined within the context of each file). Although in
reality it is a computed value.

>> now, I doubt anybody has a property called like
>that.
>> So I think the backward compatibility issue is
>> negligeable. The advantage I see with this
>notation is
>> that it allows ProjectHelper to do more powerfull
>> rewriting. In the following situation, for example:
>> 
>> File: ${basedir}/includes/A.xml
>>   <target name="mytarget" depends="a,b,c">
>>     <dostuff/>
>>   </target>
>> 
>> File: ${basedir}/build.xml
>>   <import file="includes/A.xml"/>
>>   <target name="mytarget" 
>>      depends="${ant::super(mytarget)}">
>>     <dostuff1/>
>>   </target>
>> 
>> The rewriting done by ProjectHelper will look like:
>> 
>>   <target name="include/A.xml::mytarget" 
>>           depends="a,b,c">
>>     <dostuff/>
>>   </target>
>> 
>>   <target name="mytarget" 
>>      depends="include/A.xml::mytarget">
>>     <dostuff1/>
>>   </target>
>> 
>> Notice that all the rewriting can be computed
>> statically, so there is no issue here.
>> 
>> This particular mangling rule for the overriden
>> targets has the advantage that when we see the
>> execution of the build we will be able to identify
>> which version of the target is under execution at
>any
>> time. Notice that everthing stays syntactic with no
>> changes on any of the tasks, in principle.
>> 
>> And as with my comments above, if after rewriting
>> something clash, then the files are not upward
>> compatible, which is OK.
> 
>> comments,
>
>Well, it's basically what the patch does (or should
>do ;-), but IMHO 
>what the patch does is simpler.
>
>I don't understand what using a property versus
>super.taskname brings 
>you, could you explain?
>

The fact that it is NOT a string. If you use a string
you will have to parse the data. What does it happen
if you have something like:

  <property name="parent" value="super.targetname"/>
  <antcall target="${parent}"/>

How do you know "parent" needs to be rewritten?

On the other hand, you will always rewrite the
following:

  <property name="parent" 
            value="${ant::super(targetname)"/>
  <antcall target="${parent}"/>

which it is much more powerful and you are not
guessing.

By the way, the exact syntax of the property is not
the point. The important points are:

1) Make dificult to clash with current buildfiles:

  "ant::"

2) Be able to call any overloaded target:

   "super(targetname)"

Then put it all toguether.


Jose Alberto



__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

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


Mime
View raw message