04-20-2011 07:48 PM
In the release note, a new tag for the blackberry-tablet.xml files discusses:
You can now use the buildId flag to create automatically incrementing version numbers for your application.
In my XML file, I did:
<buildId>100</buildId>
After a clean rempile and deployment to 1.0.1 simulator, the output shows:
actual_version: 1.1.5.100
If I do another clean recompile and re-deployment to the simulator, the actual_version does not change.
Does anyone know how to turn on the "automatically incrementing version numbers"?
My app-amxl file has versionNumber set to 1.1.5
04-20-2011 07:53 PM
Check out this post:
"You can change the build number by updating the buildId element in your blackberry-tablet.xml file. Alternatively, you can specify the build ID using the buildId command line option when you package your application using theblackberry-airpackager tool."
So it looks like you can do it from the command line. But I don't think the IDEs have support to do it automatically yet. But if someone knows a way to do it from the IDE, please let me know! I'm not planning on ditching compiling from the IDE just for this one command-line feature.
04-20-2011 07:58 PM
04-20-2011 08:35 PM
<?xml version="1.0" encoding="UTF-8"?> <!-- ====================================================================== 2010-03-30 21:45:55 incrementVersionNumber Increments version number in the file set as parameter in format set as parameter root ================================================== ==================== --> <project name="incrementVersionNumber" default="replaceVersionNumber"> <description> Increments version number in the file set as parameter in format set as parameter </description> <!-- - - - - - - - - - - - - - - - - - target: readVersion - - - - - - - - - - - - - - - - - --> <target name="readVersion"> <buildnumber file=".buildNumber"/> </target> <!-- ================================= target: replaceVersionNumber ================================= --> <target name="replaceVersionNumber" depends="readVersion" description="Increments version number in the file set as parameter in format set as parameter"> <echo>Version: ${build.number}</echo> <replaceregexp file="BlackBerry_App_Descriptor.xml" match=" Version="(.*)\.[^ ]+"" replace=" Version="\1.${build.number}"" byline="true"/> </target> <!-- ================================= target: replacePlayBookVersionNumber ================================= --> <target name="replacePlayBookVersionNumber" depends="readVersion" description="Increments version number in the file set as parameter in format set as parameter"> <echo>Version: ${build.number}</echo> <replaceregexp match="<versionNumber>([^<]+)\.[0-9]+< /versionNumber>" replace="<versionNumber>\1.${build.number}&l t;/versionNumber>" byline="true"> <fileset dir="." casesensitive="yes"> <include name="**/*-app.xml"/> </fileset> </replaceregexp> </target> </project>
This is my autoversion build file executed from Ant within FlashBuilder or Eclipse. It supports standard BlackBerry phone projects and PlayBook. Distributed at WTFPL license.
04-21-2011 08:40 AM - edited 04-21-2011 08:42 AM
I edited gluth's script to make it work in FlashBuilder. Below are the steps you can do to make it work too.
Note: don't add the build number to the *-app.xml file like gluth's script suggests doing - you won't be able to run the app if you do that. *-app.xml version number should be 3 numbers only (x.x.x) and not 4 (x.x.x.x)
<?xml version="1.0" encoding="UTF-8"?> <!-- ====================================================================== 2010-03-30 21:45:55 incrementVersionNumber Increments version number in the file set as parameter in format set as parameter root ================================================== ==================== --> <project name="incrementVersionNumber" default="incrementBuildNumber"> <description> Increments version number in the file set as parameter in format set as parameter </description> <!-- - - - - - - - - - - - - - - - - - target: readVersion - - - - - - - - - - - - - - - - - --> <target name="readVersion"> <buildnumber file=".buildNumber"/> </target> <!-- ================================= target: replaceVersionNumber ================================= --> <target name="replaceVersionNumber" description="Increments buildID number in blackberry-tablet.xml"> <echo>Version: ${build.number}</echo> <replaceregexp file="src/blackberry-tablet.xml" match="<buildId>(\D*)(\d+)(\D*)</buildId& gt;" replace="<buildId>\1${build.number}\3</bu ildId>" byline="true"/> </target> <!-- ================================= target: replaceSourceVersionNumber You can optionally use this target to update the version number in any other files, perhaps some file in your source code ================================= --> <target name="replaceSourceVersionNumber" description="Increments version number by incrementing build number in Main.as"> <echo>Version: ${build.number}</echo> <replaceregexp file="src/Main.as" match ="public static const VERSION:String = "(.+)\.[0-9]+";" replace="public static const VERSION:String = "\1.${build.number}";" byline="true" /> </target> <!-- ================================= target: incrementBuildNumber ================================= --> <target name="incrementBuildNumber" depends="readVersion" description="Increment build number across all related files"> <echo>Version: ${build.number}</echo> <antcall target="replaceVersionNumber"/> <antcall target="replaceSourceVersionNumber"/> </target> </project>
Also make sure that your blackberry-tablet.xml has the buildId tag in it
blackberry-tablet.xml:
<buildId>0</buildId>
Hope this helps others!
06-29-2011 08:35 AM
The option they probably added is in the blackberry-airpackager tool.
You can use that with -buildId filename.txt to read filename.txt and increment the number in it and put that as build number in the compiled file.
I simply use a file called build.nr and edit it with just a '1' in it. After using airpackager it auto-increments.. (which is pretty neat).
Regards,
Albert
09-17-2011 09:36 AM
Maybe you can explain how to set ant script for application ?
10-18-2012 09:39 AM
Hi,
Where you put this file build.xml to increment the number of build?
11-27-2012 12:34 AM - edited 11-27-2012 01:50 AM
Just to bump this up, the solution from FlashBuilder is really easy:
* Under Build Packaging < BlackBerry > Advanced, add: "-buildId build.txt"
* create build.txt in your /src folder, and populate it with a "1"
Your builds now autoincrement ![]()
EDIT - Well it seems a little hit or miss...sometimes it increments, sometimes it doesn't.
11-28-2012 03:08 AM
Where I can find "Advanced" to add "-buildId build.txt"???