Wednesday, July 23, 2008

Ant Property Trickery

I needed to change a property in my ant build task. (Backstory: Flex has poorly documented ant tasks, and they seem to require that you set FLEX_HOME as a property so that the tasks know where to find the Flex compiler. I have 2 sdk's that I want to use, one has a code coverage tool called FlexCover built in, but I can't pass in something like FLEX_COVERAGE_HOME, since the ant task silently uses FLEX_HOME anyways.) Ant properties cannot be changed once they are set.

My solution? Import the file which does not set my target property (FLEX_HOME), then in my tasks, set the target property depending on which one I need (FLEX_REGULAR_HOME or FLEX_COVERAGE_HOME).