Saturday, October 11, 2008

IzPack & CruiseControl

I have CruiseControl configured to run IzPack after successfully compiling and testing my code. Thanks to ant integration this is very easy, see here. Izpack has a few other tricks, namely izpack2app and izpack2exe. These python scripts wrap your newly created installer.jar into either a Mac OS X application or a Window executable. Users of these platforms can now run them without the command-line. I've added these steps into CruiseControl so after each build my artifacts tab gives me 3 versions of my installer. The Mac OS application is actually a folder, so zip that up as CC won't have a folder as an artifact.

Edit your config.xml to include something like this:

<schedule interval="3600">
<ant antworkingdir="checkout/${}"
buildfile="build.xml" target="izpack" />
<exec workingdir="checkout/${}/dist"
<exec workingdir="checkout/${}/dist"
command="/usr/bin/tar" args="cvfz" />
<exec workingdir="checkout/${}/dist"
--file=installer.jar --output=installer.exe --no-upx />

The four steps are compile from your build.xml, giving your installer.jar. Create the Mac app, zip it, then create the Windows executable. You need 7Zip for the Windows part, Mac users get it via MacPorts: sudo port install p7zip. Don't forget to add the new files to your artifactspublisher.