Spotted the use of the <splash> task in the Hibernate build.xml today (via BPH). So of course I had to add it to Clover’s build file. You can see the results in the following screenshot. The <splash> task shows an image and a progress bar while the build is executing (the image can even be an animated .gif).

image

This is cool and fun, but “cool” is not the only reason why I added it to a production build file. In a previous life, I was working on a huge GUI client in Java (in pre-1.0 Swing!). We would release to system test quite often (twice a month?), and for each release we would come up with a humorous and on-topic splash screen for the application. It was a good release valve, and was good for morale.

I’m sure that my co-workers will now replace the build splash image from time to time. You’ll do a cvs -q update -dP and then an ant build and all of a sudden some humorous picture will pop up. Nothing like a good chuckle between coders.

To put this into your own build, you will need something like the following. But things to note about this Ant snipet:

  • We use an “-init” target that most “core” targets depend on, but you’ll get the idea.
  • We prefix any target with “-” if that target shouldn’t really be called from the command line (this idiom is documented in the Ant manual)
  • When doing a “production” build using the “prod.build” target, I turn the splash screen off.
<target name="-splash" unless="nosplash">
    <property name="splash.dir" location="."/>
    <splash imageurl="file:${splash.dir}/fun/buildsplash.gif" />
</target>

<target name="-nosplash">
    <property name="nosplash" value="foo"/>
</target>

<target name="-init" depends="-splash">
    <tstamp>
        <format property="build.date" pattern="MMMM dd yyyy"/>
    </tstamp>
    ...
</target>

<target name="prod.build" depends="-nosplash, -init, ..."/>

The <splash> task should be used to maximum effect in combination with the <sound> task.