Eliminating Friction, Part 2: The Build Script


Having talked about scripting your way to success, build scripts deserve a special mention.

At Blade we have components of our product in four different solutions but those solutions have a lot of shared code between them.  When we make changes to that shared code we really need to build each of the four solutions to verify that we didn’t break anything.  Unfortunately it was up to each developer to load and manually build each solution, which as a practical matter didn’t often happen.  I also started adding unit tests to one of the solutions which added another manual step.  Clearly we needed an automated build script that would do all of those tasks for us and report with a simple pass/fail result.

I’ve used a few different build frameworks in the past to automate builds.  I’ve used straight MSBuild, which is a very powerful tool that’s seriously hampered by its reliance on XML.  The fact of the matter is that XML is a terrible scripting language.  It’s really, really painful to write and debug anything even moderately complex.  Build scripts can have very complex logic and should be treated as first-class development citizens.  I don’t recommend writing MSBuild scripts directly if you can avoid it.

psake is a pretty nice Powershell-based build automation tool that I’ve used on a couple of projects.  It works as advertised and I didn’t have any particular issues with it, though I haven’t really fallen in love with Powershell as a programming language.  I love the object-based command line system but don’t really care for the language syntax.  psake is a good choice if you want to avoid MSBuild but your team is uncomfortable with non-Microsoft environments.

For creating the build script at Blade I chose to try out Ruby, Rake, and Albacore and I’m very pleased with my experience so far.  It was ridiculously easy to set up a script that builds all four solutions, runs our unit tests, and reports any errors.  It was even easier to add variations for doing a single step (clean, build, or test) for all solutions or performing all steps for a single solution.  The Ruby language is succinct and expressive, the Rake build system is powerful, and Albacore streamlines some common Windows/.Net operations.

I won’t spend time writing a step-by-step guide to Ruby/Rake/Albacore as that’s already been done very well by others.  The point of this blog post is simply to encourage you to write a build script for your project if you don’t already have one.  There are tools available that make it easy – embarrassingly easy.  Just do it.  There’s absolutely no excuse not to.

One thought on “Eliminating Friction, Part 2: The Build Script”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: