Another ant-contrib solution may be using the for task:

    <taskdef name="for" classname="net.sf.antcontrib.logic.For"/>

    <property name="build.lib.dir" value="prj1/lib"/>
    <property name="confs-to-deploy" value="default,debug,prod"/>
    <property name="build.deploy.target" value="prj1/deploy"/>

    <for list="${confs-to-deploy}" param="dir">
        <sequential>
            <copy todir="${build.deploy.target}/@{dir}">
                <fileset dir="${build.lib.dir}/@{dir}" includes="**/*"/>
            </copy>
        </sequential>
    </for>

Regards

Frank

Quoting Ken Gentle <[EMAIL PROTECTED]>:

> At 15:57 2006-01-21, you wrote:
> > >       Here is the error: the includes attribute should contain patterns
> > > matching the file names you want copied.
> > > The patterns only match the directories.
> > >       Try: includes="**/*.jar""
> >
> >Tommy,
> >
> >I know where the error is my real problem is the property friving
> >the selector
> >needs to be a comma separated list which describes the configurations to
> >deploy. I want to use that value to drive the copy. In other words changing
> >the comma separated values to resemble a patternset pattern is not an
> option.
> >So that leaves me with few options. I can define some custom task to do a
> >regex replace on the property value appending "/**/*" sequences on each
> entry
> >or I can use beanshell with a script task to  do the same. Neither of those
> >options are what I consider appealing. I thought I might be overlooking some
> >simple functionality in Ant when I ran into the problem but it just doesn't
> >seem to easy to copy directories specified in a CSV list without exposing
> >patternset syntax to the creator of the list.
>
> This will load the file and do the replacements:
>
> <project default="default">
>    <target name="default">
>      <loadfile srcfile="confs-to-deploy.csv"
> property="confs-to-deploy-pattern">
>        <filterchain>
>          <tokenfilter>
>            <linetokenizer/>
>            <replaceregex pattern="([^,]+),?"
>                          flags="g"
>                          replace="\1/** "/>
>          </tokenfilter>
>        </filterchain>
>
>      </loadfile>
>      <echo>${confs-to-deploy-pattern}</echo>
>    </target>
> </project>
>
> [EMAIL PROTECTED] $ ant -f prop-regex.xml
> Buildfile: prop-regex.xml
>
> default:
>       [echo] default/** debug/** prod/**
>
> BUILD SUCCESSFUL
> Total time: 0 seconds
>
>
> Or if you already have the property and you're open to AntContrib
> tasks, you can use the PropertyRegex to do the replacements:
>
> <project default="default">
>    <taskdef resource="net/sf/antcontrib/antlib.xml">
>      <classpath>
>        <pathelement
> location="../lib/build/ant-contrib-1.0b2/lib/ant-contrib.jar"/>
>      </classpath>
>    </taskdef>
>
>    <target name="default">
>      <property name="confs-to-deploy" value="default,debug,prod"/>
>      <propertyregex property="confs-to-deploy-pattern"
>                     input="${confs-to-deploy}"
>                     regexp="([^,]+),?"
>                     replace="\1/** " />
>      <echo>${confs-to-deploy-pattern}</echo>
>    </target>
> </project>
>
> [EMAIL PROTECTED] $ ant -f prop-regex.xml
> Buildfile: prop-regex.xml
>
> default:
>       [echo] default/** debug/** prod/**
>
> BUILD SUCCESSFUL
> Total time: 0 seconds
>
> >---------------------------------------------------
> >Clifton C. Craig, Software Engineer
> >Intelligent Computer Systems -  A Division of GBG
> >[EMAIL PROTECTED]
> >[EMAIL PROTECTED]
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to