Bug 8294 - <apply>: Allow <srcfile/> and <targetfile/> to appear as many times as required
Summary: <apply>: Allow <srcfile/> and <targetfile/> to appear as many times as required
Status: NEW
Alias: None
Product: Ant
Classification: Unclassified
Component: Core tasks (show other bugs)
Version: 1.4.1
Hardware: Other other
: P3 enhancement with 1 vote (vote)
Target Milestone: ---
Assignee: Ant Notifications List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-04-19 12:15 UTC by simon.spruzen
Modified: 2008-11-24 03:57 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description simon.spruzen 2002-04-19 12:15:54 UTC
Can <apply> be enhanced:

1. Parallel=false only:
Allow <srcfile/> and <targetfile/> to appear as many times as required (this is 
occasionally neccessary for odd command lines). If srcfile appears more than 
once, whether each srcfile/target is expanded into the same filename, or 
whether each srcfile is expanded into the next unused filename is dependent on 
a new attribute, usenext, e.g.

if the source file list is a.xml, b.xml, c.xml

and srcfile element appears twice it will be expanded thus:

<srcfile/> <srcfile/>                             a.xml a.xml
<srcfile usenext="true"/> <srcfile/>              b.xml b.xml
<secfile/> <srcfile usenext="true"/>              a.xml b.xml

The same applies to targetfile.

This wouldn't be allowed for parallel=true.

2. Fix mapper support so the flatten mapper really does what it says (i.e. 
strip off the preceeding path), rather than cause the current directory to be 
prepended to the flattened file.

3. Allow arbitrary substitutable parameter lists that don't depend on filesets. 
So in <apply> I could define a list:

<apply ...>
   <list id="arg.list.one" value="value1,value2,value3"/>

and refer to it in the middle of the arg list as follows:
   <arg .../>
   <arg listid="arg.list.one"/>
   <arg listid="arg.list.one" usenext="true"/>
   ...
</apply>

Which would expand to: value1 value2
the usenext attribute working in the same way as for srcfile/targetfile's 
usenext, above.

Multiple lists would be allowed. The rule for expansion of lists of different 
lengths would be:

- apply stops at the end of the longest fileset or list
- shorted lists would be silently be expanded to empty strings, or perhaps to 
whatever value the default attribute was set to, i.e. for two lists:

<list id="arg.list.one" value="value1,value2,value3" default="boo"/>
<list id="arg.list.two" value="hello,goodbye,ok,whatever"/>

would expand to, given <listarg id="arg.list.one"/> <listarg id="arg.list.two"/>

value1 hello
value2 goodbye
value3 ok
boo whatever

Of course, changing arg would add lists to every task that allowed the arg 
element, not just apply.


simon.
Comment 1 Stefan Bodewig 2002-11-08 13:50:39 UTC
Does <apply>'s relative attribute address point 2?
Comment 2 simon.spruzen 2002-11-08 13:55:47 UTC
Reckon it would. Also haven't retried mapper support in ant 1.5, so it might be 
fixed (or my understanding might be broken...)

simon.
Comment 3 Dominique Devienne 2002-11-08 16:53:31 UTC
About point (1), this looks like you want to emulate the functionality of 
xargs, and I can see value in that for as you state odd commands.

As far as (3), I'm not sure I understand the rational, and the value of it. 
Would you have a real world use case that could maybe demonstrate more the 
usefulness of such an addition?

Thanks, --DD
Comment 4 Matt Benson 2006-06-27 21:06:11 UTC
taking out of NEEDINFO and noting my opinion that (3) above is probably usable
with apply filelist support, and especially with resource support in 1.7 .  This
leaves (1) remaining; changing the summary to reflect (1) only.