Automate Your App PackagingAuthor: Tom Philip | Filed under: Best Practice
If you’re developing apps for a client in an agile fashion, you’ll be showing the app to the client many times as you introduce new features in order to get feedback as soon as possible. Ensuring you have a nice tight feedback loop and the right app gets built. Any kind of friction will only slow you down and perhaps even avoid deploying as often. An automated solutions works in seconds, is consistent and avoids mistakes.
To be effective at getting rapid feedback you will need 2 things:
- A custom repository to deploy your apps to, for clients to use your app and give feedback.
- A build script to automate packaging and deploying the app to your custom repository. That’s what this post is about.
I did have an automated package and deploy until API keys were introduced, so at the moment this only packages. I’m hoping to redevelop that part, if it’s possible, so I can deploy in seconds too (joy).
The Build Script
The build script packages your app into a zip file, ready for publishing to a custom repository and the official Boxee library. Your free to download the build script and use it in any type of Boxee app development you like. It’s good to go as it is without and configuration (as long as you adhere to some conventions, although it’s easy to change if you like). It uses NAnt, so Windows only I’m afraid. I’m currently transitioning to a Mac, follow greatboxee on twitter or subscribe to this blog to hear when that’s out.
- Packages the app into a zip file, in the right structure, ready for deployment
- Strips out unwanted files (.svn, thumbs.db, Eclipse projects files etc)
- No need to remember to remove the test-app tag
- Version management automatically increments the version of your app, embeds the version into your descriptor file and appends to packaged zip
- Keeps an audit trail of packaged apps, in case you need to go back to a deployed version
- Easily identify the version of the app your coding, the version in the custom repository and the version in the official Boxee library
Getting it Working
Download the build script (GreatBoxee.Builds\package.build) from the Great Boxee GitHub repo and put in a folder inside your app in a folder called ‘Build’. There’s also an example app there with it working.
Create 3 descriptor files in your app root, one for each location the app will exist or be deployed to. They must have these names (conventions!).
- descriptor.xml – the version of the app that your developing in your current apps folder on your dev machine. This will have the test-app tag in it. eg App Id – greatboxee.myvids
- descriptor.beta.xml – the version of the app that will be deployed to your custom repository eg App Id – greatboxee-beta.myvids
- descriptor.prod.xml – the version of the app that will be deployed to the official Boxee repository eg App Id – myvids
You can also give the app different names or logos so you can distinguish between them, when they are listed in Boxee App Library.
Then navigate to the Build folder in a command window and execute nant package. I use a little batch file to run which is in the example app on GitHub too. This runs the packaging task in the build script and only takes a few seconds. This creates 2 zipped up apps, ready for deployment, in your build location (see build.dir property, the default will create it in your ‘Build’ folder). One is for the custom repository and one for the official Boxee library. You get 2, so when your client says “That’s fantastic, I’m happy with that make it live” you can then deploy exactly the same app you have just shown them in your custom repository. No room for mistakes in going to package the app as it stands on you dev box (or source control).
This packaging script is just a part of the puzzle that is continuous integration.With a build server you can automate the entire process (test, package, tag, deploy). Triggered by checkin into your source control or manually.