ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benjamin de Dardel <>
Subject discussion about conditional structures
Date Mon, 22 Jun 2009 21:54:32 GMT
Hi all,

I suppose that there have been a lot of discussion about conditional 
structures, but I would like to open another one.
For now, I notice two solutions :

 >> solution 1 : ant approach, using if and unless parameters.

    /<target name="todo" depends="ok,ko"/>/
    /<target name="ok" if="my-property-is-set"/>/
    /<target name="ko" unless="my-property-is-NOT-set"/>/

Disadvantages :
- not as simple as it should be
- property evaluation is not possible (or I don't know how to do this)

 >> solution 2 : ant-contrib

    /    <equals arg1="..." arg2="..."/>/

Disadvantages :
- verbose solution
- project still maintain ?
- solution not integrated in the ant project

 >> solution 3
I would like to discuss about another solution, based upon <antcall> et 
<condition> tasks.

    /<antcall target="todo">/
    /    <condition>/
    /        <equals arg1="${val1}" arg2="//${val2}//"/>/
    /    </condition>/

Target would be executed if condition succeeded.

Advantages :
+ use an existing task : <antcall> by adding a nested element
=> quiet easy to implement (see attached file)
+ use all <condition> possibilities

What do you think about this idea ?

Best regards,

View raw message