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 task for list of files
Date Thu, 04 May 2000 04:10:19 GMT
Hey, following the discussion about 'execFor' functionality I wrote a
trivial extension to the existing exec task definition. 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, will
search for files, and will exec a command with attached list of files as
an additional last argument.


Examples:
(*) <exec dir="/tmp" command="ls -l" output="out.txt"/>
will execute effectively as usual
cd /tmp; ls -l


(*) <exec dir="${basedir}" 
      command="jidl --output-dir ${src.dir} --package com.my.idl" 
      src="src/idl" output="out.txt"/>
and if inside ${basedir}/src/idls we have files: a.idl, b.idl, c.txt
will 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>
and if inside ${basedir}/src/idls we have files: a.idl, b.idl, c.txt
will 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 as last attribute. I cannot find a 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). Maybe there are usefull file/source
processors which can deal with single file only at once...


----
best regards
Mariusz

Mime
View raw message