You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by hi...@accenture.com on 2005/06/14 14:53:44 UTC

macrodef+fileset

Hello gentle people;
i would like to write a macrodef which calls an executable that takes a list of files as arguments to its options.
For the macrodef/exec part i manage it, but how to specify a fileset (or a path like struture) as an argument?
How can i do that?

Thanks for any help!

-----Original Message-----
From: Dick, Brian E. [mailto:Brian.Dick@FMR.com]
Sent: Tue 6/14/2005 2:02 PM
To: Ant Users List
Subject: RE: Count number of files in fileset
 
Where is ${toString:} documented? Are there any other pseudo-properties?

-----Original Message-----
From: Peter Reilly [mailto:peterreilly@apache.org] 
Sent: Monday, June 13, 2005 11:58 AM
To: Ant Users List
Subject: Re: Count number of files in fileset


Matt Benson wrote:

>1) Ant 1.7 will contain a <resourcecount> task that
>can count files from a fileset.
>  
>
In 1.6 you could use the ${toString:} psuedo-property:
  <target name="present">
    <fileset id="fileset.notpresent" dir="."
             includes="*.notpresent"/>
    <condition property="no.files.present">
      <equals arg1="" arg2="${toString:fileset.notpresent}"/>
    </condition>
    <echo>no.files.present=${no.files.present}</echo>
    <fileset id="fileset.present" dir="."
             includes="*.xml"/>
    <condition property="no.files.present_2">
      <equals arg1="" arg2="${toString:fileset.present}"/>
    </condition>
    <echo>no.files.present_2=${no.files.present_2}</echo>
  </target>


>2) <concat> shouldn't do anything if there are no
>existing files.
>  
>
No, this is not true in this case. The <header> and <footer> elements 
are independent
of the fileset.

Peter

>-Matt
>
>--- Kees van Dieren <ke...@mp-objects.com>
>wrote:
>
>  
>
>>Hello,
>>
>> 
>>
>>I have to concat some files from a fileset together
>>into another file. I use
>>the following fileset for this:
>>
>><concat
>>destfile="${build.webservices.dir}/config.xml">
>>
>><header>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
>>
>>&lt;configuration
>>
>>    
>>
>xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config"&gt;
>  
>
>></header>
>>
>>                  <fileset
>>refid="module-webservices-config-fileset" />
>>
>>                  <footer>&lt;/configuration&gt;
>></footer>
>>
>>            </concat>
>>
>> 
>>
>>However, this only should hebben if the number of
>>files in fileset
>>module-webservices-config-fileset > 0.
>>
>> 
>>
>>Is there a way, to fetch the number of files in a
>>fileset (may be with
>>ant-contrib, or another 3rd-party addon)?
>>
>> 
>>
>>Thanks in advance.
>>
>> 
>>
>>Kind regards,
>>
>>Kees van Dieren
>>Senior Software Engineer
>>
>>MP Objects Supply Chain Software
>>Stationsplein 45
>>3013 AK Rotterdam
>>The Netherlands
>>
>>Post address:
>>Postbus 29126
>>3001 GC Rotterdam
>>
>>Mobile: +31 (0)6-43068619
>>Phone: +31 (0)10-2900304
>>Fax: +31 (0)10-2900305
>>
>> 
>>
>>
>>    
>>
>
>
>__________________________________________________
>Do You Yahoo!?
>Tired of spam?  Yahoo! Mail has the best spam protection around 
>http://mail.yahoo.com 
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>
>
>  
>


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

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




This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.  If you have received it in error, please notify the sender immediately and delete the original.  Any other use of the email by you is prohibited.


RE: macrodef+fileset

Posted by Bill Rich <bi...@wilandra.com>.
The attached macro snippet does something like what you want. It takes
filetypelist as a parameter. filetypelist is a semi-colon separated list of
items from a control file.

<macrodef	name="getoutfilelist"
 description="Establishes a list of the output file names for the specified
file types found in the project file (.slpd). Each file name is in an
independent property that must be gathered together into a list property if
needed. The list of properties is identified by the unique list id
specified. The list of all translatable files in the project is assumed to
be in the projXLFileList property.">
 <attribute name="filetypelist"/>
 <attribute name="listid"/>
 <sequential>
  <for list="@{filetypelist}"
   delimiter=";"
   param="afiletype">
   <sequential>
    <for list="${projXLFileList}"
     delimiter=";"
     param="afile">
     <sequential>
     <propertyregex property="@{listid}@{afile}#name#"
      input="@{afile}"
      regexp="/type &quot;@{afiletype}&quot;.* /outputname
&quot;([^&quot;]*)&quot;.*"
      replace="\1"
      casesensitive="false"/>
     </sequential>
    </for>
   </sequential>
  </for>
 </sequential>
</macrodef> 

HTH Bill
-----Original Message-----
From: hind.lwahhabi@accenture.com [mailto:hind.lwahhabi@accenture.com] 
Sent: Tuesday, June 14, 2005 5:54 AM
To: user@ant.apache.org
Subject: macrodef+fileset


Hello gentle people;
i would like to write a macrodef which calls an executable that takes a list
of files as arguments to its options.
For the macrodef/exec part i manage it, but how to specify a fileset (or a
path like struture) as an argument?
How can i do that?

Thanks for any help!

-----Original Message-----
From: Dick, Brian E. [mailto:Brian.Dick@FMR.com]
Sent: Tue 6/14/2005 2:02 PM
To: Ant Users List
Subject: RE: Count number of files in fileset
 
Where is ${toString:} documented? Are there any other pseudo-properties?

-----Original Message-----
From: Peter Reilly [mailto:peterreilly@apache.org]
Sent: Monday, June 13, 2005 11:58 AM
To: Ant Users List
Subject: Re: Count number of files in fileset


Matt Benson wrote:

>1) Ant 1.7 will contain a <resourcecount> task that
>can count files from a fileset.
>  
>
In 1.6 you could use the ${toString:} psuedo-property:
  <target name="present">
    <fileset id="fileset.notpresent" dir="."
             includes="*.notpresent"/>
    <condition property="no.files.present">
      <equals arg1="" arg2="${toString:fileset.notpresent}"/>
    </condition>
    <echo>no.files.present=${no.files.present}</echo>
    <fileset id="fileset.present" dir="."
             includes="*.xml"/>
    <condition property="no.files.present_2">
      <equals arg1="" arg2="${toString:fileset.present}"/>
    </condition>
    <echo>no.files.present_2=${no.files.present_2}</echo>
  </target>


>2) <concat> shouldn't do anything if there are no
>existing files.
>  
>
No, this is not true in this case. The <header> and <footer> elements 
are independent
of the fileset.

Peter

>-Matt
>
>--- Kees van Dieren <ke...@mp-objects.com>
>wrote:
>
>  
>
>>Hello,
>>
>> 
>>
>>I have to concat some files from a fileset together
>>into another file. I use
>>the following fileset for this:
>>
>><concat
>>destfile="${build.webservices.dir}/config.xml">
>>
>><header>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
>>
>>&lt;configuration
>>
>>    
>>
>xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config"&gt;
>  
>
>></header>
>>
>>                  <fileset
>>refid="module-webservices-config-fileset" />
>>
>>                  <footer>&lt;/configuration&gt;
>></footer>
>>
>>            </concat>
>>
>> 
>>
>>However, this only should hebben if the number of
>>files in fileset
>>module-webservices-config-fileset > 0.
>>
>> 
>>
>>Is there a way, to fetch the number of files in a
>>fileset (may be with
>>ant-contrib, or another 3rd-party addon)?
>>
>> 
>>
>>Thanks in advance.
>>
>> 
>>
>>Kind regards,
>>
>>Kees van Dieren
>>Senior Software Engineer
>>
>>MP Objects Supply Chain Software
>>Stationsplein 45
>>3013 AK Rotterdam
>>The Netherlands
>>
>>Post address:
>>Postbus 29126
>>3001 GC Rotterdam
>>
>>Mobile: +31 (0)6-43068619
>>Phone: +31 (0)10-2900304
>>Fax: +31 (0)10-2900305
>>
>> 
>>
>>
>>    
>>
>
>
>__________________________________________________
>Do You Yahoo!?
>Tired of spam?  Yahoo! Mail has the best spam protection around 
>http://mail.yahoo.com 
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>
>
>  
>


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

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




This message is for the designated recipient only and may contain
privileged, proprietary, or otherwise private information.  If you have
received it in error, please notify the sender immediately and delete the
original.  Any other use of the email by you is prohibited.




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