BlackBerry WebWorks Deploy Bash Scripts

Things you should know: I am inherently a lazy coder and forgetful to make things worse.

This means every time I needed to build and deploy an app for debug or submission I have to remember what the heck I needed to do again. On top of that I had to figure out what the last buildID I used was.

That often led to a lot of annoyance on my part. To solve this problem I used my very basic Bash scripting knowledge from my day job to automate building (debug, signing and signing with debug) and versioning.

I hadn’t thought these scripts would be of interest to anyone but me, but it seems as though they might be.

You can modify either of those to do Smartphone builds, I just haven’t updated mine yet with the automatic buildID when signing so I am not including it yet (might add that over the weekend.)

Once you have these scripts just run:

./ <appname> <buildtype>
./ <appname> <buildtype>

<appname> is the directory name where the app src is store
<buildtype> can be debug, sign or sign_debug

What the script does:

  • deletes the current build src
  • deletes current zip file
  • deletes current bar file (make a copy of the versions you want)
  • copies your new src to the build directory
  • strips .DS_store files (you can add other files/folders if you want)
  • creates a zip file
  • compiles with the proper SDK  and flags
  • deploys it to your specified device.

The finer points:
To make these work you need to have a fairly specific directory setup so they script properly does things for you (although you could customize this for yourself)

Source location (in my case: /Users/rory/Sites/<appname>/pb)
The important part here is ‘<appname>/pb’ you can tell the script the first bit, but all your app source needs to be structured like this or the script will fail.

Build location (in my case: /Users/rory/Sites/builds/<appname>/pb
Again the important part is ‘<appname>/pb’ you can tell it where to look for this but it will always be built in the same place. This directory needs to exist before the script is run.

That is it.

If you have any questions or feedback on these (or if you make improvements to them) I would love to hear about it. I am still learning the ropes of Bash scripting and would love to improve my skills.