<?xml version="1.0" encoding="utf-8"?>
<project name="FLARManager" 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="-source-path '${srcpath.dir}'"/>

			<!--
			compile all source in ${asdocClassPath} and dependencies.
			<arg line="-doc-sources ${asdocClassPath}"/>
			-->

			<arg line="-external-library-path '${externalLib.dir}'" />
			<arg line="-external-library-path '${FLEX_HOME}/frameworks/libs/player/10/playerglobal.swc'" />
			<arg line="-window-title '${asdocsTitle}'"/>
			<arg line="-main-title '${asdocsTitle}'" />
			<arg line="-footer '${asdocsFooter}'" />
			<arg line="-output '${asdocOutput.dir}'"/>

			<!--
			couldn't get manifest file + exclude-dependencies to work...
			<arg line="-namespace http://www.transmote.com/flar ./manifest.xml" />
			<arg line="-doc-classes com.transmote.flar.FLARManagerClasses" />
			<arg line="-doc-namespaces http://www.transmote.com/flar"/>
			<arg line="-exclude-dependencies=true" />
			-->

			<!--
			explicitly specify list of classes to document, and exclude all dependencies.
			note that if other libs (FLARToolkit, PV3D) are released as SWCs, they will not be documented.
			-->
			<arg line="-doc-classes
				com.transmote.flar.FLARManager
				com.transmote.flar.camera.FLARCamera_Alternativa3D
				com.transmote.flar.camera.FLARCamera_Away3D
				com.transmote.flar.camera.FLARCamera_Away3DLite
				com.transmote.flar.camera.FLARCamera_Flash3D
				com.transmote.flar.camera.FLARCamera_PV3D
				com.transmote.flar.camera.FLARCamera_Sandy
				com.transmote.flar.marker.FlareMarker
				com.transmote.flar.marker.FLARMarker
				com.transmote.flar.marker.FLARMarkerEvent
				com.transmote.flar.marker.FLARToolkitMarker
				com.transmote.flar.pattern.FLARPattern
				com.transmote.flar.pattern.FLARPatternLoader
				com.transmote.flar.source.FLARCameraSource
				com.transmote.flar.source.FLARLoaderSource
				com.transmote.flar.source.FLARProxy
				com.transmote.flar.source.IFLARSource
				com.transmote.flar.tracker.FlareManager
				com.transmote.flar.tracker.FlareNFTManager
				com.transmote.flar.tracker.FLARToolkitManager
				com.transmote.flar.tracker.IFLARTrackerManager
				com.transmote.flar.utils.FLARManagerConfigLoader
				com.transmote.flar.utils.geom.AlternativaGeomUtils
				com.transmote.flar.utils.geom.AwayGeomUtils
				com.transmote.flar.utils.geom.FlareGeomUtils
				com.transmote.flar.utils.geom.FLARGeomUtils
				com.transmote.flar.utils.geom.FLARToolkitGeomUtils
				com.transmote.flar.utils.geom.PVGeomUtils
				com.transmote.flar.utils.geom.SandyGeomUtils
				com.transmote.flar.utils.smoother.FLARMatrixSmoother_Average
				com.transmote.flar.utils.smoother.FLARMatrixSmoother_AverageSimple
				com.transmote.flar.utils.smoother.IFLARMatrixSmoother
				com.transmote.flar.utils.threshold.DefaultThresholdAdapter
				com.transmote.flar.utils.threshold.DrunkHistogramThresholdAdapter
				com.transmote.flar.utils.threshold.DrunkWalkThresholdAdapter
				com.transmote.flar.utils.threshold.HistogramThresholdAdapter
				com.transmote.flar.utils.threshold.IntegralImageThresholdAdapter
				com.transmote.flar.utils.threshold.IThresholdAdapter
				"/>
			<arg line="-exclude-dependencies=true" />

		</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>