RE: If anybody is interested.. [foreach] task which doesnt run out of memory.

2002-09-19 Thread EXT / FOCAL MALAPRADE Roland

Wow! Cool! thanks a lot. I'll try it out.

Roland.

-Message d'origine-
De : Geoff Meakin [mailto:[EMAIL PROTECTED]]
Envoyé : mercredi 18 septembre 2002 18:40
À : Ant Users List
Objet : RE: If anybody is interested.. [foreach] task which doesnt run
out of memory.


Dear Roland,

Yes, the difficulty comes in with the fact that
IfTask isnt really an org.apache.tools.ant.Task
but is a ConditionBase instead, with private
then and else Sequentials, so I cant access
them, and notify them that they need to reset
their properties.

I've changed this by modifying execute() on
Sequential so that it resets its properties from
there instead, so your example now works (as does
mine). This now happens with all Sequentials,
but I cant see how that should have any adverse
effects.

If you're happy with this, you can get
the new version (ForEach2 v0.8.1) from the same
place.

Thanks for pointing this out :)

Cheers
-Geoff


-Original Message-
From: EXT / FOCAL MALAPRADE Roland [mailto:[EMAIL PROTECTED]]
Sent: 18 September 2002 02:42 PM
To: 'Ant Users List'
Subject: RE: If anybody is interested.. [foreach] task which doesnt run
out of memory.


I've been trying to use it with an if task as so:

target name=main
  foreach2 param=letter list=a,b,c
do
  if
isset property=letter/
then
  foreach2 param=number list=1,2,3
do
  if
isset property=letter/
then
  echo message=combi is ${letter}${number}/
/then
else
  echo message=number not set /
/else
  /if
/do
  /foreach2
/then
else
  echo message=letter not set /
/else
  /if
/do
  /foreach2

and this build script displays:
main:
 [echo] combi is a1
 [echo] combi is a1
 [echo] combi is a1
 [echo] combi is a1
 [echo] combi is a1
 [echo] combi is a1
 [echo] combi is a1
 [echo] combi is a1
 [echo] combi is a1

Do you know why this is?

/target-Message d'origine-
De : Geoff Meakin [mailto:[EMAIL PROTECTED]]
Envoyé : mercredi 18 septembre 2002 15:09
À : Ant Users List
Objet : RE: If anybody is interested.. [foreach] task which doesnt run
out of memory.


Yes, it appears so:

target name=main
  foreach2 param=letter list=a,b,c
do
  foreach2 param=number list=1,2,3
do
  echo message=combi is ${letter}${number}/
/do
  /foreach2
/do
  /foreach2
/target

Gives the output:

combi is a1
combi is a2
combi is a3
combi is b1
combi is b2
combi is b3
combi is c1
combi is c2
combi is c3

Cheers
-Geoff


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: If anybody is interested.. [foreach] task which doesnt run ou t of memory.

2002-09-19 Thread EXT / FOCAL MALAPRADE Roland

Hi Geoff,

I gave it a bash, the problem is that the example I gave you is a cut down
version of my build script (obviously), and it wasn't really representative
of it.

Here's another example:

target name=main
  foreach2 param=iteration list=1,2
do
!-- PROBLEM HERE WITH THE ECHO --
  echoIteration ${iteration} :/echo
  echo/
  foreach2 param=letter list=a,b
do
  if
isset property=letter/
then
  foreach2 param=number list=1,2
do
  if
  isset property=letter/
  then
echo message=combi is ${iteration}.
${letter}-${number}/
  /then
  else
echo message=number not set /
  /else
  /if
/do
  /foreach2
/then
else
  echo message=letter not set /
/else
  /if
/do
  /foreach2
/do
  /foreach2
/target

And this gives the following output:

Iteration 1 :

combi is 1. a-1
combi is 1. a-2
combi is 1. b-1
combi is 1. b-2
Iteration 1 :Iteration 2 :

combi is 2. a-1
combi is 2. a-2
combi is 2. b-1
combi is 2. b-2


In the do of the first foreach2 I've added an echo which seems to get
called as many times per iteration as the number of the iteration. If I
add another echo to the second do task, every task seems to get called
called in a totally weird order.

Is there any obvious fix for this?

Anyway thanks a stack for the time you've devoted to this, and even if you
don't have the time to fix this, I've really appreciated your help.

Cheers, Roland.

-Message d'origine-
De : EXT / FOCAL MALAPRADE Roland [mailto:[EMAIL PROTECTED]]
Envoyé : jeudi 19 septembre 2002 09:50
À : 'Ant Users List'
Objet : RE: If anybody is interested.. [foreach] task which doesnt run
ou t of memory.


Wow! Cool! thanks a lot. I'll try it out.

Roland.

-Message d'origine-
De : Geoff Meakin [mailto:[EMAIL PROTECTED]]
Envoyé : mercredi 18 septembre 2002 18:40
À : Ant Users List
Objet : RE: If anybody is interested.. [foreach] task which doesnt run
out of memory.


Dear Roland,

Yes, the difficulty comes in with the fact that
IfTask isnt really an org.apache.tools.ant.Task
but is a ConditionBase instead, with private
then and else Sequentials, so I cant access
them, and notify them that they need to reset
their properties.

I've changed this by modifying execute() on
Sequential so that it resets its properties from
there instead, so your example now works (as does
mine). This now happens with all Sequentials,
but I cant see how that should have any adverse
effects.

If you're happy with this, you can get
the new version (ForEach2 v0.8.1) from the same
place.

Thanks for pointing this out :)

Cheers
-Geoff


-Original Message-
From: EXT / FOCAL MALAPRADE Roland [mailto:[EMAIL PROTECTED]]
Sent: 18 September 2002 02:42 PM
To: 'Ant Users List'
Subject: RE: If anybody is interested.. [foreach] task which doesnt run
out of memory.


I've been trying to use it with an if task as so:

target name=main
  foreach2 param=letter list=a,b,c
do
  if
isset property=letter/
then
  foreach2 param=number list=1,2,3
do
  if
isset property=letter/
then
  echo message=combi is ${letter}${number}/
/then
else
  echo message=number not set /
/else
  /if
/do
  /foreach2
/then
else
  echo message=letter not set /
/else
  /if
/do
  /foreach2

and this build script displays:
main:
 [echo] combi is a1
 [echo] combi is a1
 [echo] combi is a1
 [echo] combi is a1
 [echo] combi is a1
 [echo] combi is a1
 [echo] combi is a1
 [echo] combi is a1
 [echo] combi is a1

Do you know why this is?

/target-Message d'origine-
De : Geoff Meakin [mailto:[EMAIL PROTECTED]]
Envoyé : mercredi 18 septembre 2002 15:09
À : Ant Users List
Objet : RE: If anybody is interested.. [foreach] task which doesnt run
out of memory.


Yes, it appears so:

target name=main
  foreach2 param=letter list=a,b,c
do
  foreach2 param=number list=1,2,3
do
  echo message=combi is ${letter}${number}/
/do
  /foreach2
/do
  /foreach2
/target

Gives the output:

combi is a1
combi is a2
combi is a3
combi is b1
combi is b2
combi is b3
combi is c1
combi is c2
combi is c3

Cheers
-Geoff


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]

--
To unsubscribe

Questions about foreach task and properties and memory

2002-09-19 Thread EXT / FOCAL MALAPRADE Roland

Hi everybody,

sorry if this is a bit long :)

I have made a build script to do the following:
- download a bunch of folders containing zip files off an FTP server (one
folder for each month)
- create a report for each month in a csv file by:
  - checking which zip files are there (there are 50 in all)
  - if a zip file is there, checking which files it contains (up to 11
files)

now there are 3 foreach calls which basically amount to this (in
pseudocode):

for (...) {
...tasks...
for (...) {
...tasks...
for (...) {
...tasks...
}
}
}

The foreach tasks have inheritall set to false, but as I've defined my
properties outside of any target (as children of project), they seem to be
available everywhere.

Now the problem is that to process each month takes about 50 megs of memory,
and the script caused java.lang.OutOfMemoryError before I set my ANT_OPTS
(-Xmx -Xms)

Now my questions are finally :) 

1. Is this memory usage normal, or is it a bug in foreach ?

2. Should Ant not be used in this way ?

3. Instead of defining my properties outside a target, should i put them in
the init target, and only pass the necessary info as params to foreach
(maybe this will use less memory) ?

4. Are you still reading ;) ?

Any help would be useful.
Roland.

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: Questions about foreach task and properties and memory

2002-09-19 Thread Geoff Meakin

1. Is this memory usage normal, or is it a bug in foreach ?

The difficulty is foreach uses an implicit {antcall} mechanism (e.g.
the antcall task Now many people claim that this doesnt have memory
leaks unless the called tasks have javac in them (which has known
memory leaks), however, I think it does, as I have a buildscript which
runs out of memory very quickly using foreach or antcall. 
Memory problems with these 2 tasks are a known issue and have been
discussed relatively frequently in the Ant user list recently.
(Aside: Indeed that's actually the prime reason why I started foreach2, 
cos I needed it to work without memory problems)

2. Should Ant not be used in this way ?

It can be. Whether it should be isnt really defined I think. 

3. Instead of defining my properties outside a target, should i put them in
the init target, and only pass the necessary info as params to foreach
(maybe this will use less memory) ?

yes, but you'll still have the same problem. You might use slightly less
memory, but this wont make a difference because something is seriously
leaking somewhere.

4. Are you still reading ;) ?

:)

Cheers
-Geoff


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: If anybody is interested.. [foreach] task which doesnt run ou t of memory.

2002-09-19 Thread Geoff Meakin

This is a problem with the way nested text in an echo is added
each time the task is run. I'll take a look at this now.
In the meantime, if you use echo message=/ format instead
it should work.

Thanks again
Cheers
-Geoff

-Original Message-
From: EXT / FOCAL MALAPRADE Roland [mailto:[EMAIL PROTECTED]]
Sent: 19 September 2002 10:04 AM
To: 'Ant Users List'
Subject: RE: If anybody is interested.. [foreach] task which doesnt run
ou t of memory.


Hi Geoff,

I gave it a bash, the problem is that the example I gave you is a cut down
version of my build script (obviously), and it wasn't really representative
of it.

Here's another example:

target name=main
  foreach2 param=iteration list=1,2
do
!-- PROBLEM HERE WITH THE ECHO --
  echoIteration ${iteration} :/echo
  echo/
  foreach2 param=letter list=a,b
do
  if
isset property=letter/
then
  foreach2 param=number list=1,2
do
  if
  isset property=letter/
  then
echo message=combi is ${iteration}.
${letter}-${number}/
  /then
  else
echo message=number not set /
  /else
  /if
/do
  /foreach2
/then
else
  echo message=letter not set /
/else
  /if
/do
  /foreach2
/do
  /foreach2
/target

And this gives the following output:

Iteration 1 :

combi is 1. a-1
combi is 1. a-2
combi is 1. b-1
combi is 1. b-2
Iteration 1 :Iteration 2 :

combi is 2. a-1
combi is 2. a-2
combi is 2. b-1
combi is 2. b-2


In the do of the first foreach2 I've added an echo which seems to get
called as many times per iteration as the number of the iteration. If I
add another echo to the second do task, every task seems to get called
called in a totally weird order.

Is there any obvious fix for this?

Anyway thanks a stack for the time you've devoted to this, and even if you
don't have the time to fix this, I've really appreciated your help.

Cheers, Roland.

-Message d'origine-
De : EXT / FOCAL MALAPRADE Roland [mailto:[EMAIL PROTECTED]]
Envoyé : jeudi 19 septembre 2002 09:50
À : 'Ant Users List'
Objet : RE: If anybody is interested.. [foreach] task which doesnt run
ou t of memory.


Wow! Cool! thanks a lot. I'll try it out.

Roland.

-Message d'origine-
De : Geoff Meakin [mailto:[EMAIL PROTECTED]]
Envoyé : mercredi 18 septembre 2002 18:40
À : Ant Users List
Objet : RE: If anybody is interested.. [foreach] task which doesnt run
out of memory.


Dear Roland,

Yes, the difficulty comes in with the fact that
IfTask isnt really an org.apache.tools.ant.Task
but is a ConditionBase instead, with private
then and else Sequentials, so I cant access
them, and notify them that they need to reset
their properties.

I've changed this by modifying execute() on
Sequential so that it resets its properties from
there instead, so your example now works (as does
mine). This now happens with all Sequentials,
but I cant see how that should have any adverse
effects.

If you're happy with this, you can get
the new version (ForEach2 v0.8.1) from the same
place.

Thanks for pointing this out :)

Cheers
-Geoff


-Original Message-
From: EXT / FOCAL MALAPRADE Roland [mailto:[EMAIL PROTECTED]]
Sent: 18 September 2002 02:42 PM
To: 'Ant Users List'
Subject: RE: If anybody is interested.. [foreach] task which doesnt run
out of memory.


I've been trying to use it with an if task as so:

target name=main
  foreach2 param=letter list=a,b,c
do
  if
isset property=letter/
then
  foreach2 param=number list=1,2,3
do
  if
isset property=letter/
then
  echo message=combi is ${letter}${number}/
/then
else
  echo message=number not set /
/else
  /if
/do
  /foreach2
/then
else
  echo message=letter not set /
/else
  /if
/do
  /foreach2

and this build script displays:
main:
 [echo] combi is a1
 [echo] combi is a1
 [echo] combi is a1
 [echo] combi is a1
 [echo] combi is a1
 [echo] combi is a1
 [echo] combi is a1
 [echo] combi is a1
 [echo] combi is a1

Do you know why this is?

/target-Message d'origine-
De : Geoff Meakin [mailto:[EMAIL PROTECTED]]
Envoyé : mercredi 18 septembre 2002 15:09
À : Ant Users List
Objet : RE: If anybody is interested.. [foreach] task which doesnt run
out of memory.


Yes, it appears so:

target name=main
  foreach2 param=letter list=a,b,c
do
  foreach2 param=number list=1,2,3
do
  echo message=combi is ${letter}${number}/
/do
  /foreach2
/do
  /foreach2
/target

Gives the output:

combi is a1
combi is a2
combi is a3

RE: If anybody is interested.. [foreach] task which doesnt run out of memory.

2002-09-18 Thread EXT / FOCAL MALAPRADE Roland

Hi Geoff,

I was wondering, can foreach2 tasks be nested inside each other?

Roland.

-Message d'origine-
De : Matt Benson [mailto:[EMAIL PROTECTED]]
Envoye : vendredi 13 septembre 2002 17:09
A : Ant Users List
Objet : RE: If anybody is interested.. [foreach] task which doesnt run
out of memory.


Yes, but the fact that the property is left set to the
last used value doesn't sit well with me.  It feels
like this would deprive you of something you have with
the official foreach:  the ability to use the param
name as a property later.  I guess this is just an
opinion question.  Other than that it seems like a
good idea though.

-Matt

--- Geoff Meakin [EMAIL PROTECTED] wrote:
  foreach2 param=srcfile
fileset dir=base
  include name=**/*.txt/
/fileset
do
  echo message=Found the following text file:
  ${srcfile}/
/do
  /foreach2
 
 In the example here, the value of the property
 ${srcfile} will be changed
 everytime the loop iterates. It isn't reset at the
 end of the loop (I
 thought about doing that) as the property might
 still be useful outside the
 foreach2 task, and there is no real reason to reset
 it, as that would give
 the property scope, and properties generally dont
 have scope in ANT. The ANT
 API still allows you to easily modify property
 values, even if this
 functionality has been taken away from property
 and condition, so it
 uses that mechanism to change the value of the
 property. Also- there really
 isnt a concept of params as such, as there was
 before (i.e. passing
 multiple properties to the called anttask)- because
 no target is being
 AntCalled.. The nested tasks have the same
 environment as the foreach task
 so they can access anything which is available.
 
 As an alternative example, the code:
 foreach2 param=letter list=a,b,c,d,e
   doecho message=Letter ${letter}//do
 /foreach2
 
 Will produce the following output:
 Letter a
 Letter b
 Letter c
 Letter d
 Letter e
 
 And is in effect the same as doing:
 property name=letter value=aecho
 message=Letter ${letter}/
 property name=letter value=becho
 message=Letter ${letter}/
 property name=letter value=cecho
 message=Letter ${letter}/
 property name=letter value=decho
 message=Letter ${letter}/
 property name=letter value=eecho
 message=Letter ${letter}/
 
 (if property allowed you to override the previous
 value that is (like in
 ANT1.4))
 
 This is because each time the echo task is run,
 (one for each letter in
 the list), the value of the property
 ${letter} is equal to whichever letter in the list
 is being dealt with.
 
 Does this help at all?
 Cheers
 -Geoff
 
 This sounds good, but how do you handle params? 
 Are
 you changing properties to do this and then
 unsetting
 them at the end of the loop, or what?
 
 
 --
 To unsubscribe, e-mail:  
 mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
 mailto:[EMAIL PROTECTED]
 


__
Do you Yahoo!?
Yahoo! News - Today's headlines
http://news.yahoo.com

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: If anybody is interested.. [foreach] task which doesnt run out of memory.

2002-09-18 Thread Geoff Meakin

Yes, it appears so:

target name=main
  foreach2 param=letter list=a,b,c
do
  foreach2 param=number list=1,2,3
do
  echo message=combi is ${letter}${number}/
/do
  /foreach2
/do
  /foreach2
/target

Gives the output:

combi is a1
combi is a2
combi is a3
combi is b1
combi is b2
combi is b3
combi is c1
combi is c2
combi is c3

Cheers
-Geoff


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: If anybody is interested.. [foreach] task which doesnt run out of memory.

2002-09-18 Thread EXT / FOCAL MALAPRADE Roland

I've been trying to use it with an if task as so:

target name=main
  foreach2 param=letter list=a,b,c
do
  if
isset property=letter/
then
  foreach2 param=number list=1,2,3
do
  if
isset property=letter/
then
  echo message=combi is ${letter}${number}/
/then
else
  echo message=number not set /
/else
  /if
/do
  /foreach2
/then
else
  echo message=letter not set /
/else
  /if
/do
  /foreach2

and this build script displays:
main:
 [echo] combi is a1
 [echo] combi is a1
 [echo] combi is a1
 [echo] combi is a1
 [echo] combi is a1
 [echo] combi is a1
 [echo] combi is a1
 [echo] combi is a1
 [echo] combi is a1

Do you know why this is?

/target-Message d'origine-
De : Geoff Meakin [mailto:[EMAIL PROTECTED]]
Envoyé : mercredi 18 septembre 2002 15:09
À : Ant Users List
Objet : RE: If anybody is interested.. [foreach] task which doesnt run
out of memory.


Yes, it appears so:

target name=main
  foreach2 param=letter list=a,b,c
do
  foreach2 param=number list=1,2,3
do
  echo message=combi is ${letter}${number}/
/do
  /foreach2
/do
  /foreach2
/target

Gives the output:

combi is a1
combi is a2
combi is a3
combi is b1
combi is b2
combi is b3
combi is c1
combi is c2
combi is c3

Cheers
-Geoff


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: If anybody is interested.. [foreach] task which doesnt run out of memory.

2002-09-18 Thread Matt Benson

Now THAT is cool!

-Matt

--- Geoff Meakin [EMAIL PROTECTED] wrote:
 Yes, it appears so:
 
 target name=main
   foreach2 param=letter list=a,b,c
 do
   foreach2 param=number list=1,2,3
 do
   echo message=combi is
 ${letter}${number}/
 /do
   /foreach2
 /do
   /foreach2
 /target
 
 Gives the output:
 
 combi is a1
 combi is a2
 combi is a3
 combi is b1
 combi is b2
 combi is b3
 combi is c1
 combi is c2
 combi is c3
 
 Cheers
 -Geoff
 
 
 --
 To unsubscribe, e-mail:  
 mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
 mailto:[EMAIL PROTECTED]
 


__
Do you Yahoo!?
Yahoo! News - Today's headlines
http://news.yahoo.com

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: If anybody is interested.. [foreach] task which doesnt run out of memory.

2002-09-18 Thread Geoff Meakin

Dear Roland,

Yes, the difficulty comes in with the fact that
IfTask isnt really an org.apache.tools.ant.Task
but is a ConditionBase instead, with private
then and else Sequentials, so I cant access
them, and notify them that they need to reset
their properties.

I've changed this by modifying execute() on
Sequential so that it resets its properties from
there instead, so your example now works (as does
mine). This now happens with all Sequentials,
but I cant see how that should have any adverse
effects.

If you're happy with this, you can get
the new version (ForEach2 v0.8.1) from the same
place.

Thanks for pointing this out :)

Cheers
-Geoff


-Original Message-
From: EXT / FOCAL MALAPRADE Roland [mailto:[EMAIL PROTECTED]]
Sent: 18 September 2002 02:42 PM
To: 'Ant Users List'
Subject: RE: If anybody is interested.. [foreach] task which doesnt run
out of memory.


I've been trying to use it with an if task as so:

target name=main
  foreach2 param=letter list=a,b,c
do
  if
isset property=letter/
then
  foreach2 param=number list=1,2,3
do
  if
isset property=letter/
then
  echo message=combi is ${letter}${number}/
/then
else
  echo message=number not set /
/else
  /if
/do
  /foreach2
/then
else
  echo message=letter not set /
/else
  /if
/do
  /foreach2

and this build script displays:
main:
 [echo] combi is a1
 [echo] combi is a1
 [echo] combi is a1
 [echo] combi is a1
 [echo] combi is a1
 [echo] combi is a1
 [echo] combi is a1
 [echo] combi is a1
 [echo] combi is a1

Do you know why this is?

/target-Message d'origine-
De : Geoff Meakin [mailto:[EMAIL PROTECTED]]
Envoyé : mercredi 18 septembre 2002 15:09
À : Ant Users List
Objet : RE: If anybody is interested.. [foreach] task which doesnt run
out of memory.


Yes, it appears so:

target name=main
  foreach2 param=letter list=a,b,c
do
  foreach2 param=number list=1,2,3
do
  echo message=combi is ${letter}${number}/
/do
  /foreach2
/do
  /foreach2
/target

Gives the output:

combi is a1
combi is a2
combi is a3
combi is b1
combi is b2
combi is b3
combi is c1
combi is c2
combi is c3

Cheers
-Geoff


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




If anybody is interested.. [foreach] task which doesnt run out of memory.

2002-09-13 Thread Geoff Meakin

I've adapted the [foreach] task so that it doesnt run out of memory, because
it no
longer uses an implicit antcall, but has nested tasks in it instead. Its
also a lot
faster.

I.e.

foreach2 param=srcfile
  fileset dir=base
include name=**/*.txt/
  /fileset
  do
echo message=Found the following text file: ${srcfile}/
  /do
/foreach2


If anybody is interested let me know and I'll tell you where you can get it.
It has minor limitations, (can run Sequential, but not Parallel nested
tasks)
but (AFAIK) not many. I've cleaned it up a bit after I sent it to
ant-contrib
and ant-dev, so its documented and list works too.. however I doubt it will
ever be included in ant-contrib or ant-dev. It works with ANT1.5b1

Cheers
-Geoff


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: Avoiding foreach task

2002-09-11 Thread Stefan Bodewig

On Wed, 11 Sep 2002, Matthew Rawlings
[EMAIL PROTECTED] wrote:

 By searching the mail lists I understand using the foreach task is
 frowned upon. Is this correct?

The short answer is yes.  I think you've found the long answer by
reading the archives.

 How can I gunzip all the files in a directory that match a
 pattern?

You can't (at least not yet).

 The gunzip task only operates on one file at a time. What was the
 design decision not to make it operate on a fileset?

It probably never occured to the original task writer that somebody
wanted to do that.  If you want to file an enhancement request or
maybe even code up that functionality, I'm rather positive it would
make it into Ant 1.6.

Stefan

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Avoiding foreach task

2002-09-10 Thread Matthew Rawlings

By searching the mail lists I understand using the foreach task is frowned upon. Is 
this correct?

How can I gunzip all the files in a directory that match a pattern? The gunzip 
task only operates on one file at a time. What was the design decision not to make it 
operate on a fileset?

Any help explaining the ANT idiom is much appreciated - Matthew.




RE: Possible Modifications to ForEach Task

2002-07-10 Thread David Colton (ext. 799)

Stefan, All.

Here is my hack to let the ant-contrib foreach task optionally
inheritRefs. (Excuse the package naming - done for my convenience)

 ForEach.java 
I have only tested on what I want it to do and it seems to work as expected.
I am blocked from using CVS to an external site so if you find this an
acceptable modification could some please commit for me.

Dave.


 -Original Message-
 From: David Colton (ext. 799) 
 Sent: Wednesday, July 10, 2002 3:18 PM
 To:   'Stefan Bodewig'
 Subject:  Possible Modifications to ForEach Task
 
 Stefen.
 
 I hope you don't mind me contacting you directly on this matter but it is
 strictly an ant-contrib matter.
 
 I really would like the foreach task to inheritRefs, or at least be able
 to specify the option. I have looked at the code for the task and it
 shouldn't be too difficult to do.
 
 What do you think ?
 
 David Colton
 Production Team Lead (Technical Architecture)
 _
 
 FINEOS
 Pembroke House
 8 - 10 Lower Pembroke St
 Dublin 2
 
 Email :   [EMAIL PROTECTED]
 Ph  : +353 1 6399799
 Fax : +353 1 6399701
 
 Why don't you visit our website at http://www.FINEOS.com
 
 ENTERPRISE SOLUTIONS FOR BANKING AND INSURANCE
 _
 
 
 


**
The information contained in this e-mail is confidential,
may be privileged and is intended only for the use of the
recipient named above. If you are not the intended
recipient or a representative of the intended recipient,
you have received this e-mail in error and must not copy,
use or disclose the contents of this email to anybody
else. If you have received this e-mail in error, please
notify the sender immediately by return e-mail and
permanently delete the copy you received. This email has
been swept for computer viruses. However, you should
carry out your own virus checks.


Registered in Ireland, No. 205721. http://www.FINEOS.com
**




ForEach.java
Description: Binary data

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]


RE: foreach task

2001-12-08 Thread Christopher Berry


Attached. It works w/ Ant 1.4 
Cheers,
-- Chris

 -Original Message-
 From: Zhao, Jasmine [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, December 05, 2001 6:15 PM
 To: '[EMAIL PROTECTED]'
 Subject: foreach task
 
 
 Hi 
 Can anyone send me a copy for foreach task?
 
 thanx
 Jasmin
 
 
 ---
 --
 This message may contain privileged and/or confidential 
 information subject
 to a confidentiality agreement or copyright material of Clarity
 International Ltd or third parties. You should only 
 re-transmit, distribute
 or commercialise the material if you are authorised to do so. 
 If you are not an authorised recipient of this email, please 
 contact Clarity
 International Ltd immediately by return email or by telephone 
 on +61-2-9925
 5000. 
 In such case, you may not read, print, store, copy or deliver 
 this message
 to anyone, and you should not act in reliance on this email or any
 attachment to it. 
 Clarity provides no warranty that the material contained in 
 this email or
 any attachment to it is free from any virus, defect or error. 
 Opinions in
 this message are those of the sender and unless stated 
 otherwise, are not
 endorsed by Clarity.
 
 --
 To unsubscribe, e-mail:   
 mailto:[EMAIL PROTECTED]
 For 
 additional commands, e-mail: mailto:[EMAIL PROTECTED]
 




ForeachTask.java
Description: Binary data

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]


foreach task

2001-12-05 Thread Zhao, Jasmine

Hi 
Can anyone send me a copy for foreach task?

thanx
Jasmin


-
This message may contain privileged and/or confidential information subject
to a confidentiality agreement or copyright material of Clarity
International Ltd or third parties. You should only re-transmit, distribute
or commercialise the material if you are authorised to do so. 
If you are not an authorised recipient of this email, please contact Clarity
International Ltd immediately by return email or by telephone on +61-2-9925
5000. 
In such case, you may not read, print, store, copy or deliver this message
to anyone, and you should not act in reliance on this email or any
attachment to it. 
Clarity provides no warranty that the material contained in this email or
any attachment to it is free from any virus, defect or error. Opinions in
this message are those of the sender and unless stated otherwise, are not
endorsed by Clarity.

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: Error with the foreach task

2001-07-03 Thread Mark Womack

Diane,

Thanks.  I updated to the current CVS version of Ant.java, rebuilt the jars,
and the problem is resolved.  Is there any chance of an interim 1.3.1
version (with just bug fixes) being released?  I am a little uncomfortable
having a custom, modified version of the ant jar.  I'd rather have an
official version and a directory of extra/optional task classes.

as always, thanks!
-Mark

-Original Message-
From: Diane Holt [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 02, 2001 8:24 PM
To: [EMAIL PROTECTED]
Subject: RE: Error with the foreach task


See:
  http://marc.theaimsgroup.com/?l=ant-devm=98838238130156w=2

Diane

--- Mark Womack [EMAIL PROTECTED] wrote:
 I did a little more digging into the exception.  Line 206 in Ant.java is
 this:
 
   // Are we trying to call the target in which we are defined?
   if (p1.getBaseDir().equals(project.getBaseDir()) 
   p1.getProperty(ant.file).equals(project.getProperty(ant.file))
 
   target.equals(this.getOwningTarget().getName())) { 
  throw new BuildException(ant task calling its own parent
 target);
   }
 
 I'm guessing, from looking at the surrounding code, that the
 p1.getBaseDir()
 call is returning null.  This suggests that something is not set up
 correctly when calling the target from the foreach tag?  My project
 has
 a basedir attribute of ..
 
 I have tried embedding echo tags in the target called by foreach, but
 nothing gets printed.  I tried other tasks besides javac, and they crash
 with the same error.
 
 So, I am stumped.  I am using Ant 1.3.  Is that an issue?
 
 Thanks,
 -Mark
 
 -Original Message-
 From: Mark Womack 
 Sent: Monday, July 02, 2001 11:48 AM
 To: '[EMAIL PROTECTED]'
 Subject: Error with the foreach task
 
 
 This is probably something obvious that I am missing.  But I have
 defined
 the following targets:
 
 taskdef name=foreach
 classname=org.apache.tools.ant.taskdefs.optional.ForeachTask/
 target name=build_experimental depends=init, prepare_dirs
   foreach target=build_experimental_dir type=dir
 param name=src.subdir
   fileset dir=${build.java} includes=*/
 /param
   /foreach
 /target
 
 target name=build_experimental_dir
   javac srcdir=${build.java}
  destdir=${build.classes}
  includes=${src.subdir}/*.java
  classpath=${CLASSPATH}
 patternset excludesfile=${build.java}/build_excludes /
   /javac
 /target
 
 Took me a while to figure out I needed to add the taskdef.  But after
 adding that, I still get the following error:
 
 build_experimental:
 
 BUILD FAILED
 
 java.lang.NullPointerException
 at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:206)
 at
 org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:103)
 at
 org.apache.tools.ant.taskdefs.optional.ForeachTask.executeTarget(Fore
 achTask.java:246)
 at
 org.apache.tools.ant.taskdefs.optional.ForeachTask.executeParameters(
 ForeachTask.java:263)
 at
 org.apache.tools.ant.taskdefs.optional.ForeachTask.executeParameters(
 ForeachTask.java:273)
 at
 org.apache.tools.ant.taskdefs.optional.ForeachTask.execute(ForeachTas
 k.java:284)
 at org.apache.tools.ant.Target.execute(Target.java:153)
 at org.apache.tools.ant.Project.runTarget(Project.java:898)
 at org.apache.tools.ant.Project.executeTarget(Project.java:536)
 at org.apache.tools.ant.Project.executeTargets(Project.java:510)
 at org.apache.tools.ant.Main.runBuild(Main.java:421)
 at org.apache.tools.ant.Main.main(Main.java:149)
 
 It is unclear to me what is causing the null pointer exception.  Is
 there
 something I can turn on in ant that will help me debug this?  Does
 anyone
 see an obvious problem with the task definitions or the way I am using
 foreach that I am missing?
 
 Thanks!
 -Mark


=
([EMAIL PROTECTED])



__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/



Error with the foreach task

2001-07-02 Thread Mark Womack

This is probably something obvious that I am missing.  But I have defined
the following targets:

taskdef name=foreach
classname=org.apache.tools.ant.taskdefs.optional.ForeachTask/
target name=build_experimental depends=init, prepare_dirs
  foreach target=build_experimental_dir type=dir
param name=src.subdir
  fileset dir=${build.java} includes=*/
/param
  /foreach
/target

target name=build_experimental_dir
  javac srcdir=${build.java}
 destdir=${build.classes}
 includes=${src.subdir}/*.java
 classpath=${CLASSPATH}
patternset excludesfile=${build.java}/build_excludes /
  /javac
/target

Took me a while to figure out I needed to add the taskdef.  But after
adding that, I still get the following error:

build_experimental:

BUILD FAILED

java.lang.NullPointerException
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:206)
at
org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:103)
at
org.apache.tools.ant.taskdefs.optional.ForeachTask.executeTarget(Fore
achTask.java:246)
at
org.apache.tools.ant.taskdefs.optional.ForeachTask.executeParameters(
ForeachTask.java:263)
at
org.apache.tools.ant.taskdefs.optional.ForeachTask.executeParameters(
ForeachTask.java:273)
at
org.apache.tools.ant.taskdefs.optional.ForeachTask.execute(ForeachTas
k.java:284)
at org.apache.tools.ant.Target.execute(Target.java:153)
at org.apache.tools.ant.Project.runTarget(Project.java:898)
at org.apache.tools.ant.Project.executeTarget(Project.java:536)
at org.apache.tools.ant.Project.executeTargets(Project.java:510)
at org.apache.tools.ant.Main.runBuild(Main.java:421)
at org.apache.tools.ant.Main.main(Main.java:149)

It is unclear to me what is causing the null pointer exception.  Is there
something I can turn on in ant that will help me debug this?  Does anyone
see an obvious problem with the task definitions or the way I am using
foreach that I am missing?

Thanks!
-Mark



RE: Error with the foreach task

2001-07-02 Thread Mark Womack

I did a little more digging into the exception.  Line 206 in Ant.java is
this:

  // Are we trying to call the target in which we are defined?
  if (p1.getBaseDir().equals(project.getBaseDir()) 
  p1.getProperty(ant.file).equals(project.getProperty(ant.file)) 
  target.equals(this.getOwningTarget().getName())) { 
 throw new BuildException(ant task calling its own parent target);
  }

I'm guessing, from looking at the surrounding code, that the p1.getBaseDir()
call is returning null.  This suggests that something is not set up
correctly when calling the target from the foreach tag?  My project has
a basedir attribute of ..

I have tried embedding echo tags in the target called by foreach, but
nothing gets printed.  I tried other tasks besides javac, and they crash
with the same error.

So, I am stumped.  I am using Ant 1.3.  Is that an issue?

Thanks,
-Mark

-Original Message-
From: Mark Womack 
Sent: Monday, July 02, 2001 11:48 AM
To: '[EMAIL PROTECTED]'
Subject: Error with the foreach task


This is probably something obvious that I am missing.  But I have defined
the following targets:

taskdef name=foreach
classname=org.apache.tools.ant.taskdefs.optional.ForeachTask/
target name=build_experimental depends=init, prepare_dirs
  foreach target=build_experimental_dir type=dir
param name=src.subdir
  fileset dir=${build.java} includes=*/
/param
  /foreach
/target

target name=build_experimental_dir
  javac srcdir=${build.java}
 destdir=${build.classes}
 includes=${src.subdir}/*.java
 classpath=${CLASSPATH}
patternset excludesfile=${build.java}/build_excludes /
  /javac
/target

Took me a while to figure out I needed to add the taskdef.  But after
adding that, I still get the following error:

build_experimental:

BUILD FAILED

java.lang.NullPointerException
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:206)
at
org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:103)
at
org.apache.tools.ant.taskdefs.optional.ForeachTask.executeTarget(Fore
achTask.java:246)
at
org.apache.tools.ant.taskdefs.optional.ForeachTask.executeParameters(
ForeachTask.java:263)
at
org.apache.tools.ant.taskdefs.optional.ForeachTask.executeParameters(
ForeachTask.java:273)
at
org.apache.tools.ant.taskdefs.optional.ForeachTask.execute(ForeachTas
k.java:284)
at org.apache.tools.ant.Target.execute(Target.java:153)
at org.apache.tools.ant.Project.runTarget(Project.java:898)
at org.apache.tools.ant.Project.executeTarget(Project.java:536)
at org.apache.tools.ant.Project.executeTargets(Project.java:510)
at org.apache.tools.ant.Main.runBuild(Main.java:421)
at org.apache.tools.ant.Main.main(Main.java:149)

It is unclear to me what is causing the null pointer exception.  Is there
something I can turn on in ant that will help me debug this?  Does anyone
see an obvious problem with the task definitions or the way I am using
foreach that I am missing?

Thanks!
-Mark



RE: Error with the foreach task

2001-07-02 Thread Diane Holt

See:
  http://marc.theaimsgroup.com/?l=ant-devm=98838238130156w=2

Diane

--- Mark Womack [EMAIL PROTECTED] wrote:
 I did a little more digging into the exception.  Line 206 in Ant.java is
 this:
 
   // Are we trying to call the target in which we are defined?
   if (p1.getBaseDir().equals(project.getBaseDir()) 
   p1.getProperty(ant.file).equals(project.getProperty(ant.file))
 
   target.equals(this.getOwningTarget().getName())) { 
  throw new BuildException(ant task calling its own parent
 target);
   }
 
 I'm guessing, from looking at the surrounding code, that the
 p1.getBaseDir()
 call is returning null.  This suggests that something is not set up
 correctly when calling the target from the foreach tag?  My project
 has
 a basedir attribute of ..
 
 I have tried embedding echo tags in the target called by foreach, but
 nothing gets printed.  I tried other tasks besides javac, and they crash
 with the same error.
 
 So, I am stumped.  I am using Ant 1.3.  Is that an issue?
 
 Thanks,
 -Mark
 
 -Original Message-
 From: Mark Womack 
 Sent: Monday, July 02, 2001 11:48 AM
 To: '[EMAIL PROTECTED]'
 Subject: Error with the foreach task
 
 
 This is probably something obvious that I am missing.  But I have
 defined
 the following targets:
 
 taskdef name=foreach
 classname=org.apache.tools.ant.taskdefs.optional.ForeachTask/
 target name=build_experimental depends=init, prepare_dirs
   foreach target=build_experimental_dir type=dir
 param name=src.subdir
   fileset dir=${build.java} includes=*/
 /param
   /foreach
 /target
 
 target name=build_experimental_dir
   javac srcdir=${build.java}
  destdir=${build.classes}
  includes=${src.subdir}/*.java
  classpath=${CLASSPATH}
 patternset excludesfile=${build.java}/build_excludes /
   /javac
 /target
 
 Took me a while to figure out I needed to add the taskdef.  But after
 adding that, I still get the following error:
 
 build_experimental:
 
 BUILD FAILED
 
 java.lang.NullPointerException
 at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:206)
 at
 org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:103)
 at
 org.apache.tools.ant.taskdefs.optional.ForeachTask.executeTarget(Fore
 achTask.java:246)
 at
 org.apache.tools.ant.taskdefs.optional.ForeachTask.executeParameters(
 ForeachTask.java:263)
 at
 org.apache.tools.ant.taskdefs.optional.ForeachTask.executeParameters(
 ForeachTask.java:273)
 at
 org.apache.tools.ant.taskdefs.optional.ForeachTask.execute(ForeachTas
 k.java:284)
 at org.apache.tools.ant.Target.execute(Target.java:153)
 at org.apache.tools.ant.Project.runTarget(Project.java:898)
 at org.apache.tools.ant.Project.executeTarget(Project.java:536)
 at org.apache.tools.ant.Project.executeTargets(Project.java:510)
 at org.apache.tools.ant.Main.runBuild(Main.java:421)
 at org.apache.tools.ant.Main.main(Main.java:149)
 
 It is unclear to me what is causing the null pointer exception.  Is
 there
 something I can turn on in ant that will help me debug this?  Does
 anyone
 see an obvious problem with the task definitions or the way I am using
 foreach that I am missing?
 
 Thanks!
 -Mark


=
([EMAIL PROTECTED])



__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/



RE: Foreach task)

2001-06-13 Thread Brett Knights

Forgive me for butting in but I added a for-each type capability to the sql task and 
it wasn't much work nor would I see it as that
difficult to maintain.

What would be wrong with:

a) creating an abstract FileSet aware task that task creators could extend if desired 
(or create a FileSetHelper class that would
make supporting a fileset really easy (though the use of reflection within Ant seems 
to make it already pretty easy))
b) re-write most of the core Ant tasks to use FileSets
c) promote this in the how-to-build-an-Ant-task documentation.

I'd like further to see FileSet itself modified to take a mapper that would 
filter/transform the fileset to provide a list of files
on which to perform the parent task. The only requirement for the mapper interface 
would be that it takes an array of Files and
returns an array of Files. Other arguments would be optional.

HTH

 -Original Message-
 From: Stefan Bodewig [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, June 12, 2001 1:04 AM
 To: [EMAIL PROTECTED]
 Subject: Re: Foreach task)


 Peter Donald [EMAIL PROTECTED] wrote:

  At 09:29 AM 6/12/01 +0200, Stefan Bodewig wrote:
 Peter Donald [EMAIL PROTECTED] wrote:
 
  At 09:20 AM 6/12/01 +0200, Stefan Bodewig wrote:
 Peter Donald [EMAIL PROTECTED] wrote:
 
  (3) Remove iteration from all tasks and core and implement it in
  another layer ;)
 
 In another layer that is not a task?
 
  yup ;)
 
 Care to expand?
 
  Okay - but remember you asked for the can of worms to be opened ;)

 Hmm, should have asked whether you were talking about
 templates first 8-)

 Thanks

 Stefan





Re: looping (RE: Foreach task)

2001-06-12 Thread Peter Donald

At 12:16 PM 6/11/01 -0400, [EMAIL PROTECTED] wrote:

= On Mon, 11 Jun 2001 23:06:34 +1000, Peter Donald [EMAIL PROTECTED]
said:

[...]

 However the usecase that ant needs is executing the same set of tasks with
 different parameters. ie Repeat tasks t1 - tn with different values for A,
 B and C properties. It is really useful when you need to repeate the set of
 operations over a large number of datasets (ie if you have 30 taglibs that
 all require same steps to generate compile and deploy etc).


OK, this feels to my ant-naive perceptions like a case of what I quoted.
I'll
spit out a straw man, and tell me where I'm missing your point?

fileset name=tld-targets
 30 taglib names/
/fileset

target t0
  compile a big load of stuff/
/target


target t1 depends=t0

  frobtaglib
mytargetsref=tld-targets/

!-- Frobtaglib identifies a set of source/target mappings inferred from
the target fileset.  Let's say it makes .jar s --

  /frobtaglib

/target

target t2 depends=t1
  twiddletaglib/
   mytargetsref=tld-targets/
   !--  And so on --
  /twiddletaglib

/target


The critical difference is:

(forall $Thing: T1,T2,T3)

vs.

(forall $Thing: T1)
(forall $Thing: T2)
(forall $Thing: T3)


I assert that, for any real case of T1,T2,T3 it is possible to 'phrase' the
goal in either idiom.  I welcome attempts at counterexamples. The
complexities
and pitfalls of the transform sets of files are different than those of the
run scripts on individual files.  But I bet they are in fact provably
equivalent.

...

And one of them is ant-y.  The other one is anti-ant-y.

Sorry - you lost me ;) I think your thesis is that anything that;

If the work performing a set of operations on a set of data then you can
either  do it in one of two ways;
a. Repeat set of operations for each data item in set
or
b. Repeat each operation on a set of data

Is that correct? If so then I would agree *if* there was no
interdependecies by the output produced. In many hand-maintained build
systems the build file writer (whether it be make/ant/whatever) will
sometimes rely on sequence as a cheap dependency mechanism. 

ie I will rely on the fact that library foo is built while building library
baz. I do this because I ordered foo before baz. If I was using method (a)
then this trick would work but if I was using method (b) then this trick
would fail.

Ant has no higher-order dependency analysis built in. GNUMake has high
order dependencies to a degree (but you need to be fairly comfortable with
make to use them) however many build files still rely on human building
build files to order them correctly (or else use tools to automate ordering
like gump or various makefile generation tools).

So while (b) is good in theory, it may not be so good in practice ;)
Cheers,

Pete

*-*
| Faced with the choice between changing one's mind, |
| and proving that there is no need to do so - almost |
| everyone gets busy on the proof.   |
|  - John Kenneth Galbraith   |
*-*




Re: Foreach task)

2001-06-12 Thread Peter Donald

At 08:09 AM 6/12/01 +0200, Stefan Bodewig wrote:
[EMAIL PROTECTED] wrote:

 'There should be no argument to any ant task which takes only a
 singular argument.  It should take a list of possibly one item, and
 promote a singular argument to a list of one if necessary.'

I've been playing with that idea for some time as well - and came to
the point that this would be much worse than a core-iterate task IMHO.

I'm not sure how you've envisioned this yourself, I see two possible
implementations:

(1) *All* tasks must deal with iteration themselves.  Well, this makes
writing tasks a lot harder than it currently is.

(2) Tasks don't have to be aware that they are dealing with sets, Ant
will invoke them once per set member.  Using this approach you add
iteration into the core instead of moving it to the task level, this
would mean adding complexity to a much bigger degree.

(3) Remove iteration from all tasks and core and implement it in another
layer ;)

Cheers,

Pete

*-*
| Faced with the choice between changing one's mind, |
| and proving that there is no need to do so - almost |
| everyone gets busy on the proof.   |
|  - John Kenneth Galbraith   |
*-*




Re: Foreach task)

2001-06-12 Thread Stefan Bodewig

Peter Donald [EMAIL PROTECTED] wrote:

 (3) Remove iteration from all tasks and core and implement it in
 another layer ;)

In another layer that is not a task?

Stefan



Re: Foreach task)

2001-06-12 Thread Stefan Bodewig

Peter Donald [EMAIL PROTECTED] wrote:

 At 09:20 AM 6/12/01 +0200, Stefan Bodewig wrote:
Peter Donald [EMAIL PROTECTED] wrote:

 (3) Remove iteration from all tasks and core and implement it in
 another layer ;)

In another layer that is not a task?
 
 yup ;)

Care to expand?

Stefan



Re: Foreach task)

2001-06-12 Thread Peter Donald

At 09:29 AM 6/12/01 +0200, Stefan Bodewig wrote:
Peter Donald [EMAIL PROTECTED] wrote:

 At 09:20 AM 6/12/01 +0200, Stefan Bodewig wrote:
Peter Donald [EMAIL PROTECTED] wrote:

 (3) Remove iteration from all tasks and core and implement it in
 another layer ;)

In another layer that is not a task?
 
 yup ;)

Care to expand?

Okay - but remember you asked for the can of worms to be opened ;) 

templating - if you remember the first example of using XSLT (posted eons
ago) they defined multiple input data items which got expanded into
appropriate underlying form. For instance you could have an input file that
looked something like

cluster
  server ip=192.168.1.1 dir=/pub/
  server ip=192.168.1.2 dir=/pub/somedir/
  server ip=192.168.1.3 dir=/pub/another/place/
  server ip=192.168.1.4 dir=/pub/blah/
  server ip=192.168.1.5 dir=/pub/
/cluster

products
  product name=foo package=com.biz.foo version=1.0/
  product name=bar package=com.biz.some.package.bar version=1.0/
  product name=baz package=com.biz.lalalalalalala version=1.0/
  product name=meep package=com.biz.type2.meep version=1.0/
  product name=muup package=com.biz.type2.muup version=1.0/
  product name=moop package=com.biz.type2.moop version=1.0/
/products

When this is passed through template, each product would be expanded to a
set of tasks such as.

 copy useing filters to replace version/
 javac/
 jar/
 signjar/
 scp jar to server1 /
 scp jar to server2 /
 scp jar to server3 /
  ...

The transformation from input-data to tasks would be via some rule/template
system (ie XSLT) and in theory could be implemented in any number of ways
(most obvious optimization would be to copy and compile all java classes at
once). 



Cheers,

Pete

*-*
| Faced with the choice between changing one's mind, |
| and proving that there is no need to do so - almost |
| everyone gets busy on the proof.   |
|  - John Kenneth Galbraith   |
*-*




Re: Foreach task)

2001-06-12 Thread Stefan Bodewig

Peter Donald [EMAIL PROTECTED] wrote:

 At 09:29 AM 6/12/01 +0200, Stefan Bodewig wrote:
Peter Donald [EMAIL PROTECTED] wrote:

 At 09:20 AM 6/12/01 +0200, Stefan Bodewig wrote:
Peter Donald [EMAIL PROTECTED] wrote:

 (3) Remove iteration from all tasks and core and implement it in
 another layer ;)

In another layer that is not a task?
 
 yup ;)

Care to expand?
 
 Okay - but remember you asked for the can of worms to be opened ;) 

Hmm, should have asked whether you were talking about templates first 8-)

Thanks

Stefan



RE: looping (RE: Foreach task)

2001-06-12 Thread Christopher Berry

 
 The way I'd solve this problem in app management ( which is 
 not necessarily
 the same as the problem in ant ) is to have a separate 
 task/script/whatever
 that reproducably generated a list of the interesting apps.  
 This would
 probably start with something vaguely like a
 
 find . -name build.xml -ls \
| decide-if-my-map-needs-updating \
| munge-list-into-properties-enumeration  \
 to-be-included-in-build.xml
 
 But I tend to see it as a meta-build problem.  And you see, 
 the problem is
 -not- how do I run ant on a bunch of dependant build.xml 
 files, but rather,
 how do I specify a changing set of build.xml files, oh and I 
 think I'd like
 to do it -this- way.
 

But aren't portability and simplicity also goals?? Scripts tend to be
non-portable (although Jython is a 100% Java possibility here), and
defintely result in more artifacts. And to my sensibility, it is nice having
a seamless solution.  But yes, yours is an alternate solution. Thanks.



Re: looping (RE: Foreach task)

2001-06-11 Thread Peter Donald

At 08:02 AM 6/11/01 -0400, [EMAIL PROTECTED] wrote:
So:  What is the essence of 'iteration' for the purpose of this debate?

iteration for the purpose of this debate is something like foreach
.../. Some people try to confuse the definition to serve an agenda or
because of hangups from other build systems (ie make).

I define a set of input files Si, a set of corresponding output files So, and
a process trans(Fi) by which an individual Fi may be transformed to Fo, and
let ant figure out where it's necessary.

Is that iteration?

nope - but good (GNU)make practices would implement this as iteration.

I define a set of input files Si, a function up-to-date(Fi) to tell if an
individual Fi has been processed, and a process trans(Fi) to do the right
thing (perhaps untar, jar, whatever)

Is that iteration?

nope - see above ;)

Both of the above would be best implemented as tasks. In Ant1 it is a PITA
to do as there is little core support for writing such things and keeping
separate task libraries is also painful. In Ant2 we have decided to build a
framework so that implementing a task to do above will be trivial.

However the usecase that ant needs is executing the same set of tasks with
different parameters. ie Repeat tasks t1 - tn with different values for A,
B and C properties. It is really useful when you need to repeate the set of
operations over a large number of datasets (ie if you have 30 taglibs that
all require same steps to generate compile and deploy etc).

Essentially in this facility the foreach is acting as a generic target with
a (possibly dynamically generated) list of input parameters. The reason
people ask for this is essentially because ant is not designed to have
generic rules.  People have implemented them as hacks via antcall/ant/dtd
includes/etc but in general this increases cost of maintaining project.

Since everyone seems to be an expert on this subject, it is likely that
no mechanism will be included in core. You will have to go to other places
(ie proposed taskdefs.org or perhaps sourceforge) to pick it up.

Cheers,

Pete

*-*
| Faced with the choice between changing one's mind, |
| and proving that there is no need to do so - almost |
| everyone gets busy on the proof.   |
|  - John Kenneth Galbraith   |
*-*




RE: Foreach task)

2001-06-11 Thread John . D . Casey

an interesting twist to this is the case where you want your build.xml 
to describe an environment where the fileset is an arbitrary number, 
which is not necessarily known at the time of buildfile authoring, or 
else has to be flexible.

For instance, using the FTP task to deploy the results of the build to 
all servers in a cluster...the build process itself doesn't change when 
you add another server to the cluster. In this case the for-each 
fileset... description is very elegant. Hard-coding for every case 
(unrolling the loop) is absurd, and masking the deployment action off 
with a custom tag actually DECREASES the level of description of the 
build itself.

How is the right way to handle a situation like this?
If it comes down to running a build by hand for each server, what's the 
big advantage in using Ant in the first place, over say a BAT file?

Regards,
John

-Original Message-
From: asr [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 11, 2001 11:17 AM
To: ant-user
Cc: asr
Subject: Re: looping (RE: Foreach task)



= On Mon, 11 Jun 2001 23:06:34 +1000, Peter Donald 
[EMAIL PROTECTED] said:

[...]

 However the usecase that ant needs is executing the same set of tasks 
with
 different parameters. ie Repeat tasks t1 - tn with different values 
for A,
 B and C properties. It is really useful when you need to repeate the 
set of
 operations over a large number of datasets (ie if you have 30 taglibs 
that
 all require same steps to generate compile and deploy etc).


OK, this feels to my ant-naive perceptions like a case of what I 
quoted.  I'll
spit out a straw man, and tell me where I'm missing your point?

fileset name=tld-targets
 30 taglib names/
/fileset

target t0
  compile a big load of stuff/
/target


target t1 depends=t0

  frobtaglib
mytargetsref=tld-targets/

!-- Frobtaglib identifies a set of source/target mappings inferred 
from
 the target fileset.  Let's say it makes .jar s --

  /frobtaglib

/target

target t2 depends=t1
  twiddletaglib/
   mytargetsref=tld-targets/
   !--  And so on --
  /twiddletaglib

/target


The critical difference is:

(forall $Thing: T1,T2,T3)

vs.

(forall $Thing: T1)
(forall $Thing: T2)
(forall $Thing: T3)


I assert that, for any real case of T1,T2,T3 it is possible to 'phrase' 
the
goal in either idiom.  I welcome attempts at counterexamples. The 
complexities
and pitfalls of the transform sets of files are different than those 
of the
run scripts on individual files.  But I bet they are in fact provably
equivalent.

...

And one of them is ant-y.  The other one is anti-ant-y.


- Allen S. Rout



RE: Foreach task)

2001-06-11 Thread Peter Vogel

 
 For instance, using the FTP task to deploy the results of the 
 build to 
 all servers in a cluster...the build process itself doesn't 
 change when 
 you add another server to the cluster. In this case the for-each 
 fileset... description is very elegant. Hard-coding for every case 
 (unrolling the loop) is absurd, and masking the deployment action off 
 with a custom tag actually DECREASES the level of description of the 
 build itself.

My point exactly!!!  Glad to hear I'm not a lone voice in the wilderness
on this one...

 
 How is the right way to handle a situation like this?
 If it comes down to running a build by hand for each server, 
 what's the 
 big advantage in using Ant in the first place, over say a BAT file?


The *right* way would be for a couple of terms that are used anytime a 
human describes a build process to find their way into the ant core:
foreach, if

Not as a scripting word, but as a descriptive word, for example:
foreach of the tarballs in this dir, ftp and untar them on 
each of the machines listed.

Note that out of dateness may or may not be an aspect of the desired 
iteration.  For example, in the case of exploding a tarball, its probably
more useful to explode the tarball and not check whether every file in the
exploded directory is already up to date w.r.t. the contents of the tarball,
in other cases uptodate checking might be desireable.  

-Peter
 
 -Original Message-
 From: asr [mailto:[EMAIL PROTECTED]]
 Sent: Monday, June 11, 2001 11:17 AM
 To: ant-user
 Cc: asr
 Subject: Re: looping (RE: Foreach task)
 
 
 
 = On Mon, 11 Jun 2001 23:06:34 +1000, Peter Donald 
 [EMAIL PROTECTED] said:
 
 [...]
 
  However the usecase that ant needs is executing the same 
 set of tasks 
 with
  different parameters. ie Repeat tasks t1 - tn with 
 different values 
 for A,
  B and C properties. It is really useful when you need to 
 repeate the 
 set of
  operations over a large number of datasets (ie if you have 
 30 taglibs 
 that
  all require same steps to generate compile and deploy etc).
 
 
 OK, this feels to my ant-naive perceptions like a case of what I 
 quoted.  I'll
 spit out a straw man, and tell me where I'm missing your point?
 
 fileset name=tld-targets
  30 taglib names/
 /fileset
 
 target t0
   compile a big load of stuff/
 /target
 
 
 target t1 depends=t0
 
   frobtaglib
 mytargetsref=tld-targets/
 
 !-- Frobtaglib identifies a set of source/target 
 mappings inferred 
 from
the target fileset.  Let's say it makes .jar s --
 
   /frobtaglib
 
 /target
 
 target t2 depends=t1
   twiddletaglib/
mytargetsref=tld-targets/
!--  And so on --
   /twiddletaglib
 
 /target
 
 
 The critical difference is:
 
 (forall $Thing: T1,T2,T3)
 
 vs.
 
 (forall $Thing: T1)
 (forall $Thing: T2)
 (forall $Thing: T3)
 
 
 I assert that, for any real case of T1,T2,T3 it is possible 
 to 'phrase' 
 the
 goal in either idiom.  I welcome attempts at counterexamples. The 
 complexities
 and pitfalls of the transform sets of files are different 
 than those 
 of the
 run scripts on individual files.  But I bet they are in 
 fact provably
 equivalent.
 
 ...
 
 And one of them is ant-y.  The other one is anti-ant-y.
 
 
 - Allen S. Rout
 



RE: looping (RE: Foreach task)

2001-06-11 Thread Christopher Berry

Greetings,

As the one who (innocently) began this debate, I will chime in. Although I
suspect that this argument has become religious, and as such, neither side
is listening to the other anymore...

In my current build, I have used foreach three times, and I do not see an
alternate approach. 

1) Loop over all TAR.GZ files in a directory and unpack them -- using a
generic unpack-GZfile-build.xml which takes the base filename as a supplied
property. I do not think one could do this generically w/ the current Ant
Tasks, or at least I couldn't figure it out.

2) Loop over every subdir in a directory and call it's build.xml file (if it
exists). Our Apps build independent of each other -- calling into a shared
common-build.xml. But we must also provide a generic full build procedure,
which can build an unknown set of Apps. Of course, one could require that
full-build.xml be edited whenever Apps were added or deleted, but wouldn't
that be error-prone?? To me this would be similar to explicitly adding JARs
to a Classpath, rather than just implicitly adding all JARs in the /lib
directory. One way requires no future intervention, the other constantly
bites you...

3) Loop over every file in a particular directory that matches a specific
pattern, and pass it off to another Task. In this case, a home-grown Task
which pulls a Version number from the filename, determines the maximum
Version number in use, and writes it to a property for use in a subsequent
Ant Task.

Obviously I could have written a home-grown Task for each of these foreach
instances. But where is the elegance in that?? Isn't Don't Repeat Yourself
one of the cardinal rules of development. 

Cheers,
-- Chris
 



RE: looping (RE: Foreach task)

2001-06-11 Thread Peter Vogel

Hi Chris,

I don't think I've devolved to the point of religeon yet, and
I've actually been pleased with the level at which discussion
here (and in private) has been happening.

But yep, I agree!

-Peter

-Original Message-
From: Christopher Berry
To: '[EMAIL PROTECTED]'
Sent: 6/11/2001 1:18 PM
Subject: RE: looping (RE: Foreach task) 

Greetings,

As the one who (innocently) began this debate, I will chime in. Although
I
suspect that this argument has become religious, and as such, neither
side
is listening to the other anymore...

In my current build, I have used foreach three times, and I do not see
an
alternate approach. 

1) Loop over all TAR.GZ files in a directory and unpack them -- using a
generic unpack-GZfile-build.xml which takes the base filename as a
supplied
property. I do not think one could do this generically w/ the current
Ant
Tasks, or at least I couldn't figure it out.

2) Loop over every subdir in a directory and call it's build.xml file
(if it
exists). Our Apps build independent of each other -- calling into a
shared
common-build.xml. But we must also provide a generic full build
procedure,
which can build an unknown set of Apps. Of course, one could require
that
full-build.xml be edited whenever Apps were added or deleted, but
wouldn't
that be error-prone?? To me this would be similar to explicitly adding
JARs
to a Classpath, rather than just implicitly adding all JARs in the /lib
directory. One way requires no future intervention, the other constantly
bites you...

3) Loop over every file in a particular directory that matches a
specific
pattern, and pass it off to another Task. In this case, a home-grown
Task
which pulls a Version number from the filename, determines the maximum
Version number in use, and writes it to a property for use in a
subsequent
Ant Task.

Obviously I could have written a home-grown Task for each of these
foreach
instances. But where is the elegance in that?? Isn't Don't Repeat
Yourself
one of the cardinal rules of development. 

Cheers,
-- Chris
 



RE: Foreach task)

2001-06-11 Thread John . D . Casey

I second all this! I am doing something almost identical to your build 
process, only I'm also supporting the ability to deploy to multiple 
environments for development, QA, and production, each with different 
fundamental server configs and different physical characteristics. It 
doesn't make sense to write a build file for each env, since that would 
be a maintenance nightmare, and there is no reasonable way to 
homogenize the environments. If I wrote homegrown tasks to support 
deployment (which involves building sets of property files unique to 
each server instance and THEN moving the files out), it would be 
impossible for my successor to understand without tearing apart my 
code. Additionally, to maintain such a build, the next person HAS TO 
KNOW JAVA, and has to be familiar with developing against the Ant API. 
This simply isn't acceptable. Therefore, as far as I can see, the 
foreach is necessary from a practical point of view.

Also, I'd like to make another point, however feeble:

If you have a pure tool that is relatively useless, what's the point? 
If you want to ensure that tool's survival into the future (which 
everyone does; else why waste time on it?) you have to make it useful. 
And supporting trivial builds that could be done *very* easily with a 
twelve-year-old's shell script is not what people in enterprise 
situations would consider useful.

Just my 2 cents.

Regards,
John

-Original Message-
From: christopher.berry [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 11, 2001 3:19 PM
To: ant-user
Subject: RE: looping (RE: Foreach task)


Greetings,

As the one who (innocently) began this debate, I will chime in. 
Although I
suspect that this argument has become religious, and as such, neither 
side
is listening to the other anymore...

In my current build, I have used foreach three times, and I do not 
see an
alternate approach. 

1) Loop over all TAR.GZ files in a directory and unpack them -- using a
generic unpack-GZfile-build.xml which takes the base filename as a 
supplied
property. I do not think one could do this generically w/ the current 
Ant
Tasks, or at least I couldn't figure it out.

2) Loop over every subdir in a directory and call it's build.xml file 
(if it
exists). Our Apps build independent of each other -- calling into a 
shared
common-build.xml. But we must also provide a generic full build 
procedure,
which can build an unknown set of Apps. Of course, one could require 
that
full-build.xml be edited whenever Apps were added or deleted, but 
wouldn't
that be error-prone?? To me this would be similar to explicitly adding 
JARs
to a Classpath, rather than just implicitly adding all JARs in the /lib
directory. One way requires no future intervention, the other constantly
bites you...

3) Loop over every file in a particular directory that matches a 
specific
pattern, and pass it off to another Task. In this case, a home-grown 
Task
which pulls a Version number from the filename, determines the maximum
Version number in use, and writes it to a property for use in a 
subsequent
Ant Task.

Obviously I could have written a home-grown Task for each of these 
foreach
instances. But where is the elegance in that?? Isn't Don't Repeat 
Yourself
one of the cardinal rules of development. 

Cheers,
-- Chris
 



RE: Foreach task)

2001-06-11 Thread Nasgowitz, Mark (MED, GEMS-IT)

I also feel the foreach task is worth including in Ant. This is non-java
code set but I find Ant works very well.

The foreach task allows me to look in a directory and process all
property files that match. Each property file is then loaded using the
property task. This allows me to have a simple description type file
that contains information needed in the build process such as.
ownerEmailAddress=
workstation=
username=
password=
projDir=
loadView=xxx
...

Now all I have to do is drop in another property file to add another
build job. If I want to suspend one I just move the property file out of
that dir.

My process is not all that simple I process ~8 different builds each
with or without tests then I generate emails to the owners with xml
reports and ftp html pages showing current/past builds along with
trending information.

I plan to keep using the foreach task unless someone has a better
suggestion.
Thanks,
Mark











-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 11, 2001 3:41 PM
To: [EMAIL PROTECTED]
Subject: RE: Foreach task)


I second all this! I am doing something almost identical to your build 
process, only I'm also supporting the ability to deploy to multiple 
environments for development, QA, and production, each with different 
fundamental server configs and different physical characteristics. It 
doesn't make sense to write a build file for each env, since that would 
be a maintenance nightmare, and there is no reasonable way to 
homogenize the environments. If I wrote homegrown tasks to support 
deployment (which involves building sets of property files unique to 
each server instance and THEN moving the files out), it would be 
impossible for my successor to understand without tearing apart my 
code. Additionally, to maintain such a build, the next person HAS TO 
KNOW JAVA, and has to be familiar with developing against the Ant API. 
This simply isn't acceptable. Therefore, as far as I can see, the 
foreach is necessary from a practical point of view.

Also, I'd like to make another point, however feeble:

If you have a pure tool that is relatively useless, what's the point? 
If you want to ensure that tool's survival into the future (which 
everyone does; else why waste time on it?) you have to make it useful. 
And supporting trivial builds that could be done *very* easily with a 
twelve-year-old's shell script is not what people in enterprise 
situations would consider useful.

Just my 2 cents.

Regards,
John

-Original Message-
From: christopher.berry [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 11, 2001 3:19 PM
To: ant-user
Subject: RE: looping (RE: Foreach task)


Greetings,

As the one who (innocently) began this debate, I will chime in. 
Although I
suspect that this argument has become religious, and as such, neither 
side
is listening to the other anymore...

In my current build, I have used foreach three times, and I do not 
see an
alternate approach. 

1) Loop over all TAR.GZ files in a directory and unpack them -- using a
generic unpack-GZfile-build.xml which takes the base filename as a 
supplied
property. I do not think one could do this generically w/ the current 
Ant
Tasks, or at least I couldn't figure it out.

2) Loop over every subdir in a directory and call it's build.xml file 
(if it
exists). Our Apps build independent of each other -- calling into a 
shared
common-build.xml. But we must also provide a generic full build 
procedure,
which can build an unknown set of Apps. Of course, one could require 
that
full-build.xml be edited whenever Apps were added or deleted, but 
wouldn't
that be error-prone?? To me this would be similar to explicitly adding 
JARs
to a Classpath, rather than just implicitly adding all JARs in the /lib
directory. One way requires no future intervention, the other constantly
bites you...

3) Loop over every file in a particular directory that matches a 
specific
pattern, and pass it off to another Task. In this case, a home-grown 
Task
which pulls a Version number from the filename, determines the maximum
Version number in use, and writes it to a property for use in a 
subsequent
Ant Task.

Obviously I could have written a home-grown Task for each of these 
foreach
instances. But where is the elegance in that?? Isn't Don't Repeat 
Yourself
one of the cardinal rules of development. 

Cheers,
-- Chris
 



Re: looping (RE: Foreach task)

2001-06-11 Thread asr


= On Mon, 11 Jun 2001 13:18:50 -0700, Christopher Berry 
[EMAIL PROTECTED] said:


 As the one who (innocently) began this debate, I will chime in. Although I
 suspect that this argument has become religious, and as such, neither side
 is listening to the other anymore...

I like to view myself as devoted, but not dogmatic. ;) I'm sensitive to the
dead-horse-beating, and at least attempt to keep from just repeating.  Dang,
that rhymes.  I'm sorry.


 In my current build, I have used foreach three times, and I do not see an
 alternate approach. 

 1) Loop over all TAR.GZ files in a directory and unpack them -- using a
 generic unpack-GZfile-build.xml which takes the base filename as a supplied
 property. I do not think one could do this generically w/ the current Ant
 Tasks, or at least I couldn't figure it out.

I'm not as focused on the current tasks as I am on the model, so I may
advertise functions not implemented.  I certainly respect the difference
between 'how the model says it should be done' and 'how I can do it Right The
Devil Now'.

That said, I'd suggest

fileset name=tarry dir=foo include=**/*.tgz /

tar fileset=tarry destdir=${interesting-place} /

 2) Loop over every subdir in a directory and call it's build.xml file (if it
 exists). Our Apps build independent of each other -- calling into a shared
 common-build.xml. But we must also provide a generic full build procedure,
 which can build an unknown set of Apps. Of course, one could require that
 full-build.xml be edited whenever Apps were added or deleted, but wouldn't
 that be error-prone?? To me this would be similar to explicitly adding JARs
 to a Classpath, rather than just implicitly adding all JARs in the /lib
 directory. One way requires no future intervention, the other constantly
 bites you...

... The problem I have answering this one is how much I'd do your build
environment differently.  Hm.  I agree you don't want to hand-edit the main
build.xml every time something changes.

The way I'd solve this problem in app management ( which is not necessarily
the same as the problem in ant ) is to have a separate task/script/whatever
that reproducably generated a list of the interesting apps.  This would
probably start with something vaguely like a

find . -name build.xml -ls \
   | decide-if-my-map-needs-updating \
   | munge-list-into-properties-enumeration  \
to-be-included-in-build.xml

But I tend to see it as a meta-build problem.  And you see, the problem is
-not- how do I run ant on a bunch of dependant build.xml files, but rather,
how do I specify a changing set of build.xml files, oh and I think I'd like
to do it -this- way.



 3) Loop over every file in a particular directory that matches a specific
 pattern, and pass it off to another Task. In this case, a home-grown Task
 which pulls a Version number from the filename, determines the maximum
 Version number in use, and writes it to a property for use in a subsequent
 Ant Task.

fileset name=groan basedir=${dir} include=**/pattern/

homegrown fileset_name=groan propfile=${prop.file} /

othertask propfile=${prop.file} /


 Obviously I could have written a home-grown Task for each of these foreach
 instances. But where is the elegance in that?? Isn't Don't Repeat Yourself
 one of the cardinal rules of development. 

Oh, repetition can be lazy too. ;)   

- Allen S. Rout



Re: looping (RE: Foreach task)

2001-06-11 Thread Stefan Bodewig

It's a little silly to have the same discussion on two different lists
with slightly different sets of people ...

I don't want to argue iteration in general here, just look into
Christopher's usecases.

Christopher Berry [EMAIL PROTECTED] wrote:

 1) Loop over all TAR.GZ files in a directory and unpack them --
 using a generic unpack-GZfile-build.xml which takes the base
 filename as a supplied property.

Should be possible with execon:

execon executable=tar
  arg value=xzf
  srcfile /

  fileset dir=mydir includes=*.tar.gz /
/execon

But you wouldn't be using the built in tar and gzip tasks but have to
rely on the command line tools being installed.

 2) Loop over every subdir in a directory and call it's build.xml
 file (if it exists).

Not possible without a custom task in Ant 1.3, anton in Ant2 will be
your friend.

 3) Loop over every file in a particular directory that matches a
 specific pattern, and pass it off to another Task. In this case, a
 home-grown Task which [...]

As you are using a home-grown task anyway, you could make that task
support filesets directly - which in turn would probably increase
performance as well as you'd just have to configure this task once
instead of once per file.

Stefan



Re: Foreach task)

2001-06-11 Thread Stefan Bodewig

[EMAIL PROTECTED] wrote:

 'There should be no argument to any ant task which takes only a
 singular argument.  It should take a list of possibly one item, and
 promote a singular argument to a list of one if necessary.'

I've been playing with that idea for some time as well - and came to
the point that this would be much worse than a core-iterate task IMHO.

I'm not sure how you've envisioned this yourself, I see two possible
implementations:

(1) *All* tasks must deal with iteration themselves.  Well, this makes
writing tasks a lot harder than it currently is.

(2) Tasks don't have to be aware that they are dealing with sets, Ant
will invoke them once per set member.  Using this approach you add
iteration into the core instead of moving it to the task level, this
would mean adding complexity to a much bigger degree.

Stefan



RE: looping (RE: Foreach task)

2001-06-10 Thread Peter Vogel

Because our parents (oops, I mean the ant committers) are
trying to shelter us from dangerous ideas.

We're all just a bunch of ignorant children who cannot be trusted
to use a tool intelligently...

-Peter

 -Original Message-
 From: Mike Groezinger [mailto:[EMAIL PROTECTED]]
 Sent: Friday, June 01, 2001 11:49 PM
 To: [EMAIL PROTECTED]
 Subject: Re: looping (RE: Foreach task)
 
 
 Hi There,
 
 the foreach task is also what I'm looking for!
 What I don't understand: Why isn't it included in the CVS rep. in the
 taskdefs.optional package (at least I can't find it)? 
 Where can I get the latest and maintained version ?
 
 Cheers
 Mike
 
 
 Nasgowitz, Mark (MED, GEMS-IT) schrieb:
  
  Thanks Chris,
  The foreach task with the truncate option is just what I need!
  The problem is that I have been using ant for build, test 
 and publish
  results for C code but am unfamiliar with Java. Is it 
 possible to get
  the tasks 'pre-compiled' so they can be dropped in? I plan 
 on learning
  Java but time does not permit.
  
  Thanks for any help.
  Mark
  
  -Original Message-
  From: Christopher Berry [mailto:[EMAIL PROTECTED]]
  Sent: Thursday, May 31, 2001 10:34 AM
  To: '[EMAIL PROTECTED]'
  Subject: RE: looping (RE: Foreach task)
  
  Greetings,
  
  In keeping with the spirit of this marvelous list, I am 
 posting back an
  updated version of the optional foreach Task. It had a 
 bug in it which
  I
  have fixed. In addition, I have also added a type=truncate, which
  passes
  on only the base filename. (i.e. a file named myfile.tar.gz 
 will show up
  as
  myfile in the target)
  
  Cheers,
  -- Chris
  
   -Original Message-
   From: Christopher Berry [mailto:[EMAIL PROTECTED]]
   Sent: Tuesday, May 29, 2001 9:22 PM
   To: '[EMAIL PROTECTED]'
   Subject: RE: looping
  
  
   This looks like just what the doctor ordered. I'm sorry I
   missed it on my
   search of the archives -- I searched on loop
   Thanks (yet again) Diane.
   Cheers,
   -- Chris
  
-Original Message-
From: Diane Holt [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 29, 2001 8:28 PM
To: [EMAIL PROTECTED]
Subject: Re: looping
   
   
A foreach task that may do what you need was submitted to
the list by
Tim Vernum. You can find the original in the archives at:
  http://marc.theaimsgroup.com/?l=ant-devm=98803020500754w=2
   
And a follow-up version by Chris Greenlee with a type
attribute added
at:
  http://marc.theaimsgroup.com/?l=ant-devm=98842104504477w=2
   
Diane
   
--- Christopher Berry [EMAIL PROTECTED] wrote:
 Greetings,

 I am attempting to accomplish the following: For an 
 unknown set of
 TAR.GZ
 files in a directory, loop over these files and unpack each.

 I checked the archives and do not see a Ant solution for
this problem.
 Is
 that correct??

 Some have suggested that this should be done w/ XSLT. 
 Is that The
 Way?? If
 so, could someone provide a HowTo for this approach??

 Or should I write a Task of my own??

 Thanks very much,
 -- Chris

 Chris Berry  --- [EMAIL PROTECTED]  -- 512-323-9479

   
   
=
([EMAIL PROTECTED])
   
   
   
__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year!  http://personal.mail.yahoo.com/
   
  
 



RE: looping (RE: Foreach task)

2001-06-10 Thread Jesse Tilly

Peter, 

You can look at the overall issue as a teen-parent problem and act
accordingly OR you could pose questions that respond directly to the
opinions committers and non-committers have made.

Let me summarize my opinion about the conditional/flow-control issue and I
hope you will see what I (and some others) are trying to avoid.  Since we're
using metaphors as well as factual arguments I'll provide a more accurate
metaphor that describes my goal: I prefer that Ant not implement the Blob
Pattern (from the book, Anti-Patterns, W Brown, Wiley Publishing) by do
anything and everything it can, just because it can.

XML is a data description language.  It was chosen by James for Ant to
*describe* a build rather than provide process instructions like Make, Jam,
etc.  Unfortunately, Ant didn't do this well from the start since it
included tasks such as copy and javac.  Heck, the idea of tasks pretty
much set Ant off on the wrong foot.  Over time, some really good descriptive
tasks have come forth like the ejbjar task.  It has been my hope that
Ant's core would progress and mutate to this more descriptive nature.  Why?

XML is *not* a scripting language and makes for a poor basis to create a
scripting language.  Not only that, well defined scripting langauges already
exist; some have open parsers to boot!  If Ant really needs iterative
declarations to define its build, then it should use a language better
suited than XML.  I have been examining Python as a basis for about two
months mainly because my research has shown that a descriptive build
language will not properly solve complex build situations.  If it were to do
so, such a language would require a massive paradigm shift with build
managers; something that is unlikely to happen.  

Nonetheless, I try to have opinions and voice them in my hopes that Ant does
stay close to the descriptive paradigm.  My goal is not to avoid complexity.
It's to avoid doing something just because it can be done.  It's to avoid
creating an XML-based make as that makes less sense than using Make itself.
If one argues that anything and everything should be done to improve the
tool without any regard to its legacy or future use, then I would say why
are any of us bothering with Ant?  Jam/Javamake/Make/etc. does everything we
already want to be done with builds.  It's only real downside is the
cross-platform issue.  However, to that I can always answer it's up to the
user to understand how to work around that.

Okay, I've done the tried-and-true turn the argument around tactic;  using
it more for dramatic effect than anything.  In addition, I hope I have
provided a good explanation of mine (and I think other's) goals with Ant.
To use another metaphor (this one a little less accurate), we can all say
Damn the torpedoes, full speed ahead!, but, then, we need to be reminded
that Captain Farragut got lucky: the torpedoes didn't explode.

Jesse

 -Original Message-
 From: Peter Vogel [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, June 10, 2001 3:47 AM
 To: '[EMAIL PROTECTED]'
 Subject: RE: looping (RE: Foreach task)
 
 
 Because our parents (oops, I mean the ant committers) are
 trying to shelter us from dangerous ideas.
 
 We're all just a bunch of ignorant children who cannot be trusted
 to use a tool intelligently...
 
 -Peter
 
  -Original Message-
  From: Mike Groezinger [mailto:[EMAIL PROTECTED]]
  Sent: Friday, June 01, 2001 11:49 PM
  To: [EMAIL PROTECTED]
  Subject: Re: looping (RE: Foreach task)
  
  
  Hi There,
  
  the foreach task is also what I'm looking for!
  What I don't understand: Why isn't it included in the CVS 
 rep. in the
  taskdefs.optional package (at least I can't find it)? 
  Where can I get the latest and maintained version ?
  
  Cheers
  Mike
  
  
  Nasgowitz, Mark (MED, GEMS-IT) schrieb:
   
   Thanks Chris,
   The foreach task with the truncate option is just what I need!
   The problem is that I have been using ant for build, test 
  and publish
   results for C code but am unfamiliar with Java. Is it 
  possible to get
   the tasks 'pre-compiled' so they can be dropped in? I plan 
  on learning
   Java but time does not permit.
   
   Thanks for any help.
   Mark
   
   -Original Message-
   From: Christopher Berry [mailto:[EMAIL PROTECTED]]
   Sent: Thursday, May 31, 2001 10:34 AM
   To: '[EMAIL PROTECTED]'
   Subject: RE: looping (RE: Foreach task)
   
   Greetings,
   
   In keeping with the spirit of this marvelous list, I am 
  posting back an
   updated version of the optional foreach Task. It had a 
  bug in it which
   I
   have fixed. In addition, I have also added a 
 type=truncate, which
   passes
   on only the base filename. (i.e. a file named myfile.tar.gz 
  will show up
   as
   myfile in the target)
   
   Cheers,
   -- Chris
   
-Original Message-
From: Christopher Berry [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 29, 2001 9:22 PM
To: '[EMAIL PROTECTED]'
Subject: RE: looping

RE: looping (RE: Foreach task)

2001-06-10 Thread Peter Vogel

 I have been examining Python as a basis for 
 about two months mainly because my research has shown that a 
 descriptive build language will not properly solve complex build
situations.  

AS long as you are following this path, check out cons which
is perl-based but there is also a Python port of it that was done
for a contest, if I recall correctly...

www.dsmit.com/cons

-Peter

 



Re: looping (RE: Foreach task)

2001-06-02 Thread Mike Groezinger

Hi There,

the foreach task is also what I'm looking for!
What I don't understand: Why isn't it included in the CVS rep. in the
taskdefs.optional package (at least I can't find it)? 
Where can I get the latest and maintained version ?

Cheers
Mike


Nasgowitz, Mark (MED, GEMS-IT) schrieb:
 
 Thanks Chris,
 The foreach task with the truncate option is just what I need!
 The problem is that I have been using ant for build, test and publish
 results for C code but am unfamiliar with Java. Is it possible to get
 the tasks 'pre-compiled' so they can be dropped in? I plan on learning
 Java but time does not permit.
 
 Thanks for any help.
 Mark
 
 -Original Message-
 From: Christopher Berry [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, May 31, 2001 10:34 AM
 To: '[EMAIL PROTECTED]'
 Subject: RE: looping (RE: Foreach task)
 
 Greetings,
 
 In keeping with the spirit of this marvelous list, I am posting back an
 updated version of the optional foreach Task. It had a bug in it which
 I
 have fixed. In addition, I have also added a type=truncate, which
 passes
 on only the base filename. (i.e. a file named myfile.tar.gz will show up
 as
 myfile in the target)
 
 Cheers,
 -- Chris
 
  -Original Message-
  From: Christopher Berry [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, May 29, 2001 9:22 PM
  To: '[EMAIL PROTECTED]'
  Subject: RE: looping
 
 
  This looks like just what the doctor ordered. I'm sorry I
  missed it on my
  search of the archives -- I searched on loop
  Thanks (yet again) Diane.
  Cheers,
  -- Chris
 
   -Original Message-
   From: Diane Holt [mailto:[EMAIL PROTECTED]]
   Sent: Tuesday, May 29, 2001 8:28 PM
   To: [EMAIL PROTECTED]
   Subject: Re: looping
  
  
   A foreach task that may do what you need was submitted to
   the list by
   Tim Vernum. You can find the original in the archives at:
 http://marc.theaimsgroup.com/?l=ant-devm=98803020500754w=2
  
   And a follow-up version by Chris Greenlee with a type
   attribute added
   at:
 http://marc.theaimsgroup.com/?l=ant-devm=98842104504477w=2
  
   Diane
  
   --- Christopher Berry [EMAIL PROTECTED] wrote:
Greetings,
   
I am attempting to accomplish the following: For an unknown set of
TAR.GZ
files in a directory, loop over these files and unpack each.
   
I checked the archives and do not see a Ant solution for
   this problem.
Is
that correct??
   
Some have suggested that this should be done w/ XSLT. Is that The
Way?? If
so, could someone provide a HowTo for this approach??
   
Or should I write a Task of my own??
   
Thanks very much,
-- Chris
   
Chris Berry  --- [EMAIL PROTECTED]  -- 512-323-9479
   
  
  
   =
   ([EMAIL PROTECTED])
  
  
  
   __
   Do You Yahoo!?
   Get personalized email addresses from Yahoo! Mail - only $35
   a year!  http://personal.mail.yahoo.com/
  
 



RE: looping (RE: Foreach task)

2001-06-01 Thread Nasgowitz, Mark (MED, GEMS-IT)

Thanks Chris,
The foreach task with the truncate option is just what I need!
The problem is that I have been using ant for build, test and publish
results for C code but am unfamiliar with Java. Is it possible to get
the tasks 'pre-compiled' so they can be dropped in? I plan on learning
Java but time does not permit.

Thanks for any help.
Mark


-Original Message-
From: Christopher Berry [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 31, 2001 10:34 AM
To: '[EMAIL PROTECTED]'
Subject: RE: looping (RE: Foreach task)


Greetings,

In keeping with the spirit of this marvelous list, I am posting back an
updated version of the optional foreach Task. It had a bug in it which
I
have fixed. In addition, I have also added a type=truncate, which
passes
on only the base filename. (i.e. a file named myfile.tar.gz will show up
as
myfile in the target)

Cheers,
-- Chris


 -Original Message-
 From: Christopher Berry [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 29, 2001 9:22 PM
 To: '[EMAIL PROTECTED]'
 Subject: RE: looping
 
 
 This looks like just what the doctor ordered. I'm sorry I 
 missed it on my
 search of the archives -- I searched on loop
 Thanks (yet again) Diane.
 Cheers,
 -- Chris
 
  -Original Message-
  From: Diane Holt [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, May 29, 2001 8:28 PM
  To: [EMAIL PROTECTED]
  Subject: Re: looping
  
  
  A foreach task that may do what you need was submitted to 
  the list by
  Tim Vernum. You can find the original in the archives at:
http://marc.theaimsgroup.com/?l=ant-devm=98803020500754w=2
  
  And a follow-up version by Chris Greenlee with a type 
  attribute added
  at:
http://marc.theaimsgroup.com/?l=ant-devm=98842104504477w=2
  
  Diane
  
  --- Christopher Berry [EMAIL PROTECTED] wrote:
   Greetings,
   
   I am attempting to accomplish the following: For an unknown set of
   TAR.GZ
   files in a directory, loop over these files and unpack each. 
   
   I checked the archives and do not see a Ant solution for 
  this problem.
   Is
   that correct??
   
   Some have suggested that this should be done w/ XSLT. Is that The
   Way?? If
   so, could someone provide a HowTo for this approach?? 
   
   Or should I write a Task of my own??
   
   Thanks very much,
   -- Chris
   
   Chris Berry  --- [EMAIL PROTECTED]  -- 512-323-9479
   
  
  
  =
  ([EMAIL PROTECTED])
  
  
  
  __
  Do You Yahoo!?
  Get personalized email addresses from Yahoo! Mail - only $35 
  a year!  http://personal.mail.yahoo.com/
  
 




RE: looping (RE: Foreach task)

2001-05-31 Thread Christopher Berry

Greetings,

In keeping with the spirit of this marvelous list, I am posting back an
updated version of the optional foreach Task. It had a bug in it which I
have fixed. In addition, I have also added a type=truncate, which passes
on only the base filename. (i.e. a file named myfile.tar.gz will show up as
myfile in the target)

Cheers,
-- Chris


 -Original Message-
 From: Christopher Berry [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 29, 2001 9:22 PM
 To: '[EMAIL PROTECTED]'
 Subject: RE: looping
 
 
 This looks like just what the doctor ordered. I'm sorry I 
 missed it on my
 search of the archives -- I searched on loop
 Thanks (yet again) Diane.
 Cheers,
 -- Chris
 
  -Original Message-
  From: Diane Holt [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, May 29, 2001 8:28 PM
  To: [EMAIL PROTECTED]
  Subject: Re: looping
  
  
  A foreach task that may do what you need was submitted to 
  the list by
  Tim Vernum. You can find the original in the archives at:
http://marc.theaimsgroup.com/?l=ant-devm=98803020500754w=2
  
  And a follow-up version by Chris Greenlee with a type 
  attribute added
  at:
http://marc.theaimsgroup.com/?l=ant-devm=98842104504477w=2
  
  Diane
  
  --- Christopher Berry [EMAIL PROTECTED] wrote:
   Greetings,
   
   I am attempting to accomplish the following: For an unknown set of
   TAR.GZ
   files in a directory, loop over these files and unpack each. 
   
   I checked the archives and do not see a Ant solution for 
  this problem.
   Is
   that correct??
   
   Some have suggested that this should be done w/ XSLT. Is that The
   Way?? If
   so, could someone provide a HowTo for this approach?? 
   
   Or should I write a Task of my own??
   
   Thanks very much,
   -- Chris
   
   Chris Berry  --- [EMAIL PROTECTED]  -- 512-323-9479
   
  
  
  =
  ([EMAIL PROTECTED])
  
  
  
  __
  Do You Yahoo!?
  Get personalized email addresses from Yahoo! Mail - only $35 
  a year!  http://personal.mail.yahoo.com/
  
 


 ForeachTask.java
Title: Ant User Manual






Foreach
Description
Iterates over a set of parameters to call another target within the same build-file.
The set of parameters are joined to form a cartesian product, and the specified
   target is called once for each element in the resulting set.

Parameters

  
Attribute
Description
Required
  
  
target
The target to execute.
Yes
  
  
type
One of file, dir, both, or truncate. If set to file, only the names of plain files will be sent to the command. If set to dir, only the names of directories are considered.
  If set to both, then both file and dir are sent. If
  set to truncate, then only the truncated base filenames of plain files will be sent
  (e.g. myfile.tar.gz will show up as myfile)
No, if omitted default is file
  

Parameters specified as nested elements
param
Specifies the properties to set before running the specified target.
Each param forms a set of parameters with a single property name
The elements in the parameter set can be taken from either a
fileset or a list of item elements.
If the elements are taken from a fileset, the type attribute  of foreach
determines whether files, directories, or both files and directories from
the fileset are included.

Examples

  target name=default
foreach target=compress
  param name=program
item value=compress/
item value=gzip/
  /param
  param name=file
fileset dir=. includes=**/*.tar/
  /param
/foreach
  /target

  target name=compress
exec executable=${program}
  arg file=${file}/
/exec
  /target

Will pass each tar file through both compress and gzip

  target name=default
foreach target=zip-dirs type=dir
  param name=src-dir
fileset dir=. includes=*/
  /param
/foreach
  /target

  target name=zip-dirs
zip zipfile=${src-dir}.zip 
  zipfileset dir=${src-dir} prefix=${src-dir}/
/exec
  /target

Will create one zip archive in the current directory for every directory within the current directory.  Files within the current directory will be ignored.

Copyright  2000,2001 Apache Software Foundation. All rights
Reserved.






Re: Foreach-task?

2001-01-30 Thread Nico Seessle
Title: RE: "Foreach"-task?



- Original Message - 

  From: 
  Tim Vernum 
  To: '[EMAIL PROTECTED]' 
  
  Sent: Tuesday, January 30, 2001 12:59 
  AM
  Subject: RE: "Foreach"-task?
  
   There is currently no foreach-task. (And maybe there will 
  never be one). 
   A solution would be 1) to write your own task or 2) to 
  use the script-task  to solve this. 
  Or you can use XSLT. The issues with 
  that are: 
  3) You need to learn XSLT. 
I think that was the reason I didn't mention it :-) 
Sometimes I completely ignore things I jave not learned and used :-(
Nico



Re: Foreach-task?

2001-01-29 Thread Nico Seessle

There is currently no foreach-task. (And maybe there will never be one).

A solution would be 1) to write your own task or 2) to use the script-task
to solve this.

Nico





RE: Foreach-task?

2001-01-29 Thread Tim Vernum
Title: RE: Foreach-task?






 There is currently no foreach-task. (And maybe there will never be one).


 A solution would be 1) to write your own task or 2) to use the script-task
 to solve this.


Or you can use XSLT.
The issues with that are:


1) Ant doesn't currently send the build.xml through an XSLT processor.
 You either need to hack ant, put a wrapper around ant, or rebuilt your build.xml from the input and stylesheet each time one changes.

2) I had some unresolved namespace issues when using Xalan-1 and Xerces-J to create my build.xml.
 But I only spent an hour or so on it, so it's probably solvable.


3) You need to learn XSLT.


4) XSLT is ugly.