ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig Longman <cra...@begeek.com>
Subject Re: suggestions
Date Thu, 20 Sep 2001 20:04:31 GMT
On Thu, 2001-09-20 at 13:17, Diane Holt wrote:
> --- Craig Longman <craigl@begeek.com> wrote:
> > 1) it seems like some way of quickly comparing a property to some value
> > would be helpful.  as an '=' is almost certainly never going to be a
> > valid character in a property, this kind of thing should work pretty
> > well:
> >   <target name="target" if="some.property=hello"/>
> >   <target name="target" if="some.property=goodbye"/>
> 
> Diligently (very very :) asked for a looong time ago, and turned down
> flat. (I ended up having a modified Target.java for quite awhile for that
> very reason. With the advent of <condition> in 1.4, that can finally
> [yay!] go away.)

any valid reason why it was turned down?  just not something the
maintainer(s) liked?
the condition in 1.4 might help me for somethings, but it is so
verbose.  one thing i've never liked about so many projects, is the
tendency to making something so verbose it is no longer readable.  the
'=' option mentioned here is so much more readable than a multi-line
condition tag, and is also right in the target tag, which is where you'd
expect it to be.

> > 2) something that calls one or more targets AFTER a target has
> > completed.  for example, in my init target, i often have properties that
> > i need to conditionally set, and currently the only way to easily do
> > that is multiple targets with 'if' attributes.  but, i would still want
> > to ensure that the init is completed first, while still ensuring that
> > the other conditional-inits are completed immediately following the init
> > target.
> 
> Maybe I'm just not fully awake yet this morning, but -- you lost me. The
> only I know of to start another target before the first one is done is to
> include an <antcall>/<ant> in it, then have additional tasks after that.
> Eg:
>   <target name="foo">
>     <echo message="I'm foo..."/>
>     <antcall target="bar"/>
>     <echo message="I'm foo again."/>
>   </target>
>   <target name="bar">
>     <echo message="I'm bar..."/>
>   </target>

well, considering all the other problems with variables i've been having
when using antcall, i was looking for some other solution.  so, i would
have:

<target name="foo" depends="before" after="bar">
...
</target>

so, when this target is invoked, the 'before' target will be invoked
first, then the 'foo' target is invoked, and then finally (assuming no
failures) the 'bar' target is invoked.

this preserves the 'nature' of calling subtargets, and presuming props
are handled in the same way in the 'after' attribute as they are in the
'depends' attribute, the unique behaviour of ant and antcall can be
ignored.

> BTW: There's a problem with logging on this -- the "[echo] I'm foo again."
> ends up printing out as a task of target bar (oops).

i noticed that and commented on it in a previous thread.

> > 3) some way to silence a target.
> 
> Use NoBannerLogger.

will look at this. but again, sounds like a lot of typing just to
silence a target.  thanks.

> > 4) some way to indicate that a target is to be only called from the
> > build file itself, not externally.  this is basically what i'm trying to
> > simulate in 3), but being able to code it directly in the build file
> > might be helpful.
> 
> I suppose an attribute could be added to <target> (eg., "external";
> defaults to yes), but I'm not knowledgeable enuf with Ant's internals to
> say for sure how easy that would be to do.

not sure either.  i will look into it perhaps.  i was thinking that the
same analogy as the java access would work.  having a public/private
type of attribute.  probably a public defaulting to yes.  i think that
this would make sense to have.  ant seems to really encourage multiple
targets, but it could be dangerous if an internal only target was
invoked directly.  i'll see.

thanks,

     CraigL->Thx();




Mime
View raw message