ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpr <marcin.remb...@curamsoftware.com>
Subject Re: Perform a task for every folder from the file.
Date Mon, 30 Apr 2007 15:17:18 GMT

I have one more question connected with a topic as well.

I use 
<ac:propertyselector property="packaging.tokens" delimiter=";"
match="^(~~.+)$" select="\1"/>
but i would like to do operation as fallows:
<ac:propertyselector property="packaging.tokens" delimiter=";"
match="^(${prefix}.+)$" select="\1"/>
where ${prefix} is user defined property
<property name="prefix" value="~~"/>

How to do that?




mpr wrote:
> 
> Yes, it works.
> 
> Thanks a lot for a help
> 
> 
> Patrick Martin-2 wrote:
>> 
>> You miss param="dir" in <ac:for>
>> 
>> On 4/30/07, mpr <marcin.rembisz@curamsoftware.com> wrote:
>>>
>>> Looks cool for me but:
>>>
>>>         <target description="fullGenericTokenReplacements"
>>> name="fullGenericTokenReplacements">
>>>                 <echo message="LS  = [${line.separator}]"/>
>>>
>>>                 <loadfile srcfile="./${src.file}"
>>> property="src.file.head"/>
>>>                 <ac:for list="${src.file.head}"
>>> delimiter="${line.separator}">
>>>                         <ac:sequential>
>>>                                 <echo message=""/>
>>>                                 <echo message="All files under the
>>> folder @{dir} are going to be
>>> replaced"/>
>>>                         </ac:sequential>
>>>                 </ac:for>
>>>         </target>
>>>
>>> I get
>>>
>>> BUILD FAILED
>>> C:\CMApplicationTools2\PackagingTools\build.xml:251: You must supply a
>>> property name to set on each iteration in param
>>>
>>> What to do with that?
>>>
>>>
>>>
>>> Patrick Martin-2 wrote:
>>> >
>>> > Hello,
>>> >
>>> > I think you don't need to use antcount for that (even though this is a
>>> > great task ... ;-))
>>> >
>>> > you should be able to load your file with loadfile, without filtering,
>>> > and then use ac:for with delimiter="${line.separator}"
>>> >
>>> > [...]
>>> > <loadfile srcfile="./${src.file}" property="src.file.head" />
>>> > <ac:for list="${src.file.head}" param="dir"
>>> delimiter="${line.separator}">
>>> > [...]
>>> > </ac:for>
>>> >
>>> > Rgds,
>>> >
>>> > Patrick
>>> >
>>> > On 4/30/07, Camer38 <rembiszm@gmail.com> wrote:
>>> >>
>>> >> It is a part of a bigger application so I cannot change the version
>>> af
>>> >> Ant.
>>> >> I would like to follow my fir idea , that almost work. The problem
>>> that I
>>> >> have
>>> >> is describe below.
>>> >>
>>> >>
>>> >> I have the file user.properties and inside a paths to folders are
>>> defined
>>> >> e.g.
>>> >> C:\CMDOCUMENTATION4\DOCCENTER\BUILD
>>> >> C:\CMApplicationTools2\PackagingTools
>>> >>
>>> >> For each folder from user.properties I need to perform a task.
>>> >> I read a file and for each line I create a property(${prefix})
>>> starting
>>> >> with
>>> >> ~~
>>> >>
>>> >>                 <loadfile srcfile="./${src.file}"
>>> >> property="src.file.head">
>>> >>                         <filterchain>
>>> >>                                 <tokenfilter>
>>> >>                                         <stringtokenizer/>
>>> >>                                         <countfilter
>>> >> property="nb.matching.tokens"  match="^(.+)$">
>>> >>                                                 <!--Create property
>>> with
>>> >> a specific name-->
>>> >>                                                 <counteach
>>> >> propertyprefix="${prefix}" select="\1"/>
>>> >>                                         </countfilter>
>>> >>                                 </tokenfilter>
>>> >>                         </filterchain>
>>> >>                 </loadfile>
>>> >>                 <echo message="${nb.matching.tokens}"/>
>>> >>                 <echo message="${src.file.head}"/>
>>> >>                 <echoproperties prefix="${prefix}"/>
>>> >>         <ac:propertyselector property="user.files"
>>> >> delimiter="${delimiter}"
>>> >> match="~~(.+)" select="\1"/>
>>> >>                 <echo message="${user.files}"/>
>>> >> </target>
>>> >>
>>> >>
>>> >> At the end of the target I need a list of all those properties so, I
>>> use
>>> >> ac:propertyselector  but I do not get a right result. What I received
>>> is
>>> >> a
>>> >> path b-to-file but without \ character.
>>> >> Do you have an idea why?
>>> >> Could you suggest a right solution, please?
>>> >> counteach task is taken from:
>>> >> http://antcount.sourceforge.net/
>>> >>
>>> >>
>>> >>
>>> >> OUTPUT
>>> >>
>>> >>
>>> >> genericTokenReplacement:
>>> >>      [echo] 2
>>> >>      [echo] C:\CURAMDOCUMENTATION4\DOCCENTER\BUILD
>>> >>      [echo] C:\CuramApplicationTools2\PackagingTools
>>> >> [echoproperties] #Ant properties
>>> >> [echoproperties] #Mon Apr 30 14:21:19 BST 2007
>>> >> [echoproperties] ~~C\:\\CURAMDOCUMENTATION4\\DOCCENTER\\BUILD=1
>>> >> [echoproperties] ~~C\:\\CuramApplicationTools2\\PackagingTools=1
>>> >>      [echo]
>>> >>
>>> C:CURAMDOCUMENTATION4DOCCENTERBUILD,C:CuramApplicationTools2PackagingTools
>>> >>
>>> >>
>>> >>
>>> >>
>>> >>
>>> >> Matt Benson wrote:
>>> >> >
>>> >> > I didn't read your error message closely enough the
>>> >> > first time.  It shows that <tokens> is taken as
>>> >> > belonging to the ac namespace, indicating it couldn't
>>> >> > be found in the default namespace.  The example
>>> >> > requires Ant 1.7 .
>>> >> >
>>> >> > -Matt
>>> >> >
>>> >> > --- mpr <marcin.rembisz@curamsoftware.com> wrote:
>>> >> >
>>> >> >>
>>> >> >> I have followed your instructions, download the
>>> >> >> latest AC release and build
>>> >> >> ant-contrib.jar from source but I still get the same
>>> >> >> error.
>>> >> >> What do I have to do?
>>> >> >>
>>> >> >>
>>> >> >>
>>> >> >> Matt Benson wrote:
>>> >> >> >
>>> >> >> > I can't recall when AC last had a release; you
>>> >> >> might
>>> >> >> > have to build from the current source, wherein
>>> >> >> <for>
>>> >> >> > can handle any type that returns an Iterator.
>>> >> >> >
>>> >> >> > -Matt
>>> >> >> >
>>> >> >> > --- mpr <marcin.rembisz@curamsoftware.com> wrote:
>>> >> >> >
>>> >> >> >>
>>> >> >> >> I get
>>> >> >> >> The <antlib:net.sf.antcontrib:for> type doesn't
>>> >> >> >> support the nested
>>> >> >> >> "antlib:net.sf.antcontrib:tokens" element.
>>> >> >> >>
>>> >> >> >> What version ant-contrib.jar should I have?
>>> >> >> >>
>>> >> >> >>
>>> >> >> >>
>>> >> >> >> Matt Benson wrote:
>>> >> >> >> >
>>> >> >> >> >
>>> >> >> >> > --- mpr <marcin.rembisz@curamsoftware.com>
>>> >> >> wrote:
>>> >> >> >> >
>>> >> >> >> >>
>>> >> >> >> >> Hi,
>>> >> >> >> >>
>>> >> >> >> >> Could you provide an example, please?
>>> >> >> >> >>
>>> >> >> >> >
>>> >> >> >> > <project xmlns:ac="antlib:net.sf.antcontrib">
>>> >> >> >> >   <property name="br" value="${line.separator}"
>>> >> >> />
>>> >> >> >> >   <echo
>>> >> >> >> file="tokens">foo${br}bar${br}baz${br}</echo>
>>> >> >> >> >   <ac:for param="t">
>>> >> >> >> >     <tokens>
>>> >> >> >> >       <file file="tokens" />
>>> >> >> >> >     </tokens>
>>> >> >> >> >     <sequential>
>>> >> >> >> >       <echo>@@{t}=@{t}</echo>
>>> >> >> >> >     </sequential>
>>> >> >> >> >   </ac:for>
>>> >> >> >> > </project>
>>> >> >> >> >
>>> >> >> >> > -Matt
>>> >> >> >> >
>>> >> >> >> >>
>>> >> >> >> >>
>>> >> >> >> >> Matt Benson wrote:
>>> >> >> >> >> >
>>> >> >> >> >> > The <tokens> resourcecollection
should be
>>> >> >> >> directly
>>> >> >> >> >> > passable to <ac:for>.
>>> >> >> >> >> >
>>> >> >> >> >> > HTH,
>>> >> >> >> >> > Matt
>>> >> >> >> >> >
>>> >> >> >> >> > --- mpr <marcin.rembisz@curamsoftware.com>
>>> >> >> >> wrote:
>>> >> >> >> >> >
>>> >> >> >> >> >>
>>> >> >> >> >> >> Hi,
>>> >> >> >> >> >>
>>> >> >> >> >> >> I have the file user.properties
and inside
>>> >> >> a
>>> >> >> >> >> paths
>>> >> >> >> >> >> to folders are defined
>>> >> >> >> >> >> e.g.
>>> >> >> >> >> >> C:\Application\PackagingTools4
>>> >> >> >> >> >> C:\ApplicationTools2\PackagingTools3
>>> >> >> >> >> >>
>>> >> >> >> >> >> For each folder from user.properties
I need
>>> >> >> to
>>> >> >> >> >> >> perform an Operation (task).
>>> >> >> >> >> >>
>>> >> >> >> >> >> What is the simplest way to do that?
>>> >> >> >> >> >> At this moment I do:
>>> >> >> >> >> >>
>>> >> >> >> >> >> [CODE]
>>> >> >> >> >> >>
>>> >> >> >> >> >>     <target
>>> >> >> >> description="genericTokenReplacements"
>>> >> >> >> >> >> name="genericTokenReplacement">
>>> >> >> >> >> >>             <loadfile srcfile="./${src.file}"
>>> >> >> >> >> >> property="src.file.head">
>>> >> >> >> >> >>                     <filterchain>
>>> >> >> >> >> >>                             <tokenfilter>
>>> >> >> >> >> >>                                
    <stringtokenizer/>
>>> >> >> >> >> >>                                
    <countfilter
>>> >> >> >> property="nb.matching.tokens"
>>> >> >> >> >> >> match="([\w\\/]+)+">
>>> >> >> >> >> >>                                
            <!--Create
>>> >> property with a specific
>>> >> >> >> name-->
>>> >> >> >> >> >>                                
            <counteach
>>> >> propertyprefix="${prefix}"
>>> >> >> >> >> >> select="\1"/>
>>> >> >> >> >> >>                                
    </countfilter>
>>> >> >> >> >> >>                             </tokenfilter>
>>> >> >> >> >> >>                     </filterchain>
>>> >> >> >> >> >>             </loadfile>
>>> >> >> >> >> >>             <echo message="${src.file.head}"/>
>>> >> >> >> >> >>             <echoproperties prefix="${prefix}"/>
>>> >> >> >> >> >>             <ac:propertyselector
>>> >> >> property="user.files"
>>> >> >> >> >> >> delimiter="${delimiter}"
>>> >> >> >> >> >> match="~~(.+)" select="\1"/>
>>> >> >> >> >> >>             <echo message="${user.files}"/>
>>> >> >> >> >> >>             <ac:for list="${user.files}"
param="dir">
>>> >> >> >> >> >>                     <ac:sequential>
>>> >> >> >> >> >>                             <echo
message="All files
>>> under
>>> >> the
>>> >> >> folder
>>> >> >> >> >> @{dir}
>>> >> >> >> >> >> are going to be
>>> >> >> >> >> >> replaced"/>
>>> >> >> >> >> >>                             <--!
OPERATION here-->
>>> >> >> >> >> >>                     </ac:sequential>
>>> >> >> >> >> >>             </ac:for>
>>> >> >> >> >> >>     </target>
>>> >> >> >> >> >>
>>> >> >> >> >> >> [/CODE]
>>> >> >> >> >> >>
>>> >> >> >> >> >> but I have noticed the problem.
>>> >> >> >> >> >> <ac:propertyselector property="user.files"
>>> >> >> >> >> >> delimiter="${delimiter}"
>>> >> >> >> >> >> match="~~(.+)" select="\1"/>
>>> >> >> >> >> >> trim out (eat) character "\" so
i get full
>>> >> >> >> path
>>> >> >> >> >> to
>>> >> >> >> >> >> folder whit out "\"
>>> >> >> >> >> >>
>>> >> >> >> >> >> Could you suggest to solve it?
>>> >> >> >> >> >> Thank you in advance,
>>> >> >> >> >> >> MR
>>> >> >> >> >> >>
>>> >> >> >> >> >> --
>>> >> >> >> >> >> View this message in context:
>>> >> >> >> >> >>
>>> >> >> >> >> >
>>> >> >> >> >>
>>> >> >> >> >
>>> >> >> >>
>>> >> >> >
>>> >> >>
>>> >> >
>>> >>
>>> http://www.nabble.com/Perform-a-task-for-every-folder-from-the-file.-tf3658328.html#a10221352
>>> >> >> >> >> >> Sent from the Ant - Users mailing
list
>>> >> >> archive
>>> >> >> >> at
>>> >> >> >> >> >> Nabble.com.
>>> >> >> >> >> >>
>>> >> >> >> >> >>
>>> >> >> >> >> >>
>>> >> >> >> >> >
>>> >> >> >> >>
>>> >> >> >> >
>>> >> >> >>
>>> >> >> >
>>> >> >>
>>> >> >
>>> ---------------------------------------------------------------------
>>> >> >> >> >> >> To unsubscribe, e-mail:
>>> >> >> >> >> >> user-unsubscribe@ant.apache.org
>>> >> >> >> >> >> For additional commands, e-mail:
>>> >> >> >> >> >> user-help@ant.apache.org
>>> >> >> >> >> >>
>>> >> >> >> >> >>
>>> >> >> >> >> >
>>> >> >> >> >> >
>>> >> >> >> >> >
>>> >> >> >>
>>> >> >> __________________________________________________
>>> >> >> >> >> > 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
>>> >> >> >> >> >
>>> >> >> >> >> >
>>> >> >> >> >> >
>>> >> >> >> >>
>>> >> >> >> >> --
>>> >> >> >> >> View this message in context:
>>> >> >> >> >>
>>> >> >> >> >
>>> >> >> >>
>>> >> >> >
>>> >> >>
>>> >> >
>>> >>
>>> http://www.nabble.com/Perform-a-task-for-every-folder-from-the-file.-tf3658328.html#a10221747
>>> >> >> >> >> Sent from the Ant - Users mailing list archive
>>> >> >> at
>>> >> >> >> >> Nabble.com.
>>> >> >> >> >>
>>> >> >> >> >>
>>> >> >> >> >>
>>> >> >> >> >
>>> >> >> >>
>>> >> >> >
>>> >> >>
>>> >> >
>>> ---------------------------------------------------------------------
>>> >> >> >> >> To unsubscribe, e-mail:
>>> >> >> >> >> user-unsubscribe@ant.apache.org
>>> >> >> >> >> For additional commands, e-mail:
>>> >> >> >> >> user-help@ant.apache.org
>>> >> >> >> >>
>>> >> >> >> >>
>>> >> >> >> >
>>> >> >> >> >
>>> >> >> >> >
>>> >> >> __________________________________________________
>>> >> >> >> > 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
>>> >> >> >> >
>>> >> >> >> >
>>> >> >> >> >
>>> >> >> >>
>>> >> >> >> --
>>> >> >> >> View this message in context:
>>> >> >> >>
>>> >> >> >
>>> >> >>
>>> >> >
>>> >>
>>> http://www.nabble.com/Perform-a-task-for-every-folder-from-the-file.-tf3658328.html#a10222424
>>> >> >> >> Sent from the Ant - Users mailing list archive at
>>> >> >> >> Nabble.com.
>>> >> >> >>
>>> >> >> >>
>>> >> >> >>
>>> >> >> >
>>> >> >>
>>> >> >
>>> ---------------------------------------------------------------------
>>> >> >> >> To unsubscribe, e-mail:
>>> >> >> >> user-unsubscribe@ant.apache.org
>>> >> >> >> For additional commands, e-mail:
>>> >> >> >> user-help@ant.apache.org
>>> >> >> >>
>>> >> >> >>
>>> >> >> >
>>> >> >> >
>>> >> >> > __________________________________________________
>>> >> >> > 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
>>> >> >> >
>>> >> >> >
>>> >> >> >
>>> >> >>
>>> >> >> --
>>> >> >> View this message in context:
>>> >> >>
>>> >> >
>>> >>
>>> http://www.nabble.com/Perform-a-task-for-every-folder-from-the-file.-tf3658328.html#a10251022
>>> >> >> Sent from the Ant - Users mailing list archive at
>>> >> >> Nabble.com.
>>> >> >>
>>> >> >>
>>> >> >>
>>> >> >
>>> ---------------------------------------------------------------------
>>> >> >> To unsubscribe, e-mail:
>>> >> >> user-unsubscribe@ant.apache.org
>>> >> >> For additional commands, e-mail:
>>> >> >> user-help@ant.apache.org
>>> >> >>
>>> >> >>
>>> >> >
>>> >> >
>>> >> > __________________________________________________
>>> >> > 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
>>> >> >
>>> >> >
>>> >> >
>>> >>
>>> >> --
>>> >> View this message in context:
>>> >>
>>> http://www.nabble.com/Perform-a-task-for-every-folder-from-the-file.-tf3658328.html#a10253485
>>> >> Sent from the Ant - Users mailing list archive at Nabble.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
>>> >
>>> >
>>> >
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Perform-a-task-for-every-folder-from-the-file.-tf3658328.html#a10254747
>>> Sent from the Ant - Users mailing list archive at Nabble.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
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Perform-a-task-for-every-folder-from-the-file.-tf3658328.html#a10255191
Sent from the Ant - Users mailing list archive at Nabble.com.


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


Mime
View raw message