Building Flex applications with Ant
I guess this is my first work related post…
Anyway, I’m a huge fan of automating anything related to work and when I learned about Ant some 3 years ago I was immediately addicted. Being a ColdFusion guy there never was immediate need to learn about build scripts before - but it’s easy to see now how my life could have been much easier for long time before that.
Now when I’m working on my first real Flex project I obviously wanted to use Ant to control pretty much everything.
This sounds easy (and it is when you have the experience) but it took me a while to figure out all the small details. Today I ended up with this build file. Maybe it helps someone who is trying to do something similar.
It can do following
- compile and deploy Flex project in Windows and OS X
- generate documentation from ActionScript classes (asdoc)
- works with external libraries (Cairngorm.swc)
- use either default properties based on platform or custom properties
- additional deployment targets are easily added
I learned some oddities about Ant today:
- sub-targets (antcall) can’t set properties to calling target
- properties can’t be overwritten once set
- taskdef doesn’t seem to accept properties as a path to jar file
I’m sure there are quite a few good reasons for these design choices but it took me a while to find how to do everything I wanted.
