ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benoît Lubek <benoit.lu...@pegasis.fr>
Subject Re: Simple manipulation of a property value
Date Thu, 28 Oct 2004 08:07:47 GMT
Thank you all.
I chose Erik's solution, but yours is a good idea too.

Thanks,

-- 
B.LUBEK


Kris Read wrote:
> This is a hack, but: 
> 
> PropertyFile to persist the property to a file. 
> 
> Replace or ReplaceRegExp to alter the value. 
> 
> Then reload from the file. 
> 
> 
> 
> On Wed, 27 Oct 2004 10:04:33 -0400, Erik Hatcher
> <erik@ehatchersolutions.com> wrote:
> 
>>On Oct 27, 2004, at 8:56 AM, Benoît Lubek wrote:
>>
>>>Hi,
>>>
>>>I have a property :
>>>
>>><property name="version" value="v1.0.2" />
>>>
>>>And I'd like to manipulate it a bit, ie, change the "." to "_" (so it
>>>can be used for a cvs tag). So I'd like to have a property with the
>>>value "v1_0_2".
>>>
>>>Is there a way to do that with the core tasks? I realize it would be
>>>easy to do it with the <script> task, but I would prefer to avoid the
>>>need to depend on another jar for our project... Any idea?
>>
>>There is no way to do this without some scripting, that I know of.
>>However, an alternative is to keep the pieces of that property
>>separate:
>>
>>        <property name="part1" value="1"/>
>>        <property name="part2" value="0"/>
>>        <property name="part3" value="2"/>
>>
>>        <property name="version" value="v${part1}.${part2}.${part3}"/>
>>
>>        <property name="version_with_underscores"
>>value="v${part1}_${part2}_${part3}"/>
>>
>>Erik

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


Mime
View raw message