ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoofkin <ariel.nab...@arielbloch.com>
Subject Re: AW: How to build an Ant path from a comma-seperated list?
Date Wed, 19 Nov 2008 19:39:30 GMT

Thanks for this idea!

The problem is that the input list is of unknown size, and I could not find
a regexp that will convert all items in this list correctly (I bet this can
be done).

So I came up with the following solution using <for>, <var> and
<propertyregex>:

    <var name="dependencies.path" value="" />
    <property name="input.list" value="aaa,bbb,ccc" />

    <target name="calculate-dependencies-path" description="Converts the
input.list comma-seperated list to dependencies.path">
        <for param="item" list="${input.list}">
            <sequential>
                <propertyregex property="item.path"
                        override="true"
                        input="@{item}"
                        regexp="(.+)"
                        replace="**/\1\/"
                        casesensitive="false"/>
                <var name="dependencies.path"
value="${dependencies.path},${item.path}" />
            </sequential>
        </for>
        <echo>RESULT: ${dependencies.path}</echo>
    </target>

This prints
    RESULT: ,**/aaa/,**/bbb/,**/ccc/

If there is an easier solution using one line regexp I would gladly use it,
as this is somewhat cumbersome.

Thanks!
Ariel
-- 
View this message in context: http://www.nabble.com/How-to-build-an-Ant-path-from-a-comma-seperated-list--tp20572597p20587661.html
Sent from the Ant - Users mailing list archive at Nabble.com.


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


Mime
View raw message