ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@yahoo.com>
Subject Re: How do I call antcall once per line of file using line value as parameter?
Date Wed, 02 Jul 2008 18:36:00 GMT
Trying to catch up on this thread.  Are you saying you
want to do something for each line of a file?  No
problem.  The ResourceCollection API was designed to
return an Iterator partly with the aim of maintaining
compatibility with antcontrib's for and foreach tasks.
 Simply use the <tokens> ResourceCollection:

<ac:for param="x">
  <tokens>
    <file file="${input.file}" />
  </tokens>
  <sequential>
    ....
  </sequential>
</ac:for>

HTH,
Matt

--- Gilbert Rebhan <ant@schillbaer.de> wrote:

> Paul Taylor schrieb:
> > I dont understand Ruby so this wouldnt be an
> option for me. It just 
> > seems that this is such a common problem that it
> shoulg go into ant proper
> 
> As you already noticed, (core) ant has it limits.
> OK, to be fair, it
> was never meant as a scripting language, but is
> often used
> like that.
> 
> If i get to the limits i use <script> with (j)ruby
> or write a new task.
> There are other languages that run in the VM via
> BSF, f.e. if you want a
> syntax similar to java, use beanshell or javascript
> (rhino).
> 
> 
> >> also possible without antcontrib =
> >>
> >> <script language="ruby">
> >> <![CDATA[
> >>   echoTask = $project.createTask 'echo'
> >>   IO.readlines("Y:/foobar.txt").each do |line|
> >>     echoTask.addText(line)
> >>     echoTask.execute
> >>   end
> >> ]]>
> >> </script>
> >>
> >> you have full access to the ant api
> 
> Regards, Gilbert
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 



      

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


Mime
View raw message