ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <ste...@apache.org>
Subject Re: Invoking a target (Ant 1.7) in a loop (Ant-Contrib)
Date Wed, 17 Jan 2007 16:27:06 GMT
Rebo, Alex wrote:
>> well, I dont think you need to do any big loops or iteration. You can do 
>> a bulk verify too, using verifyproperty=true
> 

> The BIG loop was brought in because it is not clear whether 
> <checksum ...>
> 	<fileset refid="someFileSet" />
> </checksum>
 >
 > will failfast after the first unsuccessfull iteration.

Interesting point.
(pause)
1. it's resource aware,but only file resources work; looks like you get 
a ClassCast exception if you try anything fancy like checksumming 
something inside a zip file or an infinite stream of random numbers.
2. it doesnt (yet) exit early on a failure. You may be able to add a 
patch for that. "failearly", perhaps.

> 
> Well, I already expressed my concerns regarding "Working with Resources" of
> Ch. 5 as well as coverage provided by the manual. 

what, not enough detail?

Right now resources are only slowly being understood, and I think only 
matt uses them widely. I'm not sure how stable they are yet, as I think 
there will be some surprises in use. For example,
  -how do resources integrate with ${toString: } operations. Ideally 
they'd return the entire contents, wouldnt they?
  -how well do the built in tasks handle non-file resources?

The only thing that does use it reliably appears to be <copy>, which is 
where I look at it, in the context of working inside zip files.

I go into it in ch17 and 18 when looking at how to implement tasks, 
because right now I think its something that has to go into tasks (with 
the antunit tests to test it)

see
http://antbook.cvs.sourceforge.net/antbook/examples/sections/extending/ch17_tasks/filesize/first/src/org/antbook/tasks/filesize/ResourceSizeTask.java?view=markup
and
http://antbook.cvs.sourceforge.net/antbook/examples/sections/extending/ch18_extras/resources/src/org/antbook/resources/

the latter is the infinite stream of randomness, but it fails wierdly 
under antunit, showing some aspects of the java crypto engine/antunit 
conflict . I have something that works on the command line but not under 
antunit:
   <target name="testSeed"
      xmlns:res="antlib:org.antbook.resources"
      depends="define">
      <loadresource property="set1">
        <res:random size="10" seed="1"/>
      </loadresource>
      <loadresource property="set2">
        <res:random size="10" seed="1"/>
      </loadresource>
      <au:assertPropertySet name="set1"/>
      <au:assertPropertyEquals name="set1" value="${set2}"/>
    </target>

If you are doing a new task, go resource aware from the outset, and dont 
assume that all resources are simple files.

If you have an old task, well, you need to decide whether to jump to 
ant1.7 only if you add resource support. I'm holding back @work for that 
reason, though I may implement a custom resource anyway.


-Steve


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


Mime
View raw message