Complexity, often not required!

Complexity, this topic is one I find myself coming back to on a daily basis. Good and functional code does not have to be the same thing as complex code! I found a lovely example of this today.

The problem is simple; Establish a way to link Team City builds to a deployed APK or IPA.

Searching the internet showed me that this is a prime example of over-engineering at its best, with build runners flying around here and plugins flying around there. Not required!! All you need is a simple understanding of how Cordova links its version to its generated .APK or .IPA and a way to interact with this.

The config.xml file has a section in it called widget. It contains an attribute called version.

One simple Team City build step that runs a powershell script which alters this value to your desired build number before the build process generates your install files and you have a version linked to a build for all the generated outputs you just produced.

[xml] $xml = Get-Content './config.xml'
 $xml.widget.version = $version
 $xml.Save($path);

Every build process will have a way to track build numbers. So just pass in your build version in the format Major.Minor.Build and you’re all set.

Simple.

Matthew Bird, Senior Developer

Leave a Reply