In my build.xml file I am incrementing a build version number in a property file like so:
<target name="minor">
<propertyfile file="build_info.properties">
<entry key="build.minor.number" type="int" operation="+" value="1" pattern="00" />
<entry key="build.revision.number" type="int" value="0" pattern="00" />
</propertyfile>
</target>
I also have similar entries for the major and revision. (from http://stackoverflow.com/questions/1431315/build-numbers-major-minor-revision)
This works great. Now I would like to take this incremented build number and inject it into my source code:
//Main.as
public static const VERSION:String = "@(#)00.00.00)@";
By using:
<target name="documentVersion">
<replaceregexp file="${referer}" match="@\(#\).*@" replace="@(#)${build.major.number}.${build.minor.number}.${build.revision.number})@" />
</target>
Now this sorta works. It does indeed replace the version but with the outdated version number. So whenever I run the ANT script the build_info.properties is updated to the correct version but my source code file is using the pre updated value.
I have echoed to check that indeed I am incrementing the build number before I call the replace and I have noticed that echoing:
<echo>${build.minor.number}</echo>
//After updating it still shows old non updated value here but the new value in the property file.
So is there a way to retrieve the updated value in the property file so I can use it to inject into my source code?
Cheers