ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mariusz Nowostawski <mari...@marni.otago.ac.nz>
Subject [PATCH] exec with include/exclude
Date Thu, 25 May 2000 22:43:12 GMT

I wrote a trivial extension to the existing Exec task definition to make
it include/exclude aware and I have already posted it here, but
without any (positive or negative) feedback. 

With the patch, the Exec task will behave as usual if used as
usual. However, if used with the additional optional attribute 'src' which
should be a directory, it will search for files, and will exec a command
with attached list of files as an additional last argument. 
'src' attribute can be renamed to 'dir' or whatever will be the 'standard
look&feel' for matching tasks.

One can use the modified Exec for any task which requires executing a
binary program with a list of files being its arguments;
for example to compile multiple *.idl files:

(*) <exec dir="${basedir}" 
      command="jidl --output-dir ${src.dir} --package com.my.idl" 
      src="src/idls" output="out.txt"/>

if inside ${basedir}/src/idls we have files: a.idl, b.idl, c.txt
it would execute effectively:

cd ${basedir}; jidl --output-dir src/main --package com.my.idl \
${basedir}/src/idl/a.idl ${basedir}/src/idl/b.idl ${basedir}/src/idl/c.txt


(*) <exec dir="${basedir}"
      command="jidl --output-dir ${src.dir} --package com.my.idl"
      src="src/idl" output="out.txt">
      <include name="*.idl"/>
    </exec>

if inside ${basedir}/src/idls we have files: a.idl, b.idl, c.txt
it would execute effectively:

cd ${basedir}; jidl --output-dir src/main --package com.my.idl \
${basedir}/src/idl/a.idl ${basedir}/src/idl/b.idl


The patch assumes that the command should be invoked once with the list of
all matching files appended to the list of arguments. I cannot find any  
use of executing commands in list of files sequentially file after file
with unknown order but if somebody needs it, the patch can be easily
extended (i.e. exec  task can be easily extended by additional
flag: 'sequential="true"'). Maybe there are usefull file/source processors
which can deal with single file at once only. All tools I use can take a
list of arguments, and single invocation is enough.


best regards
Mariusz

Mime
View raw message