Related Pages

Articles::Beyond the Valley of Flash - Part 1
Articles::Beyond the Valley of Flash - Part 2
Articles::Using Ant with Flash

Latest in Blog

Missing files

Flex Conditional Compilation Tweak

Bringing Flash to the iPhone?

jEdit OS X startup issue.

Variiable Length Table Cells on the iPhone

More pages in Blog...

 

Automatically create a CD image with Ant


Using the powers of Ant and mkisofs, CD image creation is easy.
2008-05-16

When you're building an application its great to be able to automate as much of the process as possible. Partially because it saves you time, but also because its reproducible and consistent. Ant is my build tool of choice, mainly because its very mature and is language/platform agnostic.

So earlier this week I had a dilemma. I thought it would be enough to create a zip of the files for an application that needed to be burned to cd. Turns out that this caused some confusion for a couple reasons. First: All burning software is not equal. For some reason my autorun.inf was not working when others burned my zip. Second: there was no consistent naming of the disc. What I needed was to distribute a burnable disk image (an .iso file), not a zip.

I was already using Ant to create the various build targets. Could I get Ant to also build an iso image for me? Once I had installed a program called mkisofs, this was very straightforward:

<target name="createiso" depends="distribute">
    <exec dir="Work/Deploy" executable="mkisofs">
        <arg line="-o my_disc.iso"/>
        <arg line="-J"/>
        <arg line="-R"/>
        <arg line="-V My_Disc_Name"/>
        <arg line="dist"/>
    </exec>
</target>

And that's it! If you were to run this in a shell it would look like:

mkisofs -o my_disc.iso -J -R -V My_Disc_Name dist
This basically calls the mkisofs program, and creates a burnable image of your folder. The -R and -J options will keep the filenames consistent with what you see. The -V sets the name of the cd. The 'dist' is the name of the folder that I'm turning into an iso.

Because mkisofs isn't part of Ant or most systems you'll need to grab a copy for yourself.

  • Mac: Download Disk Imager. Right-click and choose 'Show Package Contents'. Inside Content/Resources you will find a mkisofs binary. :)
  • Win: This is available from Cygwin.
  • Linux: apt-get install mkisofs (if its not already installed)

I'm developing this app on a Mac, and when committing to the server this ant script is run on the server, rebuilding the iso every time i commit. Couldn't be easier!

 
 

©2004 Chris Hill. All Rights Reserved.Legal Crapola