ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: <require>, <fail unless="..."> or <available fail="...">
Date Wed, 27 Sep 2000 06:48:12 GMT
>>>>> "DH" == Diane Holt <> writes:

 DH> While we're on this topic, I'd like to check that I'm using the
 DH> <available>/if/unless, as they currently exist, the way you're
 DH> supposed to be.

Does your example actually work? Well, if it does, I think you are
doing far more than you need to (by using the <ant> task). My version
would look like this:

<project default="widget" basedir=".">

  <target name="test.widget">
    <available classname="Widget"
        <pathelement location="${user.home}"/>

  <target name="noWidget" depends="test.widget" unless="widget.available">
    <echo message=""/>
    <echo message="******* Widget not available *******"/>
    <echo message="***** Run compile target first *****"/>
    <echo message=""/>

  <target name="doWidget" depends="test.widget" if="widget.available">
    <echo message="Executing widget target..."/>

  <target name="widget" depends="doWidget,noWidget" />

This isn't really shorter but saves you from the overhead of creating
another Project instance.


View raw message