tags:

views:

868

answers:

2

I am tring to get the ASDoc Ant task to work:

<target name="asdoc" depends="compile">
 <mkdir dir="${dist_asdocs}"/>
 <asdoc 
 docSources="${srcdir}"
 output="${dist_asdocs}"
 executable="${FLEX_HOME}/bin/asdoc.exe" />
</target>

When I run it I get errors from ASDoc like "Error: Type was not found or was not a compile-time constant: XXX". When I run ASDoc manually I do: "asdoc -source-path src -doc-sources src". If I omit the -source-path value I get the same errors... so how am I supposed to get the Ant task to work?

+2  A: 

Well, I can't test it because it is implemented for Windows only (tries to execute asdoc.exe).

But I have written my own solution for the lack of an ant task for asdoc:

<exec executable="${FLEX_HOME}/bin/asdoc" dir="${basedir}">
    <arg value="-source-path"/>
    <arg path="${basedir}/src"/>

    <arg value="-doc-sources"/>
    <arg path="${basedir}/src"/>

    <arg value="-output"/>
    <arg path="${DOC_DIR}"/>

    <arg value="-main-title"/>
    <arg path="${ant.project.name} Documentation"/>

    <arg line="-library-path+=${basedir}/libs"/>
</exec>

Of course, you have to change the executable to asdoc.exe if you are on windows. I don't know if you also have to replace all / with \ or if ant does this for you. The last can be omitted if you don't use any .swcs which aren't already on the library-path. Or at least you have to change it to point to the right directory.

Edit: I have looked at the source code of the asdoc-task and it is essentially the same I do with my exec-task, it just only allows a small subset of command line arguments.

I also have tested my solution without the source-path argument and to my surprise it still worked. I did some further testing and this is what I found out:

When no source-path is specified, asdoc(.exe) assumes src as a default. Thus the asdoc-task usually works if you use that convention (e.g. Flex Builder does this), but fails if you don't.

So to use the asdoc-task you have to name your source directory src.

Simon Lehmann
A: 

I would suggest not using the asdoc ant task since I haven't developed it further since I first released it. As mentioned by Simon, it only supports a small subset of what is possible so you're most likely better off using the exec task.

Christophe Herreman