Working with command lines really sucks, so prefer automating any of those boring tasks by using any kind of script. Back when I was running Windows XP on a PC, I used batch files to do some of those tasks, but since I’m using a mac I can’t run batch files anymore. Furthermore, it was time to switch to something more professional than those oldschool batch files. I’ve been using ANT for quite some time now and I’ve created a really simple ANT script to create ASDoc documentation.
What is ANT?
You can do about anyting with ANT by creating an ANT Script (xml) that tells ANT what to do. ANT can do anyting with files (copy, paste, move, duplicate, extract zip files, etc) and with ANT you can execute applications which you would normally use through the command line (or Terminal on a Mac).
ASDoc ANT Script
Ok, back to the ASDoc ant script. Click “File -> New -> File” and create a file called asdocbuild.xml. Paste this code into the xml file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <?xml version="1.0" encoding="utf-8"?> <project name="ASDoc build" default="createdocs"> <property file="asdoc.properties"/> <target name="createdocs"> <exec executable="${asdoc.dir}/asdoc" failonerror="true"> <arg line="-doc-sources 'src/'"/> <arg line="-main-title 'Undercore, a Flash and Flex development framework'"/> <arg line="-window-title 'Undercore'"/> <arg line="-output 'docs'"/> </exec> </target> </project> |
Some explanation of what happens in the xml file above: Obviously it’s an xml file (line 1). The project tag defines the projectname of the build and the default target to execute, in this case the target on line 5 called createdocs. This node contains an exec node which tells ANT to execute a command line statement with the arguments contained in the exec tag. This is the actual asdoc execution.
Before it executes any of the targets, it loads a properties file. You can define variables in a properties file, such as ${asdoc.dir} which is defined as asdoc.dir in the property file. This is the properties file content:
asdoc.dir=/Applications/Adobe Flex Builder 3 Plug-in/sdks/3.2.0/bin
Just create a file named asdoc.properties and paste the code above in it. Your project should look something like this:

Now right-click the asdocbuild.xml file and choose Run As -> Ant Build. Your documentation’s being created.