How to build a one-click deployment in libGDX 1.0 (I)

posted in: Development | 0
LibGDX is a powerful tool used by many developers in game industry and by us in Crazy Belts. We hope you find this tutorial easy, and please don’t hesitate on asking anything you want in the comments.
To save time when generating a new release of your game, and distributing it between your publishers or testers, a one-click deployment in libGDX 1.0 is something really useful. Specially at the onset of the project. This stage may consume 15-30 minutes per platform in each deploy. When you notice that, you start thinking that you should have planned more cautiously. This post talks about this. Let’s start!
LibGDX Project Generator

You must have only one execution environment and this one must be set properly.

If our purpose is to create a cross-platform game (iOS/Android) then set your execution environment on your MAC computer.
Additionally, in case of iOS on this MAC you need:
– To be on the iOS Developer Program
– From the Member Center > Certificates, Identifiers & Profiles:
– Run the command ‘security find-identity -v -p codesigning’ in Terminal to list all available code signing certificates. If you don’t see your ‘iPhone Developer’ certificate in the output there’s something wrong with your certificates. If is a new MAC computer you need to add and download an iOS Certificates (Development) for our MAC computer.
– To create a new App ID for your new game.
– To create a new iOS Provisioning Profiles (Development) linked to App ID created.

– To download the iOS Provisioning Profiles (Development) created.

If our platform target is only Android, then set your execution environment on computer where you are more comfortable. If you choose Windows computer, you’ll need to install Cygwin (select curl and zip packages in the install wizard).

So an summary for the very impatient. Configure your environment variables correctly and in terminal:
 
[text] # 1. Increment minor iOS version (0.1.0 to 0.2.0)
# 2. Increment build iOS version (37 to 38)
# 3. Generate release ipa
# 4. Upload to testflight
server:~ user$ ./gradlew ios:incrementMinorVersion ios:createIPA iOS:testflightUpload
[/text]  
[text] # 1. Decrement m
# 1. Increment minor android version (0.1.0 to 0.2.0)
# 2. Increment build android version (37 to 38)
# 3. Generate release apk
# 4. Upload to testfairy
server:~ user$ ./gradlew android:incrementMinorVersion android:assembleRelease android:testfairyUpload
[/text]  
Now we are going to see what’s behind the scene.

Automatic version control system

Based on Gradle in Action

We create a version.properties file for each project folder where we want to have version control system. In each build.gradle:
– We define Version class
– We create a configuration task using Version class to read the current state of version.properties. This one is executed always at the beginning because is a configuration task.
– We create 3 action tasks to increase versions: major, minor and patch. A four “private” task autoincrease build version in each packaging.

Version class computes a version string combining `major.minor.path` but each project use this differently:
– In AndroidManifest.xml android file modifies versionName. We also modifies in this one versionCode with current date plus current build.
– In robovm.properties iOS modifies app.version.

Automatic uploading of your distributions

I don’t complicate this final task; I use the upload API offered by these solutions:

    – Testfligth Upload API

    – Testfairy Upload API

On each build.gradle project I use an Exec task to execute a cURL for sending files using this API’s with different parameters defined into gradle.properties file.

 

Leave a Reply

Your email address will not be published. Required fields are marked *