ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Fetzer <elstonk...@yahoo.com>
Subject Re: If any one from list then
Date Wed, 12 Aug 2009 15:46:09 GMT
The only think I can come up with is to write a macrodef that is passed a propertyName and
a value to be search if it is contained within:

1)  Take the list and add a , to the beginning and , to the end
2)  Do a regex on ",${searchString},"

If it's there, the item is contained within the list, set a property to "true"...




________________________________
From: Alec Fernandez <Alec.Fernandez@sas.com>
To: Ant Users List <user@ant.apache.org>
Sent: Wednesday, August 12, 2009 5:28:51 AM
Subject: RE: If any one from list then

Excellent point.

Delimiting the items in the list may be necessary.  Unfortunately, there is not a containsregexp
condition to help with separating the values from the delimiters and boundaries.

Scriptcondition might be a better alternative if you have the bsf.jar and a supported language


>> -----Original Message-----
>> From: Francis GALIEGUE [mailto:fge@one2team.com]
>> Sent: Wednesday, August 12, 2009 1:12 PM
>> To: Ant Users List
>> Subject: Re: If any one from list then
>> 
>> On Wed, Aug 12, 2009 at 10:05, Alec Fernandez<Alec.Fernandez@sas.com>
>> wrote:
>> > After spending 2 days convincing myself that there was a problem
>> with the <different> selector only to discover that my diff tool was
>> lying and that one of the files was indeed different (unix line ends
>> versus pc line ends so my editor was deceiving me too), I'm feeling
>> the need to respond :-)
>> >
>> > I think the condition task is what you are after.
>> >
>> > <condition>
>> >  <or>
>> >    <contains string="${myprop}" substring="foo" />
>> >    <contains string="${myprop}" substring="foo2" />
>> >  </or>
>> > </condition>
>> >
>> 
>> The problem is that if you want "foo" and the list is "foobar, baz",
>> the condition will match.
>> 
>> This is not an easy problem, admittedly. It could be done with two
>> imbricated <foreach> statements, but that would be an O(n^2)
>> algorithm. It may, or may not, be a problem, depending on the problem
>> size.
>> 
>> --
>> 
>> Francis Galiegue
>> ONE2TEAM
>> Ingénieur système
>> Mob : +33 (0) 683 877 875
>> Tel : +33 (0) 178 945 552
>> fge@one2team.com
>> 40 avenue Raymond Poincaré
>> 75116 Paris
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>> 


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