如何将bzr revid放入清单的Android:versionName中?

4
我在Linux Ubuntu服务器上使用Jenkins构建我的Android应用程序,并使用Bazaar作为SCM。
我想自动将项目的Bazaar修订ID附加到manifest文件中Android:versionName的值中。
我使用ant进行构建,我有Jenkins的Bazaar插件,可以将revid传递给ant构建脚本,但我不知道如何操作。

你的问题不太清楚。是关于如何将bzr revid传递给ant构建脚本,还是关于如何在ant构建脚本中使用revid来修改你的清单文件? - dOxxx
抱歉,我错过了你的评论,我在如何修改清单文件上遇到了困难。经过更多的(远远超过)搜索,我终于找到了一个解决方案,请见下文... - jmc34
1个回答

4

我终于在这里找到了一个解决方案

它是针对SVN的,但很容易调整为适用于Bazaar...

以下是我的任务外观。

<property environment="env"/>
<target name="bzr-revision">
    <echo>Modifying Android manifest with revision: ${env.BZR_REVISION}</echo>
    <!-- Write the revision number into
            the Manifest as the last segment of the VersionName property -->
    <replaceregexp file="AndroidManifest.xml" match='android:versionName="([^".]+\.[^".]+\.[^".]+)(\.[^"]*)?"' replace='android:versionName="\1.r${env.BZR_REVISION}"'/>
</target>

如果versionName为1.5.2,则会将其替换为1.5.2.r123(其中123是Bazaar修订号)。您可以根据需要调整正则表达式。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接