msd_2
msd_2

Reputation: 1187

Checking two conditions before compiling using Ant build

I want to check for presence of dependent files before my code is compiled. I am doing the following

<available file="XX" property="isXXAvailable"/>
<available file="YY" property="isYYAvailable"/>    

For compilation I want to check whether both the properties are true. Only then go ahead with the compilation

<target name="compile" depends="init" unless="isXXAvailable" unless="isYYavailable">

Is it possible to check for both the properties during compiling

Upvotes: 0

Views: 45

Answers (1)

Graham Griffiths
Graham Griffiths

Reputation: 2216

You can 'AND' two 'available' condtions together into a single one :

<condition property="files.available">
  <and>
    <available file="XX"/>
    <available file="YY"/>
  </and>
</condition>

then you can use this condition in the same way you are currently doing in your target

http://ant.apache.org/manual/Tasks/condition.html

Upvotes: 1

Related Questions