ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <>
Subject RE: [Ant 1.6beta1] More feedback about import
Date Thu, 16 Oct 2003 15:04:42 GMT
> From: peter reilly []
> On Thursday 16 October 2003 15:23, Dominique Devienne wrote:
> > I'd like <import> to have a new 'required' attribute that I could set to
> > false to simply ignore an imported build file not found. Before I get
> > flamed, here's the use case: rich and flexible user-configuration of the
> > build.
> I suppose one add a required attribute.
> One could also use a macrodef which nearly works.
> <project xmlns:ac="antlib:net.sf.antcontrib">
>   <macrodef name="conditional-import">
>     <attribute name="file"/>
>     <sequential>
>       <ac:if>
>         <available file="${file}"/>
>         <then>
>           <import file="${file}"/>
>         </then>
>       </ac:if>
>     </sequential>
>   </macrodef>
>   <conditional-import file="imported.xml"/>
>   <conditional-import file="not-present.xml"/>
> </project>
> The only problem with this is that the resolution of file for
> available is relative to base dir and the resolution of file for
> import is relative to the file that contains the import task (or
> in this case the conditional-import task).

So, where does that leave us? Will 'required' be added to <import>?

As far as the problem you describe above, this is exactly why I argued
against this un-intuitive de-referencing of properties in <macrodef> so

OK, but beside that, what would happen if the <macrodef> was in my
antlib.xml. I am rather confused about what *should* happen.

Thanks, --DD

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message