My workflow with ANT and FDT
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).
- Debug in Firefox
- Create deployable swf
- Deploy to FTP server
- 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. I created a zip file with all the files used in the video;

THE COMMENTS:
What Bruno Fonzi said 1 hour later:
Jankees,
Great post, it is great you are sharing your learnings with the rest of the world.
Another good post uncovering the Power of ANT & FDT is from Alan Klement:
http://blog.alanklement.com/2009/08/10/fdt-and-an…
What jankees said 2 hours later:
Hi Bruno,
Thanks for your message, I read the post by Alan it is pretty good. Are you working on FDT at Powerflasher?
Best,
What Bruno Fonzi said 3 hours later:
@Jankees Yes I am ! I have just recently joined the Powerflasher FDT team in San Francisco. I used to work for Adobe before.
What Erik said 23 hours later:
Nice post dude… spreading the ANT word!
What Karl Macklin said 27 days later:
I had some trouble with only having either one of the constants being true/false.
I had to clean FCSH before each compile to have it make any difference, it seems.
What Joe said 40 days later:
Thanks you, that's very cool informations and shared files !
What Joe said 49 days later:
Hello, I just try the Launch in Firefox (reload) command. I copy the command in my build.xml file
I put your fresno file in ./build/tools/
But when I launch it I have the error :
Launch in Firefox (reload):
[exec] FAIL: EOF on connection
[exec] Result: 1
Did we change something in the fresno file ?
Any idea ?
Thanks !
What Joe said 49 days later:
The XML file was not shown in my previous comment:
What Jankees said 49 days later:
There seems to be a problem with your fresno file, you could try to download it at their website
What Matt Przybylski said 167 days later:
Jankees,
Is there a way to use Google Chrome instead of Firefox for previewing in the browser? I've got the Firefox launch working but I can't figure out how to make it use Chrome instead. Any insight you can provide on this would be great. Thanks.
Matt
What Jankees said 167 days later:
Hi I know there is a port of http://xrefresh.binaryage.com/ for chrome here: http://gist.github.com/342682 But I haven't tried it yet. Please let me know if this works for you.
What Matt Przybylski said 168 days later:
While that is pretty awesome, it's not exactly what I was looking for. I guess let me rephrase my question. I am of the type that doesn't want to reload the browser, i normally test, close browser, re-write code, test again (opens up browser again), close browser, rinse and repeat. I just want to know how to define the path to my browser as Chrome instead of Firefox. I've managed to at least figure out this much:
meaning that spaces can be accepted as long as i put the ' in there as well around the path, but the script is looking in my project directory for it rather than in my applications folder, as in:
[exec] The file /Users/mprzybylski/Work/Personal/Matt Tests/source/Tests/source/Applications/Google Chrome.app does not exist.
How can I tell it to not look in the source folder which is my basedir rather look in my Applications folder on my hard drive?
What Matt Przybylski said 168 days later:
Ah, I figured it out. Had to change my property to this:
Previously I was using location instead of value :