ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicola Ken Barozzi <nicola...@apache.org>
Subject Re: override
Date Fri, 01 Aug 2003 16:07:28 GMT

Dominique Devienne wrote, On 01/08/2003 17.58:

> On second though, instead of renaming, why don't we use IDs, which are
> common and well understood:

Well, they have a special meaning in XML and I would not use them for 
this feature. It also spoils consistency with other ant namings, as 
usually we use name="" and not id=""
And finally, they cannot be put in the depends attribute. (see other mail).

> <import file="a.xml" id="a" />
> <import file="b.xml" id="b" />

  <import file="a.xml" prefix="a" />
  <import file="b.xml" prefix="b" />

> <override-target target="init">
>   <depends refid="a" target="init" />
>   <depends refid="a" target="init" />
> </override-target>

  <override-target name="init">
    <depends target="b.init" />
    <depends target="a.init" />
  </override-target>

> or better yet IMHO:
> 
> <override-target target="init">
>   <super refid="a" />
>   <super refid="b" />
> </override-target>
> 
> The <super> notation feels very natural, and I don't see why one would need
> to called a conflicting target (from an imported build file) from anywhere
> but the same-name target that resolves the conflict...

There is the need. If the two libraries have same names but different 
functionality, the redefining target does not resolve the conflict for 
both, but simply resolves it relative to the common name.

For example, if I have

   <import file="java.xml" prefix="java"/>
   <import file="c.xml" prefix="c"/>

   <override target name="compile">
     <depends target="java.compile" />
     <depends target="c.compile" />
   </override-target>

   <override target name="test-java" depends="pre.test">
     <depends target="java.compile" />
     <depends target="java.test" />
   </override-target>

...

> PS: I would still like to be able to use <depends target="..."> in build
>     file that do not do any imports, to avoid wrapping long attributes
>     like the 'depends' one often is.

+1

-- 
Nicola Ken Barozzi                   nicolaken@apache.org
             - verba volant, scripta manent -
    (discussions get forgotten, just code remains)
---------------------------------------------------------------------



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


Mime
View raw message