如何将bzr revid放入manifest的Android:versionName中
作者:互联网
我在Linux Ubuntu服务器上使用Jenkins构建我的Android应用程序,并使用Bazaar作为SCM.
我想自动将项目的集市修订版ID附加到我的清单文件中的Android:versionName值.
我使用ant构建,我有Jenkin的bazaar插件,将revid传递给ant构建脚本,但我不知道如何做到这一点.
解决方法:
我终于找到了解决方案here.
它适用于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,则il将替换为1.5.2.r123(其中123是Bazaar修订号).您可以根据需要调整正则表达式.
标签:android,jenkins,bazaar 来源: https://codeday.me/bug/20190626/1293446.html