ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Francis GALIEGUE <...@one2team.com>
Subject Re: If any one from list then
Date Fri, 14 Aug 2009 16:09:44 GMT
On Fri, Aug 14, 2009 at 18:01, Francis GALIEGUE<fge@one2team.com> wrote:
> On Wed, Aug 12, 2009 at 18:48, Eric Fetzer<elstonkers@yahoo.com> wrote:
>> OK, so here's how I did it.  It works at least...  Can anyone think of a better
way (I think it's kind of ugly)?
>>
>
> This is a solution.
>

Another solution, which is more clean, I think. It makes use of
ant-contrib's <foreach>.

With a little exercise, it can be easily generalized to n lists.

The <trycatch> would then be in the doit target, and fail at the first match.

<property name="outerlist" value="a,b,c"/>
<property name="innerlist" value="c,d,e"/>

<target name="doit">
    <foreach list="${outerlist}" param="outer" target="do-inner"
        inheritall="true"/>
</target>

<target name="do-inner">
    <for list="${innerlist}" param="inner">
        <sequential>
            <if>
                <equals arg1="${outer}" arg2="@{inner}"/>
                <then>
                    <sequential>
                        <echo message="Found match for ${outer}"/>
                    </sequential>
                </then>
            </if>
        </sequential>
    </for>
</target>

-- 

Francis Galiegue
ONE2TEAM
Ingénieur système
Mob : +33 (0) 683 877 875
Tel : +33 (0) 178 945 552
fge@one2team.com
40 avenue Raymond Poincaré
75116 Paris

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


Mime
View raw message