ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <hol...@yahoo.com>
Subject Re: Set property with condition.
Date Mon, 10 Sep 2001 16:55:11 GMT
--- Natalia Bello <nbello@isabel.be> wrote:
> I think it is not difficult, but i dont find the way to do it.
> I want to set a property only if two others are not set.
> That is,  i want to set the property "compile.all" if "include.module"
> and "exclude.module" both, are not set.
> To what I should compare the properties??

I don't think you can use <condition> to check if a property is simply set
(regardless of what it's set to) -- but you could use the if/unless attrs
instead:

  <target name="setCompile" depends="chkInc, chkEx" unless="notAll">
    <property name="compile.all" value="true"/>
  </target>

  <target name="chkInc" if="include.module">
    <property name="notAll" value="true"/>
  </target>
  <target name="chkEx" if="exclude.module">
    <property name="notAll" value="true"/>
  </target>

To use <condition>, you'd need to compare against all the possible module
names -- eg:
    <condition property="compile.all">
      <not>
        <or>
          <equals arg1="${include.module}" arg2="foo"/>
          <equals arg1="${include.module}" arg2="bar"/>
          <equals arg1="${exclude.module}" arg2="foo"/>
          <equals arg1="${exclude.module}" arg2="bar"/>
        </or>
      </not>
    </condition>
which could get real ugly real fast.

Diane

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



__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com

Mime
View raw message