You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Jens v.P." <de...@jevopi.de> on 2001/12/18 12:46:39 UTC

Re[2]: Why are there paths and filesets?

Hello Erik,

Tuesday, December 18, 2001, 12:07:42 PM, you wrote:

EH> A path is an ordered list of files or directories.

EH> A fileset is a rooted, from a single directory, collection (order
EH> unspecified) of files.

  So the difference between path and fileset is that the first is
ordered and the latter is unordered?

EH> You can define a fileset and give it an id, and re-use it inside a defined
EH> path:

EH> <fileset dir="some/directory" id="my.files"/>

EH> <path id="my.path">
EH>   <fileset refid="my.files"/>
EH> </path>

  Yes... thank you.. I didn't see that possiblity...
But, is there a way to re-use a path inside a fileset?

  I think using a fileset inside a path is a bad way, because the
special quality of a path, perserving the order, is lost by defining a
path using a fileset.
  Using it vice versa, that is define a fileset using a path, doesn't
have this disadvantage. BTW, in my example, defining path and fileset
using a property, the order information is not lost in the path.

EH> So, no need to define anything twice and we'd all be complaining more if
EH> this reusability was not available!  :)

  I will agree if there's a way to define a fileset using a path.

Best regards,
 Jens


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Re[2]: Why are there paths and filesets?

Posted by Stefan Bodewig <bo...@apache.org>.
On Tue, 18 Dec 2001, Erik Hatcher <ja...@ehatchersolutions.com>
wrote:

> Paths can contain directories.  Filesets do not.

Actually, things are a bit more difficult, as it depends upon the tasks
that use filesets.  *The* fileset that can be used inside a <path>
cannot contain directories, but others will - <copy> with
includeemptydirs set to true for example.

Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Re[4]: Why are there paths and filesets?

Posted by Stefan Bodewig <bo...@apache.org>.
On Tue, 18 Dec 2001, Jens v. P. <de...@jevopi.de> wrote:

>   In my case - and I still think it's a very common one - I have to
>   add all libraries and classes defined in the classpath into one
>   zip.

I've never felt the need to do so before, so maybe it isn't that
common 8-)

Anyway, you can convert a path to a fileset as long as you have a
common root directory for your components.  It may be a little tricky,
but you can use pathconvert to translate the path into a property that
contains all components in a comma separated list.  Using this
property expanded as the value for a fileset's includes attribute
should do the trick (it is Diane's, I just remembered it 8-).

Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re[4]: Why are there paths and filesets?

Posted by "Jens v.P." <de...@jevopi.de>.
Hello Erik,

  yes, of course you're right. Paths and filesets have more differences
then only the ordering information.

EH> Give a more concrete example of whats causing you trouble and I'm sure the
EH> ant-user community can help work out what you're after.

  The trouble is caused by java: Jar and Zip files can be used as
directories - this is what the difference between paths and filesets
makes vague.

  In my case - and I still think it's a very common one - I have to add
all libraries and classes defined in the classpath into one zip. The
classpath is usually defined as path, so is mine. But the zip tasks as
well as the jar task requires a fileset - what is correct since the
files and directories added to a zip must exists when they're added.
  But - and that was and is my problem - I don't want to define my
classpath twice (beware of inconsistence). Thus,  I have to "convert"
a path (classpath) into a fileset, and I solved this problem, see my
first mail. But, IMHO, the solution was little bit too dirty, so I
wondered if someone knows a better way - particularly since it's a
very common problem.

Best regards,
 Jens


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Path/fileset as the argument of the exec task

Posted by Igor Shkatov <gr...@mail.ru>.
> 1) try <pathconvert> and add a mapper (I'm not sure about these mappers
> - are they simply implemented replacing strings?)
The way similar to this I am using in this moment.

> 2) try <style> - but this seems to be a lot of XSLT work to be done...
Seems to be too complex :)

> 3) propably the easiest way: write you own task
It seems to be, but in my opinion the extension to the <arg> tag could be
sufficient to support this functionality.

> (This is what I would do... but I'm really no expert ;-) )
Thanx for you answers

regards, Igor


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Path/fileset as the argument of the exec task

Posted by "Jens v.P." <de...@jevopi.de>.
Hello Igor,

Tuesday, December 18, 2001, 3:55:00 PM, you wrote:

IS> My external compilation tool has the command line parameters in the form:
IS> -<key><file1;file2>
IS> or
IS> -<key><directory1;directory2>
IS> f.e. -Ac:\project1

IS> Is there any possibility to implement these directories/files lists using
IS> the Path or FileSet objects and transfer it to this task?

I don't know whether it's possible or not, but did you try the
following (perhaps somebody can quickly assess if the idea is working
or not):

1) try <pathconvert> and add a mapper (I'm not sure about these mappers
- are they simply implemented replacing strings?)
2) try <style> - but this seems to be a lot of XSLT work to be done...
3) propably the easiest way: write you own task

(This is what I would do... but I'm really no expert ;-) )

Best regards,
 Jens


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Path/fileset as the argument of the exec task

Posted by Igor Shkatov <gr...@mail.ru>.
I have checked the <apply> but it is not suitable because I need several set
of paths/filesets that could appear in different places of the command line.
(And in addition I have no spaces between <key> and <path/files>)
> Will <apply> work for you?

Thanx for you answers

regards, Igor


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Path/fileset as the argument of the exec task

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
Will <apply> work for you?


----- Original Message -----
From: "Igor Shkatov" <gr...@mail.ru>
To: "Ant Users List" <an...@jakarta.apache.org>
Sent: Tuesday, December 18, 2001 9:55 AM
Subject: Path/fileset as the argument of the exec task


> Hello Ant Users,
>
> My external compilation tool has the command line parameters in the form:
> -<key><file1;file2>
> or
> -<key><directory1;directory2>
> f.e. -Ac:\project1
>
> Is there any possibility to implement these directories/files lists using
> the Path or FileSet objects and transfer it to this task?
> Or is there other possibility to use some kind of directory scanning and
> passing it to the properties, that could be used by the <arg>?
>
> Thanks in advance,
> Igor
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Path/fileset as the argument of the exec task

Posted by Igor Shkatov <gr...@mail.ru>.
Hello Ant Users,

My external compilation tool has the command line parameters in the form:
-<key><file1;file2>
or
-<key><directory1;directory2>
f.e. -Ac:\project1

Is there any possibility to implement these directories/files lists using
the Path or FileSet objects and transfer it to this task?
Or is there other possibility to use some kind of directory scanning and
passing it to the properties, that could be used by the <arg>?

Thanks in advance,
Igor


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Re[2]: Why are there paths and filesets?

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
> EH> A path is an ordered list of files or directories.
>
> EH> A fileset is a rooted, from a single directory, collection (order
> EH> unspecified) of files.
>
>   So the difference between path and fileset is that the first is
> ordered and the latter is unordered?

Thats not the only difference.  Paths don't have to have their components
exist when defined.  Filesets resolve the files when defined.  I'm sure
others will chime in if I misspeak this stuff.  Paths can contain
directories.  Filesets do not.

> EH> You can define a fileset and give it an id, and re-use it inside a
defined
> EH> path:
>
> EH> <fileset dir="some/directory" id="my.files"/>
>
> EH> <path id="my.path">
> EH>   <fileset refid="my.files"/>
> EH> </path>
>
>   Yes... thank you.. I didn't see that possiblity...
> But, is there a way to re-use a path inside a fileset?

Remember that a path is not necessarily from a particular root, whereas a
fileset is.  So no, it doesn't make sense to have a path inside a fileset,
only patternsets.

Perhaps if you give us something more concrete to work with besides path and
fileset abstractions we can work out ways to accomplish what you're after.

>   I think using a fileset inside a path is a bad way, because the
> special quality of a path, perserving the order, is lost by defining a
> path using a fileset.

Personally, I don't really define paths with nested filesets.  I want more
control over what is in a path than just blindly picking up everything from
a fileset.

>   Using it vice versa, that is define a fileset using a path, doesn't
> have this disadvantage. BTW, in my example, defining path and fileset
> using a property, the order information is not lost in the path.

Maybe you're after patternsets rather than paths.  The Ant manual has some
decent help on these concepts with loads of examples.

> EH> So, no need to define anything twice and we'd all be complaining more
if
> EH> this reusability was not available!  :)
>
>   I will agree if there's a way to define a fileset using a path.

Again, that doesn't make sense given that a fileset is rooted from a
particular directory.

Give a more concrete example of whats causing you trouble and I'm sure the
ant-user community can help work out what you're after.

    Erik



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>