当前位置: 代码迷 >> Web前端 >> 运用Ant 生成as文档
  详细解决方案

运用Ant 生成as文档

热度:136   发布时间:2012-10-31 14:37:32.0
使用Ant 生成as文档
Ant build.xml文件:
<?xml version="1.0" encoding="utf-8"?> 
	<!-- 默认执行"build"任务 -->
	<project name="ASDoc Builder" basedir="." default="build"> 
	    <property name="FLEX_HOME" value="D:/Program Files/Adobe/Adobe Flash Builder 4.5/sdks/4.5.1"/> 
	    <property name="OUTPUT_DIR" value="D:/aaaaa"/> 
	    <property name="MAIN_PATH" value="D:/SvnProject/as_proj_nightly_builder/libraries"/> 
	    <property name="LIB_PATH" value="D:/SvnProject/as_proj_nightly_builder/projects/yid-chart/lib"/> 
	    <taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />
	    <!-- 先执行清理原文档文件夹;然后重新生成文档 -->
	    <target name="build">
	        <antcall target="clean"/>
	        <antcall target="doc"/>
	    </target>
	    <target name="doc"> 
	        <asdoc output="${DOC_DIR}" lenient="true" failonerror="true" main-title="${ant.project.name} API Documentation" window-title="${ant.project.name} API Documentation">
	            <!-- 相关类、第三方类库的文件夹路径 -->
	            <compiler.source-path 
	                path-element="${MAIN_PATH}/ccbu-trunk"/>
	            <compiler.source-path 
	                path-element="${MAIN_PATH}/vendor"/> 
	            <!-- 需要文档化的类,需要完整的包路径+类名;默认会将有依赖的类放入生成文档中。-->
	            <doc-classes class="cn.product.chart.BarChart"/> 
	            <doc-classes class="cn.product.chart.HBarChart"/> 
	            <doc-classes class="cn.product.chart.LineChart"/> 
	            <doc-classes class="cn.product.chart.PieChart"/>  
	            <!-- 或者采用这种写法,需要编入文档的完整的类文件名
	            <doc-sources path-element="${MAIN_PATH}/ccbu-trunk/cn/product/chart/BarChart.as"/>
	            <doc-sources path-element="${MAIN_PATH}/ccbu-trunk/cn/product/chart/HBarChart.as"/>
	            <doc-sources path-element="${MAIN_PATH}/ccbu-trunk/cn/product/chart/LineChart.as"/>
	            <doc-sources path-element="${MAIN_PATH}/ccbu-trunk/cn/product/chart/PieChart.as"/>
	            -->
	            <!-- 相关的swc文件夹路径 -->
	            <library-path dir="${LIB_PATH}" includes="*" append="true"/>
	        </asdoc> 
	    </target> 
	    <target name="clean"> 
	        <delete includeEmptyDirs="true"> 
	            <fileset dir="${OUTPUT_DIR}" includes="**/*"/> 
	        </delete> 
	    </target> 
	</project>


## 参考资料
asdoc工具文档:http://help.adobe.com/en_US/flex/using/WSd0ded3821e0d52fe1e63e3d11c2f44bc36-7ffa.html
使用Ant生成as文档:http://help.adobe.com/en_US/flex/using/WSda78ed3a750d6b8f4ce729f5121efe6ca1b-8000.html
Flex Ant自动构建:http://www.cnblogs.com/skynet/archive/2012/03/29/2423720.html
了解Flex SDK系列教程(1.Ant和FlexTask):http://www.riameeting.com/node/1009
asdoc注释标签:http://www.cnblogs.com/sevenyuan/archive/2010/06/01/1748939.html
Ant工具中的常用的核心任务:http://www.diybl.com/course/3_program/java/javajs/20100719/462327.html
Flex 4 SDK的ASDoc工具:http://swfever.com/?p=970
  相关解决方案