ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject RE: How to pass a fileset as parameter
Date Tue, 15 Jul 2003 10:36:37 GMT
> > <property name="fs.value" refid="thefileset"/>
> 
> This seems interesting. I assume that this will work even with
> [inheritRefs="false"]

Sure, that is a simple property, not a reference.


>      <fileset id="db.sqlscripts.fileset"
>               dir="${dbscript.dir}"
>               includes="patch*.sql"
>               excludes="${excludes}"/>
>      <property name="fs.value" refid="db.sqlscripts.fileset"/>
>      <antcall target="record.sqlscripts" inheritRefs="false"/>
>    ...
> 
>    <target name="record.sqlscripts">
>      <foreach target="record.sqlscript"
>               param="sqlscript.file"
>               inheritall="true">

>        <path>
>          <fileset refid="${fs.value}"/>
>        </path>

Don´t use the <path> here. Use the 'list' attribute. The property 'fs.value'
contains all
the files the fileset has selected. Try it with <echo>${fs.value}</echo>.
But ensure that the same file separator is used: for foreach and for the
property. You
can set the separator with foreach´s 'delimiter' attribute or you can use
<pathconvert/> for
setting the property.

See my example in the last post.


>      </foreach>
>    </target>
> 
> 
>

Here again that example

 
>   ...
>     <fileset id="db.sqlscripts.fileset" ... />
>     <antcall target="record.sqlscripts" ... />
>   ...
> 
>   <target name="record.sqlscripts">
>     <pathconvert property="db.sqlscripts.fileset.value"
>                  refid="db.sqlscripts.fileset"
>                  pathsep=","
>     />
>     <foreach ... list="${db.sqlscripts.fileset.value}" />
>   </target>
> 



Jan

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message