Diane Holt wrote:
>
> --- Benjamin Russell Stocum <[EMAIL PROTECTED]> 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>.
At the moment i do:
<!-- Choose one of these: intermediate, beta, final -->
<property name="state" value="intermediate"/>
<target name="init"
depends="prepare,init-final,init-beta,init-intermediate">
</target>
<target name="prepare">
<property name="${state}" value="true"/>
<tstamp/>
</target>
<target name="init-final" if="final">
...
</target>
<target name="init-beta" if="beta">
...
</target>
<target name="init-intermediate">
...
</target>
Mit freundlichen Grüßen
Stefan Mainz
--
Dynaware Systemberatung GmbH Tel: +49 89 743130-15
Am Westpark 7 Fax: +49 89 743130-05
81373 München mobil: +49 171 6920761
http://www.dynaware.de mailto:[EMAIL PROTECTED]