You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Francis Galiegue <fg...@one2team.com> on 2008/12/02 15:53:07 UTC

Feature requests: include ant-contrib, unordered file sets, "cp"-like copy task

Hello list,

I've been working with ant for three years now, and have implemented from 
scratch a build system that works fine. We use ant 1.6.5.

However, I have found myself using "external" utilities more than once because 
of some limitations/unexpected behaviors, so I'd like to know what's cooking 
for the next version(s) of ant.

1. ant-contrib

I find myself using ant-contrib extensively throughout the project for the 
following tags:

* var,
* for,
* assert,
* try/catch,
* if/then/else,
* propertyregex

I especially find var and if/then/else useful (in fact, must-haves), and find 
the use of for/propertyregex much, much easier (much more natural) to use 
than ant's mappers when handling complex file renaming (OK, the fact that I 
know regexes quite well also helps).

Are there plans to include ant-contrib in ant itself?

2. Unordered file sets

We have to concatenate JavaScript files into one big file and then minify it. 
The list of files to minify is within a file itself. So, I first tried to use 
the concat task with <fileset dir="thebasedir" includesfile="thefilelist"/>.

The problem is, this reorders the file list in alphabetical order and we don't 
want that! Is there a plan to have unordered file sets (which is a pleonasm 
anyway, since a set has no order by definition)?

3. "cp"-like copy task

Here's a question: how do you do, with ant, the equivalent of this command:

cp -r */src/java/* dstdir/

Well, I have struggled for more than one hour trying to do this, and couldn't.
So I gave up, and resorted to using <exec>... Resulting in a non portable way 
of doing things, but it's very simple and it works.

It would be very, very useful to have such a task by default.

Have fun!
-- 
Francis Galiegue
ONE2TEAM
Ingénieur système
Mob : +33 (0) 6 83 87 78 75
Tel : +33 (0) 1 78 94 55 52
fge@one2team.com
40 avenue Raymond Poincaré
75116 Paris

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


Re: Feature requests: include ant-contrib, unordered file sets, "cp"-like copy task

Posted by Stefan Bodewig <bo...@apache.org>.
On 2008-12-02, Francis Galiegue <fg...@one2team.com> wrote:

> We use ant 1.6.5.

> 1. ant-contrib

> I find myself using ant-contrib extensively throughout the project for the
> following tags:

> Are there plans to include ant-contrib in ant itself?

No.

Please note that the ant-contrib project is completely separate from
the Ant project.  There is some overlap between the developer groups,
but the ant-contrib project has a different development model that
doesn't fit with the Apache model.

> 2. Unordered file sets

Just browse through the online manual and you'll see that most tasks
in 1.7.x support nested resource collections now.  There are resource
collections (like filelist) that preserve the order you specify.

Stefan

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


Re: AW: Feature requests: include ant-contrib, unordered file sets, "cp"-like copy task

Posted by Francis Galiegue <fg...@one2team.com>.
Le mercredi 03 décembre 2008, Francis Galiegue a écrit :
> Le mardi 02 décembre 2008, Francis Galiegue a écrit :
> [...]
> > 
> > > 
> > > 3.I did not try this, but it seems not too difficult, perhaps I dont 
know 
> > > enough about cp. 
> > > What about
> > > 
> > >     <copy todir="dstdir"> 
> > >       <fileset>
> > >         <include name="**/src/java/**"/>
> > >       </fileset>
> > >     </copy>
> > > 
> > 
> > I'll try that and report.
> > 
> 
> Nope...
> 
> It recopies the whole directory structure. This is not what I want.
> 
> Say, I have:
> 
> basedir/a/src/java/com/<whatever>
> basedir/a/src/java/org/...
> basedir/b/src/java/com/<whatever2>
> basedir/b/src/java/foo/...
> 
> What I want to have, in the destination directory, is what the cp command I 
> gave as an example achieves, ie, in the dstdir:
> 
> com/<whatever>
> com/org/...
> com/foo/...
> com/<whatever2>
> 

Sorry, this should have been:

com/<whatever>
org/...
foo/...
com/<whatever2>

-- 
Francis Galiegue
ONE2TEAM
Ingénieur système
Mob : +33 (0) 6 83 87 78 75
Tel : +33 (0) 1 78 94 55 52
fge@one2team.com
40 avenue Raymond Poincaré
75116 Paris

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


Re: Feature requests: include ant-contrib, unordered file sets, "cp"-like copy task

Posted by Stefan Bodewig <bo...@apache.org>.
On 2008-12-03, Francis Galiegue <fg...@one2team.com> wrote:

> Le mardi 02 décembre 2008, Francis Galiegue a écrit :
> [...]


>>> 3.I did not try this, but it seems not too difficult, perhaps I dont know
>>> enough about cp.
>>> What about

>>>     <copy todir="dstdir">
>>>       <fileset>
>>>         <include name="**/src/java/**"/>
>>>       </fileset>
>>>     </copy>


>> I'll try that and report.


> Nope...

> It recopies the whole directory structure. This is not what I want.

> Say, I have:

> basedir/a/src/java/com/<whatever>
> basedir/a/src/java/org/...
> basedir/b/src/java/com/<whatever2>
> basedir/b/src/java/foo/...

> What I want to have, in the destination directory, is what the cp command I
> gave as an example achieves, ie, in the dstdir:

> com/<whatever>
> com/org/...
> com/foo/...
> com/<whatever2>

     <copy todir="dstdir">
       <fileset>
         <include name="*/src/java/**"/>
       </fileset>
       <regexmapper from=".*/src/java/(.*)" to="\1"/>
     </copy>

should work (untested).

Stefan

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


Re: AW: Feature requests: include ant-contrib, unordered file sets, "cp"-like copy task

Posted by Francis Galiegue <fg...@one2team.com>.
Le mardi 02 décembre 2008, Francis Galiegue a écrit :
[...]
> 
> > 
> > 3.I did not try this, but it seems not too difficult, perhaps I dont know 
> > enough about cp. 
> > What about
> > 
> >     <copy todir="dstdir"> 
> >       <fileset>
> >         <include name="**/src/java/**"/>
> >       </fileset>
> >     </copy>
> > 
> 
> I'll try that and report.
> 

Nope...

It recopies the whole directory structure. This is not what I want.

Say, I have:

basedir/a/src/java/com/<whatever>
basedir/a/src/java/org/...
basedir/b/src/java/com/<whatever2>
basedir/b/src/java/foo/...

What I want to have, in the destination directory, is what the cp command I 
gave as an example achieves, ie, in the dstdir:

com/<whatever>
com/org/...
com/foo/...
com/<whatever2>

What the following ant scriptlet recreates all the tree below the basedir in 
dstdir, as in:

a/src/java/com/<whatever>
a/src/java/org/...
b/src/java/com/<whatever2>
b/src/java/foo/...

Just like if I entered the following shell command:

(cd basedir && tar cf - */src/java/*)|(cd dstdit && tar xf -)

So, it just looks like ant cannot do what I want here, or maybe it can do it 
in such a convoluted way that I prefer my one-liner <exec>... unless a 
cp-like task is created :p

-- 
Francis Galiegue
ONE2TEAM
Ingénieur système
Mob : +33 (0) 6 83 87 78 75
Tel : +33 (0) 1 78 94 55 52
fge@one2team.com
40 avenue Raymond Poincaré
75116 Paris

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


Re: AW: Feature requests: include ant-contrib, unordered file sets, "cp"-like copy task

Posted by Francis Galiegue <fg...@one2team.com>.
Le mardi 02 décembre 2008, Knuplesch, Juergen a écrit :
> 
> Hello,
> 
[...]
> 
> 2.You want ordered filesets not unordered filsets, but it should be the user 
> who defines the order! I sometimes had the same problem. The problem is, 
> that filsets do not guarantee any order. 

Well, I figured out that if you passed a file as includesfile with, say, f3, 
f1 and f2 in this order, it would stay this way... But it doesn't. Instead, I 
get f1, f2 and f3.

> I think filelists could help, but I never really tried.
> I solved it by putting several filsets in the order I want.
> 

I have tried filelists, but the concat task doesn't support a nested 
filelist :( Haven't tried ant 1.7 though. And I must use the file  list 
provided, since the list (and the order) may change. Right now, I use a shell 
script.

> 
> 3.I did not try this, but it seems not too difficult, perhaps I dont know 
> enough about cp. 
> What about
> 
>     <copy todir="dstdir"> 
>       <fileset>
>         <include name="**/src/java/**"/>
>       </fileset>
>     </copy>
> 

I'll try that and report.

Thanks!
-- 
Francis Galiegue
ONE2TEAM
Ingénieur système
Mob : +33 (0) 6 83 87 78 75
Tel : +33 (0) 1 78 94 55 52
fge@one2team.com
40 avenue Raymond Poincaré
75116 Paris

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


AW: Feature requests: include ant-contrib, unordered file sets, "cp"-like copy task

Posted by "Knuplesch, Juergen" <Ju...@icongmbh.de>.
 
Hello,

1.I use antcontrib also a lot! I agree, that it would be nice to add this to ANT.

2.You want ordered filesets not unordered filsets, but it should be the user who defines the order!
I sometimes had the same problem. The problem is, that filsets do not guarantee any order.
I think filelists could help, but I never really tried.
I solved it by putting several filsets in the order I want.


3.I did not try this, but it seems not too difficult, perhaps I dont know enough about cp.
What about

    <copy todir="dstdir"> 
      <fileset>
        <include name="**/src/java/**"/>
      </fileset>
    </copy>


-- 
Jürgen Knuplesch        

Geschäftsführer: Uwe Seltmann
HRB Stuttgart 17655
USt-IdNr.: DE 811944121 
-----Ursprüngliche Nachricht-----
Von: Francis Galiegue [mailto:fge@one2team.com] 
Gesendet: Dienstag, 2. Dezember 2008 15:53
An: user@ant.apache.org
Betreff: Feature requests: include ant-contrib, unordered file sets, "cp"-like copy task

Hello list,

I've been working with ant for three years now, and have implemented from scratch a build system that works fine. We use ant 1.6.5.

However, I have found myself using "external" utilities more than once because of some limitations/unexpected behaviors, so I'd like to know what's cooking for the next version(s) of ant.

1. ant-contrib

I find myself using ant-contrib extensively throughout the project for the following tags:

* var,
* for,
* assert,
* try/catch,
* if/then/else,
* propertyregex

I especially find var and if/then/else useful (in fact, must-haves), and find the use of for/propertyregex much, much easier (much more natural) to use than ant's mappers when handling complex file renaming (OK, the fact that I know regexes quite well also helps).

Are there plans to include ant-contrib in ant itself?

2. Unordered file sets

We have to concatenate JavaScript files into one big file and then minify it. 
The list of files to minify is within a file itself. So, I first tried to use the concat task with <fileset dir="thebasedir" includesfile="thefilelist"/>.

The problem is, this reorders the file list in alphabetical order and we don't want that! Is there a plan to have unordered file sets (which is a pleonasm anyway, since a set has no order by definition)?

3. "cp"-like copy task

Here's a question: how do you do, with ant, the equivalent of this command:

cp -r */src/java/* dstdir/

Well, I have struggled for more than one hour trying to do this, and couldn't.
So I gave up, and resorted to using <exec>... Resulting in a non portable way of doing things, but it's very simple and it works.

It would be very, very useful to have such a task by default.

Have fun!
--
Francis Galiegue
ONE2TEAM
Ingénieur système
Mob : +33 (0) 6 83 87 78 75
Tel : +33 (0) 1 78 94 55 52
fge@one2team.com
40 avenue Raymond Poincaré
75116 Paris

---------------------------------------------------------------------
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