My Workflow With Ant And Fdt

11 December 2009

I am a big fan of things that speed up my workflow. One of the things that I have been using a lot lately is ANT. ANT is a scripting language you can use from within Eclipse (and FDT). ANT is quite powerful. You can use it to show input dialogs, manipulate files, create files, compile an application, FTP, SVN and much much more!

In my last three projects I have been using the same ANT file and I think it is pretty useful for other Flash developers too. That’s why I want to share it with you.

My ANT file has four targets (functions).

  1. Debug in Firefox
  2. Create deployable swf
  3. Deploy to FTP server
  4. Clean debug in Firefox

The most important target is the first one, that’s the target I use the most. It compiles the actionscript into a SWF and then gives Firefox focus. If you want to know how this works see epologee.com/blog. I know a lot of people use the external player in FDT, I switched to Firefox because it is much faster and as a bonus you can use SWFAdress and other HTML stuff. In my opinion it’s much better to test from within the browser because it it behaves a bit different then external player in some occasions.

The second target (Create deployable SWF) creates a SWF which is smaller that the debug version; this is because I excluded the ‘verbose stacktraces’ on a large project this somethings takes 200kb of a SWF file.

Another thing I added to my ANT task is a conditional compilation arguments to the compiler. With these arguments it’s really easy to create a code block which only works for deployment, or a piece of code which only works for testing.

The code to do this looks like this:

CONFIG::Debug
{
	// code for debugging
}
 
CONFIG::Release
{
	// code for release version
}

Another interesting thing I added was FTP, the only problem is it isn’t supported by FDT by default. You need to install a external script (pretty easy). All about FTP and ANT is on the blog of Erik van Nieuwburg.

Every time you compile using my script ANT creates a build.txt with some information about the build (deploment or development, time of compilation, filesize, user, etc) I store this information in Subversion to keep track of all the builds. I copy this to a folder on the webserver too. In another project I used a modified version of this code to update a Version.as file before compiling….

Video

I created a video of my workflow to show you how it works.

If you have any feedback or suggestions please let me know.