ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Reilly <peterrei...@apache.org>
Subject Re: lists of lists
Date Tue, 28 Sep 2004 08:07:03 GMT
Using ant-contrib's <for/> one can do this:

  <target name="list">
    <property name="all.list" value="alist,blist,clist"/>

    <property name="alist" value="a,b,c"/>
    <property name="blist" value="d,e,f"/>
    <property name="clist" value="g,h,j"/>
    <ac:for param="sublist.name" list="${all.list}">
      <sequential>
        <ac:for param="component.name" list="${@{sublist.name}}">
          <sequential>
            <echo message="Project: @{sublist.name} Component: 
'@{component.name}'"/>
          </sequential>
        </ac:for>
      </sequential>
    </ac:for>
  </target>


resulting in:

list:
     [echo] Project: alist Component: 'a'
     [echo] Project: alist Component: 'b'
     [echo] Project: alist Component: 'c'
     [echo] Project: blist Component: 'd'
     [echo] Project: blist Component: 'e'
     [echo] Project: blist Component: 'f'
     [echo] Project: clist Component: 'g'
     [echo] Project: clist Component: 'h'
     [echo] Project: clist Component: 'j'

Peter

Ray Madigan wrote:

>I have a complicated development environment and want to do something like
>the following:
>
>all.list=alist,blist,clist
>
>alist=a,b,c
>blist=d,e,f
>clist=g,h,j
>
><foreach param="sublist.name" list="alist" target="foo"/>
>
><target name="foo">
>  <foreach param="component.name" list="${sublist.name}" target="bar"/>
></target>
>
><target name="bar">
>  <echo message="Project: ${sublist.name} Component: ${component.name}/>
></target>
>
>Of course this won't work because properties aren't variables and I can't
>set the property sublist.name to the value of the property represented by
>the string alist for example.
>
>The reason I want to do this is each list in all.list represents a directory
>with components and I want to
>be able to treat the directories generically, all the same.  Some of them
>are internal directories and
>some of the directories are supplied by customers and I don't want to have
>to have the client have to add
>to the xml build files.
>
>Thanks if anyone can help.
>
>-----Original Message-----
>From: Greg Irvine [mailto:greg.irvine@thalesatm.com]
>Sent: Monday, September 27, 2004 4:06 PM
>To: user@ant.apache.org
>Subject: RE: truncating a directory
>
>
>Hi Jan.
>
>Thanks for your response.
>
>Unfortunately <move> and <copy> don't support nested <mapper>s.
>I'll continue to investigate this though.
>Thanks for the advice.
>
>Greg.
>
>
>-----Original Message-----
>From: Jan.Materne@rzf.fin-nrw.de [mailto:Jan.Materne@rzf.fin-nrw.de]
>Sent: Monday, 27 September 2004 3:24 PM
>To: user@ant.apache.org
>Subject: AW: truncating a directory
>
>Not tried, but using a mapper [1] should help:
><move todir="">
>    <fileset dir=""/>
>    <regexpmapper from="*/(.*)" to="\1"/>
></move>
>
>Jan
>
>
>[1] http://ant.apache.org/manual/CoreTypes/mapper.html
>
>
>  
>
>>-----Urspr√ľngliche Nachricht-----
>>Von: Greg Irvine [mailto:greg.irvine@thalesatm.com]
>>Gesendet am: Montag, 27. September 2004 03:44
>>An: 'Laconia Data Systems'; 'Ant Users List'
>>Betreff: RE: truncating a directory
>>
>>Hi Martin.
>>
>>Thanks for your response, but I think there was a slight
>>misunderstanding of
>>my requirements.
>>
>>I don't wish to delete files/directories beneath a given
>>directory as would
>>seem to be the aim of the DeleteSub task.
>>
>>I wish to move the contents of a number of directories to a single
>>directory, using a wildcard based set.  E.g. move build/*/** test/
>>
>>i.e.  Starting with:
>>build/
>>	dirA/
>>		subDirA/
>>			fileA.java
>>	dirB/
>>		subDirB/
>>			fileB.java
>>
>>
>>Ending with:
>>test/
>>	subDirA/
>>		fileA.java
>>	subDirB/
>>		fileB.java
>>
>>
>>
>>Thanks for your email anyway.
>>
>>Regards,
>>
>>Greg.
>>
>>
>>
>>
>>-----Original Message-----
>>From: Laconia Data Systems [mailto:webmaster@laconiadatasystems.com]
>>Sent: Monday, 27 September 2004 11:23 AM
>>To: Ant Users List; greg.irvine@thalesatm.com
>>Subject: Re: truncating a directory
>>
>>yes Greg
>>I created a java task called DeleteSub which deletes ALL files and ALL
>>directories of a specified root folder specification
>>now available at ftp.laconiadatasystems.com
>>let me know if you're interested and I'll create a
>>username/password for you
>>for access
>>Kind regards,
>>Martin Gainty
>>----- Original Message -----
>>From: "Greg Irvine" <greg.irvine@thalesatm.com>
>>To: "'Ant Users List'" <user@ant.apache.org>
>>Sent: Sunday, September 26, 2004 7:57 PM
>>Subject: truncating a directory
>>
>>
>>    
>>
>>>Is there an easy way to remove the first directory from a directory
>>>structure when moving a file set?
>>>
>>>
>>>
>>>i.e.
>>>
>>>    build/
>>>
>>>        project1/com/mycompany/project1/**/*.class
>>>
>>>        project2/com/mycompany/project2/**/*.class
>>>
>>>        project3/com/mycompany/project3/**/*.class
>>>
>>>
>>>
>>>to (where the first directory (project1, project2 and project3) are
>>>removed).
>>>
>>>    test/
>>>
>>>        com/mycompany/project1/**/*.class
>>>
>>>                                   project2/**/*.class
>>>
>>>                                   project3/**/*.class
>>>
>>>
>>>
>>>
>>>
>>>I could probably use the foreach task in the ant-contribs,
>>>      
>>>
>>but is there an
>>    
>>
>>>easier way?
>>>
>>>
>>>
>>>Thanks for any advice.
>>>
>>>
>>>
>>>Greg.
>>>
>>>
>>>
>>>
>>>      
>>>
>>
>>---------------------------------------------------------------------
>>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
>
>
>
>  
>


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


Mime
View raw message