Java Mailing List Archive

Apache Ant Archive

» Ant Users List
» Ant Developers List
Invoking a target (Ant 1.7) in a loop (Ant-Contrib)

Invoking a target (Ant 1.7) in a loop (Ant-Contrib)

2007-01-17       - By Matt Benson
Reply:     1     2     3     4     5     6     7     8     9     10     >>  

I haven't been following this discussion too closely,
but I saw resources and my name... ;)

--- Steve Loughran <stevel@(protected)> wrote:

> 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 use them consistently for small things, and I try to
be on the lookout for problems they might solve.  :)

> 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?

Not necessarily, but the issue may bear discussion.
At present, the toString() value of a resource depends
on what it is, and should best be expected to be a
description of the resource.  So
FileResource.toString() returns a file path,
URLResource.toString() returns a string URL,
StringResource.toString() returns the string, which
happens to be its entire contents.
PropertyResource.toString(), OTOH, returns the
property value.  This may well be wrong.  :|  Matter
of opinion, I suppose...

>   -how well do the built in tasks handle non-file
> resources?

AFAIK, when we (mostly Stefan and myself) retrofitted
resource support into existing tasks we tried to do
the right thing.  <delete> currently only works with
files.  Probably the right thing to do would be to
provide a Deletable interface (like the existing
Touchable) so that custom resources could implement it
if they wanted.  <javac> currently only works with
file resources, because the Sun compiler historically
only supported files, thus the entire task was
designed that way, and existing compiler adapters
follow suit, as they must.  This is another area for
redesign/extension.  Off the top of my head I can
think of <concat> and <copy> that do behave properly
with non-file resources.  Hopefully there are more!
The current support was really just the first step, as
Steve implied above.

> 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
> and
> 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>

I need to take a look at this myself.  Sorry I haven't


> 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 @(protected) for that
> reason, though I may implement a custom resource
> anyway.
> -Steve
> To unsubscribe, e-mail:
> user-unsubscribe@(protected)
> For additional commands, e-mail:
> user-help@(protected)

No need to miss a message. Get email on-the-go
with Yahoo! Mail for Mobile. Get started.

To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 - Jax Systems, LLC, U.S.A.