Compile ASDocs with ANT

Continuing on with ANT – Flex compilation, this sample script below will help you output ASDocs for your projects deliverable.

Ant Script

<?xml version="1.0" encoding="utf-8"?>
<project name="ASDocsTest" default="compile" basedir=".">
 
	<!--
	import our build properties file
	-->
	<property file="./build.properties" />
 
 
	<!--
	Flex Ant Tasks used to perform compc and mxml compiling more info at http://labs.adobe.com/wiki/index.php/Flex_Ant_Tasks
	-->
	<taskdef resource="flexTasks.tasks" classpath="${flexTasks.jar}" />
 
 
	<!--
	Execute the ASDoc Compile
	-->
	<target name="compile" depends="generateASDocs" description="series of tasks to create docs"/>
 
 
	<!--
	DELETE the existing output folder and files and then re-generate the output folder
	-->
	<target name="cleanASDocsDir" description="DELETE the existing output folder and files and then re-generate the output folder">
		<delete dir="${asdocOutput.dir}" failOnError="true" includeEmptyDirs="true"/>
		<mkdir dir="${asdocOutput.dir}"/>
		<echo>doc directory cleaned</echo>
	</target>
 
 
	<!--
	Run the ASDoc executable and generate the ASDocs to the new output folder
	-->
	<target name="generateASDocs" depends="cleanASDocsDir, asDocsLog" description="Run the ASDoc executable and generate the ASDocs to the new output folder">
		<echo message="Generating ASDocs" />
		<exec executable="${asdoc.dir}" failonerror="true">
			<arg line="-doc-sources ${asdocClassPath}"/>
			<arg line="-source-path '${srcpath.dir}'"/>
			<arg line="-external-library-path '${externalLib.dir}'" />
			<arg line="-window-title '${asdocsTitle}'"/>
			<arg line="-main-title '${asdocsTitle}'" />
			<arg line="-footer '${asdocsFooter}'" />
			<arg line="-output '${asdocOutput.dir}'"/>
		</exec>
		<echo message="ASDocs created successfully" />
	</target>
 
 
	<!--
	LOG writes asdoc output to log file: log.txt
	-->
	<target name="asDocsLog">
		<echo message="start the asdoc generation log" />
		<record name="${asdocOutput.dir}/asdoc-log.txt" action="start" append="true"/>
	</target>
 
</project>

Build.properties

# Home directory for flex sdk 3, change this to build for Mac or PC using # as comment
FLEX_HOME 		=	sdks/flex-3.2-sdk
flexTasks.jar		=	tools/FlexTasks/lib/flexTasks.jar
srcpath.dir      	=	../src
externalLib.dir  	=	../libs
 
# ASDoc
asdoc.dir		=	sdks/flex-3.2-sdk/bin/asdoc
asdocOutput.dir  	=	../html_docs
asdocClassPath 		= 	${srcpath.dir}/com
asdocsTitle 		= 	ASDocs Test Library
asdocsFooter 		= 	CONFIDENTIAL. Copyright 2009 My Company



1 Comment

speak up

Add your comment below, or trackback from your own site.

Subscribe to these comments.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

*Required Fields