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

发布于 2024-12-14 07:22:55 字数 207 浏览 3 评论 0原文

我在 Linux Ubuntu 服务器上使用 Jenkins 构建 Android 应用程序,并使用 Bazaar 作为 SCM。

我想自动将项目的集市修订 ID 添加到清单文件中的 Android:versionName 值中。

我使用 ant 来构建,并且有 Jenkin 的 bazaar 插件,可以将 revid 传递给 ant 构建脚本,但我不知道该怎么做。

I build my Android apps with Jenkins on a Linux Ubuntu server and uses Bazaar as SCM.

I'd like to automatically append the bazaar revision id of the project to the value of Android:versionName in my manifest file.

I use ant to build and I have the Jenkin's bazaar plugin that passes the revid to the ant build script, but I have no idea how to do that.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

肩上的翅膀 2024-12-21 07:22:56

我终于在此处找到了解决方案。

它是针对 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 修订号)。您可以根据需要调整正则表达式。

I finally found a solution here.

It was for SVN, but it has been easy enough to tune for Bazaar...

Here is how my task look like.

<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>

If versionName is 1.5.2, il will replace it with 1.5.2.r123 (where 123 is the Bazaar revision number). You can tune the regex to your needs.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文