How to add bzr to Android manifest: versionName

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

I would like to automatically add the id of the bazaar version of the project to the value of Android: versionName in my manifest file.

I use ant to build, and I have a Jenkin bazaar plugin that passes revid to an ant build script, but I have no idea how to do this.

+4
source share
1 answer

I finally found a solution here .

It was for SVN, but it was easy enough to configure for Bazaar ...

This is what my task looks 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 revision number of Bazaar). You can customize the regular expression to your needs.

+4
source

Source: https://habr.com/ru/post/1380426/


All Articles