如何在Ant'UliveRegExp'任务中执行数学函数?

ror*_*ryf 9 regex ant

我需要从Ant构建脚本中增加源文件中的数字.我可以使用该ReplaceRegExp任务来查找我想要增加的数字,但是如何在replace属性中增加该数字呢?

这是我到目前为止所得到的:

<replaceregexp file="${basedir}/src/path/to/MyFile.java"
    match="MY_PROPERTY = ([0-9]{1,});"
    replace="MY_PROPERTY = \1;"/>
Run Code Online (Sandbox Code Playgroud)

在replace属性中,我该怎么做

replace="MY_PROPERTY = (\1 + 1);"
Run Code Online (Sandbox Code Playgroud)

我无法使用该buildnumber任务将值存储在文件中,因为我已经在同一个构建目标中使用它.是否有另一个蚂蚁任务可以让我增加一个属性?

Yuv*_*l F 4

你可以使用类似的东西:

<propertyfile file="${version-file}"> <entry key="revision" type="string" operation="=" value="${revision}" /> <entry key="build" type="int" operation="+" value="1" />

所以ant的任务是propertyfile。