You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Colin Sampaleanu <co...@exis.com> on 2003/12/29 20:33:29 UTC

How can tasks in 'imported' build files know the basedir of the imported file itsef?

When you import another build file via the new 1.6 import task, special 
properties
    ant.file.<name>
    ant.version.<name>
and so on are created, where <name> is the name attribute from the 
imported build file.

Now ant.file.<name> may be used by tasks within the imported build file 
to refer to the imported build file itself, but I want to refer to the 
base directly in which the imported build file is located. 
Unfortunately, there seems to be no
  basedir.<name>
property defined. If the imported code just uses ${basedir}, it gets the 
basedir of whoever imported it, which is not what I want.

Can anybody point out a way to get at the base directory of the build file?

Regards,
Colin



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


Re: How can tasks in 'imported' build files know the basedir of the imported file itsef?

Posted by Colin Sampaleanu <co...@exis.com>.
To answer my own question, there is a slightly indirect solution, by 
using the <dirname> task to define a new property which contains just 
the dir from the ant.file property...

    <dirname property="ant.file.dir" file="${ant.file.<name>}"/>


Colin Sampaleanu wrote:

> When you import another build file via the new 1.6 import task, 
> special properties
>    ant.file.<name>
>    ant.version.<name>
> and so on are created, where <name> is the name attribute from the 
> imported build file.
>
> Now ant.file.<name> may be used by tasks within the imported build 
> file to refer to the imported build file itself, but I want to refer 
> to the base directly in which the imported build file is located. 
> Unfortunately, there seems to be no
>  basedir.<name>
> property defined. If the imported code just uses ${basedir}, it gets 
> the basedir of whoever imported it, which is not what I want.
>
> Can anybody point out a way to get at the base directory of the build 
> file?
>
> Regards,
> Colin
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>



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


Re: How can tasks in 'imported' build files know the basedir of the imported file itsef?

Posted by Yuji Yamano <yy...@kt.rim.or.jp>.
Colin Sampaleanu <co...@exis.com> writes:

> When you import another build file via the new 1.6 import task, 
> special properties
>    ant.file.<name>
>    ant.version.<name>
> and so on are created, where <name> is the name attribute from the 
> imported build file.

ant.file.<name> are okay, but ant.version.<name> isn't created.
Also I can't find this kinda code in 1.6 source.

-- Yuji Yamano

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