I need to increment a number in a source file from an ant build script. I can use the ReplaceRegExp
task to find the number I want to increment, but how do I then increment that number within the replace
attribute?
Heres what I've got so far:
<replaceregexp file="${basedir}/src/path/to/MyFile.java"
match="MY_PROPERTY = ([0-9]{1,});"
replace="MY_PROPERTY = \1;"/>
In the replace attribute, how would I do
replace="MY_PROPERTY = (\1 + 1);"
I can't use the buildnumber
task to store the value in a file since I'm already using that within the same build target. Is there another ant task that will allow me to increment a property?