howto document your code with ASDoc
Documenting code wasn't as easy as I thought it would be, so I thought I'd share this with you and hopefully it will save someone some time. I use an Intel Mac and this is what you need to do to get your basic code documentation generated successfully:
1. In your terminal window go to your Flex SDK bin directory. Typically this is located under /Applications/Adobe Flex Builder 2/Flex SDK 2/bin
2. From "bin" directory run this command:
If you have any external Libraries in your Flex project you will need to include them in your command:
The key thing to remember for Mac users is that you need to run the command from Flex SDK bin directory and use -source-path option to tell the compiler where the source is located. -doc-sources will tell the compiler to generate output for the current directory and all subdirectories recursively. If you run this utility from any other directory other than "bin", you will get NoClassDefFoundError.
I haven't tried running ASDoc in Windows yet, but it should be very similar to running it on a Mac. And since ASDoc is a command line java utility, you would think it would run on Linux too. Well, for all you Linux users out there, this is the message I got from the compiler:
ASDoc is nicely documented here.
Cheers
Marko




although commandline isn't so hard,but it's great job to maitain a user interaction friendly
For me the problem is that asdoc can't find a file called "overviews.xml". I think it's a file generated by asdoc but that it gets the path wrong somewhere. It's looking for it in $FLEX_HOME/asdoc/xml which doesn't seem right, so I think it mixes it up when something expects a relative path and asdoc is started from the "wrong" directory (which seems like the only way to start it at all on the Mac). Have you encountered this?
No, I haven't encountered that problem. Did you run asdoc from the SDK Bin directory? You might also try and set $FLEX_HOME to point to "/Application/Adobe Flex Builder 2/ Flex SDK 2". To do this, you need to modify /etc/profile file. In the line under "export PATH", type this in:
export FLEX_HOME="/Applications/Adobe Flex Builder 2/Flex SDK 2"
I didn't have to do this, but it could work for you. Just out of curiosity, are you using Intel or PPC Mac? Let me know how you go.
@Albert
Good point. I guess you could run asdoc inside Flex Builder if you so wish. It will probably take you just as long to get it to work though. For those of you who want to try that option, you'll need to download Eclipse Java Development Tools plugin.
The only thing I haven't tested, which only occured to me now, is that I may have another version of Xalan (the XSLT processor that I assume runs the show) than asdoc has been tested with. All java tools seem to need their particular version of that package, so it might be that I have something installed which comes before Flex's xalan.jar in the classpath. I'll have to check that out.
I wrote a post on using ASDoc with ANT here:
http://www.rubenswieringa.com/blog/ant-and-asdoc