Jared's Weblog

Main Page - Blog - Books - Links - Resources - About - Contact Me


This page is based on the build scripting tools appendix (Appendix C) in Ship It!.

Build Scripting Tools

Scripting languages take a lot of the work out of building your product. With features specific to product compilation and assembly, these languages let you capture every step of your build process so that itís repeatable and easy to automate.

What’s Available:

OS Scripting Languages (e.g. Shell, Batch Files)

These are available on your existing operating system, but tend to be very generic and lack many of the common functions youíll need. Use them, and you risk reinventing the wheel.

make-- make comes on all modern Unix and Unix-like systems; you can get a free version for Windows at this URL. make is the grandaddy of all the build scripts, and has been around for decades. Tools like make move you forward a little, but still force you to write your own code for many common functions. They do begin to introduce the idea of a cross platform script.

Automake-- Automake is a Perl utility that helps you create make files.

Language-Specific Tools

There are a number of tools that have been written for specific languages. For instance, Ant was created for the Java language, and it can create JAR files and WAR files, generate JavaDocs, and so on. Using tools like Ant helps insulate you from the details of creating WAR files while at the same time providing a robust and repeatable way to build your WAR files.

Ant-- Ant is the standard build scripting language for Java work. With tons of built-in functionality, itís flexible enough to script much more than just Java.

NAnt-- NAnt is the .Net version of Ant.

Groovy-- While definitely a general scripting language, Groovy also lets you access all the functionality of Ant from within your Java code. Its goal is to give you all the convenience of Ant targets with the power of a real programming language as well. Groovy is still maturing, so caveat emptor.

Rake-- Rake is a build tool for Ruby with similar capabilities to make, but it uses pure Ruby for its scripting language. It also support such things as rules patterns and tasks with prerequisites.

General Scripting Languages

Strictly speaking, scripting languages were not intended for build systems, but since many people already know one and then get asked to create a build system, often general-purpose scripting languages gets pressed into action. To be blunt, weíve never seen a good build system based on a general-purpose language. Weíre including this section for completeness, but we encourage you strongly to use a tool specifically designed for the job.

Ruby-- Ruby is a scripted language thatís getting more popular every day. It has many object-oriented features built in and can process text files like Perl. Itís easy to use, is very clean, and has an active user community.

Python-- Python is another interpreted language with many object-oriented features. People either love or hate Pythonís format, but itís hard to ignore the fervor that hard-core fans have for it.

Perl-- No discussion of scripting languages would be complete without mentioning Perl. Perl has been around for years, exists on every major platform, and has been used to do nearly everything a computer can do. Itís got an incredibly rich set of functionality for handling text files, and the web archives1 have Perl code available to do anything youíll ever need done. The syntax is obscure, but the utility is undeniable.

Build Systems

Maven-- Tools like Maven move you one step higher on the food chain. The main complaint with this category is that they encapsulate too much. Maven has very specific preferences about build locations and task names, but you can work around them. Most people seem to either love or hate this type of tool. Try it for yourself!

Maven2-- The next version of Maven, rewritten from the ground up. The build paradigm is simpler than in Maven 1, and performance has been greatly enhanced.

Key Concepts:

Syntax

The toolís language. make and its kind are pretty arcane, but most late-model scripts are based on XML.

Tasks

What the tool can actually accomplish. At a minimum you need compile and linking features, but tools like Ant do a lot more.

Script interpreter

The ďengineĒ that executes your script.

How to Choose:

Features

Comprehensive-Can you do everything you need without writing a lot of custom code?

Readable-Can anyone in your shop read the script and understand it?

Available on your platform-Is it ubiquitous?

Scalable-Is it fast enough? Can it handle the load needed in your shop? Thereís a big difference in being able to handle one or two projects and handling fifty.

Extensible- How hard is it going to be for you to add those extra functions you need?

Flexible Can you use the tool the way you want to, or will the tool force you to change the way you work?

Matches your programming style-Just because it works doesnít mean itís the best fit for you!

Easily accomplishes your build tasks-Can you learn it in thirty minutes, or will it take two weeks?

For More Information:

See Practice 3, Script Your Build,, on page 25 of Ship It!