Automated build - Part 2 - The build job

This is part of my automated build series.  The aim is to automate a lot of the Cordova Background Service plugin process.

In this post, I'll be describing the build process for an individual version of the library.


During this post I will be demonstrating creating a Jenkins job to compile the library source into an Android library and save out the library for later use.

Tools used

I'm using the following tools for this post:


I have a SVN repository for my library project.  I use this repository during development.  I only post to my GitHub repository once development has been completed and tested.

Within the SVN repository, the source is stored in an Android Library project and can be compiled using Eclipse.


The Jenkins job will be parameterized to allow it to be called repeatedly for different versions.

As such the following variables will defined in the job:

The job

To create the job;

1) Create a new free-style software project in Jenkins, naming it "BackgroundServicePlugin Build"

2) Tick the "This build is parameterized" and provide the above 3 variables

3) Setup the SVN details within the Source Code Management (note that I do not set up any build triggers)

4) Add a Windows batch command to copy the relevant source code into my SOURCEPATH for later upload.  I also collapse the src & aidl folders into one.  The Ant build doesn't seem to cope with having the aidl files in a separate source folder.  I'm sure that there is a better method of doing this (in the Ant build), but this works.

5) Add a Windows Powershell script to update the project to use the correct Cordova Version (note, I store all of the Cordova-x.x.x.jar files within the Android Project and thus the SVN repository

The powershell script runs through the .classpath file of the Android project and links in the appropriate Cordova jar version.

6) Add an Execute Windows batch command to copy in the correct version of the

7) Add an Execute Windows batch command to prepare the project

8) Add an "Invoke Ant" to build the library

9) Finally, add an Execute Windows batch command to copy the resulting library to the BUILDOUTPUTPATH for later use

Wrap up

This Job now allows me to automate the build of an individual version of the Background Service Plugin library.

On it's own this job is rather boring.  It's power comes in later when combined with a controlling job which calls this job for each version that I want to build - but that comes later in part 5.

Labels: , , ,