ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@bost.de>
Subject Re: <require>, <fail unless="..."> or <available fail="...">
Date Wed, 27 Sep 2000 06:48:12 GMT
>>>>> "DH" == Diane Holt <holtdl@yahoo.com> 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"
               property="widget.available">
      <classpath>
        <pathelement location="${user.home}"/>
      </classpath>
    </available>
  </target>

  <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>

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

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

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

Stefan

Mime
View raw message