You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Raja Nagendra Kumar <Na...@tejasoft.com> on 2010/04/13 13:28:28 UTC

default directory for directory attribute tasks

Hi,

I am looking to see if all the tasks like filelist, fileset take the default
directory as the directory of the ant file in which they are being
refereed...

e.g 

if I use 

<project>
    <import file="tasks/TaskDefs.xml"/>
    <import file="PreDefs.xml"/>
    <import file="CompDefs.xml"/>
</project>


instead I want to say

<import>
	<filelist dir="??????"
		  files="tasks/TaskDefs.xml,
		  PreDefs.xm,
		  CompDefs.xml"
		/>
    </import>


Regards,
Nagendra


-- 
View this message in context: http://old.nabble.com/default-directory-for-directory-attribute-tasks-tp28228748p28228748.html
Sent from the Ant - Users mailing list archive at Nabble.com.


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


Re: default directory for directory attribute tasks

Posted by Raja Nagendra Kumar <Na...@tejasoft.com>.
or there seem to be need for generic referring to the directory location of
the ant script file..

some thing like

ant.dir.this or ant.dir. XYZ (if the project is named as XYZ) etc.. I would
prefer this syntax.

in similar lines to 

ant.file.XYZ name as in <project name="XYZ">

Are there similar thing exists pl.
-- 
View this message in context: http://old.nabble.com/default-directory-for-directory-attribute-tasks-tp28228748p28228854.html
Sent from the Ant - Users mailing list archive at Nabble.com.


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


Re: default directory for directory attribute tasks

Posted by Raja Nagendra Kumar <Na...@tejasoft.com>.
>There already is: ant.file.PROJECTNAME - is there any reason why you
wouldn't want to add a name attribute to your project element?

In our project we have close to 100 ant files.. We are currently enforcing
to keep the project name same as file name so that we don't have to bother
about having 100 different names.

If ant it self by default does that, it can eliminate adding of name
attribute explicitly. As part of TejaSoft Java Code Audit services, we do
help enterprise companies to eliminate as much of dummy code.. including ant
files modularization and optimization.

Regards,
Nagendra


-- 
View this message in context: http://old.nabble.com/default-directory-for-directory-attribute-tasks-tp28228748p28232441.html
Sent from the Ant - Users mailing list archive at Nabble.com.


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


Re: default directory for directory attribute tasks

Posted by Stefan Bodewig <bo...@apache.org>.
On 2010-04-13, Raja Nagendra Kumar <Na...@tejasoft.com> wrote:

>> only possible if we have something meaningful (ant.file.SOME_GUID
>> wouldn't help anybody) and thus need the build file writer's help via
>> <project>'s name attribute.

> This is very informative Stefan. Based on the read only nature, if the
> project name does not exist, can the file name be considered as project name
> (excluding the extension etc).

> Also, are there any plans of introducing special properties like the 'this'
> in future.

There already is: ant.file.PROJECTNAME - is there any reason why you
wouldn't want to add a name attribute to your project element?

Stefan

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


Re: default directory for directory attribute tasks

Posted by Raja Nagendra Kumar <Na...@tejasoft.com>.
>only possible if we have something meaningful (ant.file.SOME_GUID
>wouldn't help anybody) and thus need the build file writer's help via
><project>'s name attribute.

This is very informative Stefan. Based on the read only nature, if the
project name does not exist, can the file name be considered as project name
(excluding the extension etc).

Also, are there any plans of introducing special properties like the 'this'
in future. I understand ant design and its readonlyness. However, may be
introducing read write in some form would have some more better usage. Just
a thought to get more forum inputs.

Regards,
Nagendra

-- 
View this message in context: http://old.nabble.com/default-directory-for-directory-attribute-tasks-tp28228748p28232108.html
Sent from the Ant - Users mailing list archive at Nabble.com.


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


Re: default directory for directory attribute tasks

Posted by Stefan Bodewig <bo...@apache.org>.
On 2010-04-13, Raja Nagendra Kumar <Na...@tejasoft.com> wrote:

> Stefan,

>> If you really want the directory that contains the build file

> Yes, I am looking for a way to reference dir that contains the build
> file.  this location is different than basedir.

Take the approach described in the manual page for <import>.

> In my case, the project does not have any name, hence as generic
> approach of referring to this file would help a lot..

The location of the main build file is ${ant.file} - otherwise your
project must have a name.

> similar lines to 'this ' used in java.

${ant.file} is the "this" of the main build file, for any
imported/included file we need a different "this" and given the
immutability of properties we need different names for them - this is
only possible if we have something meaningful (ant.file.SOME_GUID
wouldn't help anybody) and thus need the build file writer's help via
<project>'s name attribute.

Stefan

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


Re: default directory for directory attribute tasks

Posted by Raja Nagendra Kumar <Na...@tejasoft.com>.
Stefan,

> If you really want the directory that contains the build file
Yes, I am looking for a way to reference dir that contains the build file.
this location is different than basedir.

In my case, the project does not have any name, hence as generic approach of
referring to this file would help a lot.. 

similar lines to 'this ' used in java.

Pl. look at my need which does not just confine to <import>


Regards,
Raja Nagendra Kumar,
C.T.O
www.tejasoft.com







Stefan Bodewig wrote:
> 
> On 2010-04-13, Raja Nagendra Kumar <Na...@tejasoft.com> wrote:
> 
>> if I use
> 
>> <project>
>>     <import file="tasks/TaskDefs.xml"/>
>>     <import file="PreDefs.xml"/>
>>     <import file="CompDefs.xml"/>
>> </project>
> 
> 
>> instead I want to say
> 
>> <import>
>> 	<filelist dir="??????"
>> 		  files="tasks/TaskDefs.xml,
>> 		  PreDefs.xm,
>> 		  CompDefs.xml"
>> 		/>
>>     </import>
> 
> If your build files's location is the same as your project's basedir
> this would simply be ${basedir} or just ".".  If you really want the
> directory that contains the build file, see the sections labeled
> "Special Properties" and "Resolving files against the imported file" in
> <http://ant.apache.org/manual/CoreTasks/import.html>
> 
> Stefan
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/default-directory-for-directory-attribute-tasks-tp28228748p28230595.html
Sent from the Ant - Users mailing list archive at Nabble.com.


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


Re: default directory for directory attribute tasks

Posted by Stefan Bodewig <bo...@apache.org>.
On 2010-04-13, Raja Nagendra Kumar <Na...@tejasoft.com> wrote:

> if I use

> <project>
>     <import file="tasks/TaskDefs.xml"/>
>     <import file="PreDefs.xml"/>
>     <import file="CompDefs.xml"/>
> </project>


> instead I want to say

> <import>
> 	<filelist dir="??????"
> 		  files="tasks/TaskDefs.xml,
> 		  PreDefs.xm,
> 		  CompDefs.xml"
> 		/>
>     </import>

If your build files's location is the same as your project's basedir
this would simply be ${basedir} or just ".".  If you really want the
directory that contains the build file, see the sections labeled
"Special Properties" and "Resolving files against the imported file" in
<http://ant.apache.org/manual/CoreTasks/import.html>

Stefan

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