ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <hol...@yahoo.com>
Subject Re: Better property handling...
Date Mon, 11 Feb 2002 19:07:59 GMT
--- Dominique Devienne <DDevienne@lgc.com> wrote:
> On the other hand, when the condition is false, I get
> 
> awregister.manifest-up2date = ${awregister.manifest-up2date}
> 
> Ideally, I would like to see false instead of
> ${awregister.manifest-up2date}! 
>
> Any way to do that cleanly?

The problem is, if you're using your "awregister.manifest-up2date"
property for if/unless in other targets (which I assume you are), you
can't set it literally to 'false', because if/unless only check for
set/not-set, so you'd get bad results that way (since it would always be
set to something). You'll need to set a property to use just for the echo
value. Eg:
  <target name="awregister.manifest-up2date?">
    <condition property="awregister.manifest-up2date">
      <and>
        <available property="classes-dir-exists"
                   file="${classes}"
                   type="dir" />
        <uptodate targetfile="${awregistration.manifest}">
          <srcfiles dir="${classes}"
                    includes="com/lgc/mowi/pres/**/*.class"/>
        </uptodate>
      </and>
    </condition>
    <condition property="awregister.echo-value" value="false">
      <equals arg1="${awregister.manifest-up2date}"
              arg2="$${awregister.manifest-up2date}"/>
    </condition>
    <property name="awregister.echo-value" value="true"/>
    <echo
       message="awregister.manifest-up2date = ${awregister.echo-value}"/>
  </target>

The additional <condition> checks to see if "awregister.manifest-up2date"
isn't set (ie., is literally equal to "${awregister.manifest-up2date}"),
in which case the echo value property will get set to 'false'. Otherwise,
the <property> task will set the (unset) echo value property to 'true'
(note that it won't get set to 'true' if it was already set to 'false',
since properties are immutable).

Diane

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



__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message