ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <hol...@yahoo.com>
Subject Re: a few basic questions...
Date Mon, 09 Jul 2001 20:29:54 GMT
--- Benjamin Russell Stocum <bstocum@paychex.com> wrote:
> In the Target tag, does the "if" attribute allow you to have a logic
> expression, or does it just allow one to check to see if a "property"
> exists?

Just if/unless the property is set. If you need to test for a value, you
can either modify Target.java (not overly recommended, since then your Ant
wouldn't be standard) or you could try using the IfTask that John Casey
posted awhile back:

  http://marc.theaimsgroup.com/?l=ant-user&m=98598744130801&w=2

> I am currently using the tags as functions, is there a better way to do
> this?

Assuming I'm not misreading what you mean, I do this when I have something
that needs doing in the same way, but with different values. In that case
I'll have a "template"-type target that gets <antcall>'ed with <param>'s. 

> And when do you know you should be creating your own tags?

It's really just a judgement call.

> Like for example I set a property if the file exists:
> 
> <target name="fileExists">
>     <available file="${fileName}" property="${fileName}.exists"/>
> </target>
>  
> Am I doing too much? I have lots of tags like this one... Is this the
> proper way to construct the tags?

I'm not sure if this would do what you want -- how are you setting
fileName?  If it's via a <param> in an <antcall>, the property will only
be set during the execution of the <antcall> (unless you put it out to a
file), so a check for the property would need to be done inside that same
<antcall>.

Diane

=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

Mime
View raw message