ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <>
Subject Re: Set property with condition.
Date Mon, 10 Sep 2001 16:55:11 GMT
--- Natalia Bello <> 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

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

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

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



Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger

View raw message