ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Joshua" <daniel.jos...@gridnode.com>
Subject RE: How to pass a fileset as parameter
Date Tue, 15 Jul 2003 10:50:00 GMT
>   ...
>     <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>

This wouldn't work cause the fileset reference will not be passed by the
antcall.
Maybe you meant this:

   ...
     <fileset id="db.sqlscripts.fileset" ... />
     <antcall target="record.sqlscripts" ... />
     <pathconvert property="db.sqlscripts.fileset.value"
                  refid="db.sqlscripts.fileset"
                  pathsep=","
     />
   ...

   <target name="record.sqlscripts">
     <foreach ... list="${db.sqlscripts.fileset.value}" />
   </target>

However, I would like to pass a fileset and not a string of all the
filesname.
This is because I used the fileset in different ways which I did not show in
my email, eg:

    <apply executable="${layer.dir}/dbscript.bat">
      <arg value="${db.exec.cmd}"/>
      <fileset refid="db.sqlscripts.fileset"/>
    </apply>

Although, I could always recreate the fileset using that string. Just
thought there is a better way.



Regards,
Daniel


-----Original Message-----
From: Jan.Materne@rzf.fin-nrw.de [mailto:Jan.Materne@rzf.fin-nrw.de]
Sent: Tuesday, 15 July, 2003 6:37 PM
To: user@ant.apache.org
Subject: RE: How to pass a fileset as parameter


> > <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


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


Mime
View raw message