ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <hol...@yahoo.com>
Subject Re: <require>, <fail unless="..."> or <available fail="...">
Date Tue, 26 Sep 2000 16:49:51 GMT
--- Stefan Bodewig <bodewig@bost.de> wrote:
> In case you didn't follow the other threads. <require> would be the
> same as <available> but have an additional message attribute which
> would be used to throw a BuildException if the resource can not be
> found. Thus combining <available> and your modified <fail> into a
> single task - making it even more explicit.
> 
> A fail attribute to available has been proposed to do the same as
> <require>'s message attribute - just more implicit.

While we're on this topic, I'd like to check that I'm using the
<available>/if/unless, as they currently exist, the way you're supposed to
be. Here's a little sample build-file that uses this stuff the way I'm
currently using it -- could you let me know if this approach is correct,
sort of correct but a bit convoluted, completely wigged out?  Thanks.

<?xml version="1.0"?>

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

  <target name="widget">
    <available classname="Widget"
               property="widget.available">
      <classpath>
        <pathelement location="${user.home}"/>
      </classpath>
    </available>
    <ant antfile="widget.xml" target="doWidget"/>
  </target>

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

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

</project>


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



__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/

Mime
View raw message