ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <dona...@apache.org>
Subject Re: same old question(slightly long)
Date Wed, 02 May 2001 00:18:18 GMT

>I have a manifest file 
>which has in it the line say, 
>
>Package-Version:2.1 
>
>I use this manifest file when I build my jar files. 
>
>Now if its a nightly build , I need the file to say: 
>
>Package-Version:NIGHTLY 
>
>But if its a release, I need it to say Package-Version:2.2 (next release
2.1 + 1)  
>
>I could accomplish this by Propertyfile but it replaces the ":" with "=" 
>
>2nd option: replace. But this would mean i search for  2.1 nd replace with
"nightly" (hardcoded)  
>and then if there was to be a release ,  i now search for and replace  2.2
with "nightly" 
>also i have lots of projects being built with diff versions.  So many ant
files  will have to be maintained. 
>SO i thought of having something like have Package-Version:which in all
manifest files  and then ant replaces which to Nightly
>
>But this doesnt work since I lose my version information if i write
Package-Version:which in all manifest files. 
>
>I dont want to do a echo cause i will have a lot of code hardcoded in ANT
xml.  
>
>Any way out ??? 

how about

manifest.mf:
Package-Version: @@VERSION@@

build.xml:
...
<copy file="manifest.mf" tofile="newmanifest.mf" />
<replace file="newmanifest.mf" token="@@VERSION@@" value="${version}"/>
...

Then somewhere you set the version property depending on what you want. ie

<property name="version" value="NIGHTLY" />
or
<property name="version" value="2.1" />

>p.s. was I clear? 

If I answered your question then yes - otherwise no ;)
Cheers,

Pete

*-----------------------------------------------------*
| "Faced with the choice between changing one's mind, |
| and proving that there is no need to do so - almost |
| everyone gets busy on the proof."                   |
|              - John Kenneth Galbraith               |
*-----------------------------------------------------*


Mime
View raw message