--- Steve Loughran <[EMAIL PROTECTED]> wrote:
> ----- Original Message -----
> From: "Shah, Lokesh" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, March 18, 2002 5:07 PM
> Subject: How to find available targets in a build file
>
> >Is there any way I can check if a target is available in a build file?
>
> not yet
Yes and no. "Not yet" in the sense of in a released version, but
1.5alpha's <exec> has a 'resultproperty' attribute you can use to capture
the return code of the command you execute. So you could do something
like:
<target name="doConditionalTarget" depends="chkTarget" if="target.found">
<ant ... />
</target>
<target name="chkTarget">
<exec executable="sh" dir="subdir"
resultproperty="grep.rc" os="FreeBSD">
<arg line='-c "ant -projecthelp -verbose|grep -q findit"'/>
</exec>
<exec executable="cmd" dir="subdir"
resultproperty="grep.rc" os="Windows NT">
<arg line='/c "ant -projecthelp -verbose|findstr 1>nul 2>nul
findit"'/>
</exec>
<condition property="target.found">
<equals arg1="${grep.rc}" arg2="0"/>
</condition>
</target>
Diane
=====
([EMAIL PROTECTED])
__________________________________________________
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>