Skip to content

Instantly share code, notes, and snippets.

@zrong
Created June 21, 2011 07:41
Show Gist options
  • Save zrong/1037412 to your computer and use it in GitHub Desktop.
Save zrong/1037412 to your computer and use it in GitHub Desktop.
使用Fcsh Server,并传递参数
# 设置FLEX SDK的路径
FLEX_HOME=D:/flex_sdks/4.5.0
# 设置源文件路径
# {$basedir} 就是本文件所在的目录
SRC_DIR =${basedir}/src
# libs目录,一般用来放swc文件
LIBS_DIR =${basedir}/libs
# 这个就是Flash Builder建立的bin-debug
DEPLOY_DIR = ${basedir}/bin
#自定义的几个类库源码
SRC_DUDU = e:/works/duduw_as3lib/src
#创建ASDoc的文件夹
DOC_DIR =${basedir}/doc
#DOC页面标题
DOC_TITLE ="KTScreen"
#DOC页脚
DOC_FOOTER = "www.youxi.com"
<project name="runtest" default="buildAndDebug">
<property file="build.properties" />
<!-- 取环境变量 -->
<property environment="env"/>
<!-- 设定一个默认的主文件,默认编译的是KTScreen.as。
若需要编译其他文件,可以调用ant -Dmain=Other -->
<property name="main" value="KTScreen" />
<!-- 设定输出的是否是调试版的swf需要开启调试 -->
<property name="debug" value="true" />
<!-- fcsh的编译地址 -->
<taskdef name="fcsh" classname="fcsh" classpath="${env.FCSHServer}/fcsh.jar" />
<taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />
<!-- 仅编译 -->
<target name="build" depends="init,compile" />
<!-- 编译并调试 -->
<target name="buildAndDebug" depends="init,compile,fdb" />
<!-- 创建ASDoc -->
<target name="doc">
<!-- 删除doc目录下的所有文件和子目录 -->
<delete includeEmptyDirs="true">
<fileset dir="${DOC_DIR}" includes="**/*" />
</delete>
<!--
<asdoc output="${DOC_DIR}" lenient="true" window-title="${DOC_TITLE}" main-title="${DOC_TITLE}" footer="${DOC_FOOTER}">
<doc-sources path-element="${SRC_DUDU}" />
</asdoc>-->
<exec executable="${FLEX_HOME}/bin/asdoc.exe" failonerror="true">
<arg line="-source-path=${SRC_DUDU}" />
<arg line="-source-path+=${SRC_DIR}" />
<arg line='-doc-sources=${SRC_DIR}' />
<arg line='-doc-sources+=${SRC_DUDU}' />
<arg line='-warn-level-not-supported=false'/>
<arg line='-main-title ${DOC_TITLE}' />
<arg line='-window-title ${DOC_TITLE}' />
<arg line='-footer ${DOC_FOOTER}' />
<arg line='-output ${DOC_DIR}' />
</exec>
</target>
<!-- 清理目录,复制没有嵌入的文件 -->
<target name="init">
<delete dir="${DEPLOY_DIR}/${main}.swf" />
<delete dir="${DEPLOY_DIR}/assets" />
<mkdir dir="${DEPLOY_DIR}/assets" />
<copy todir="${DEPLOY_DIR}/assets">
<fileset dir="${SRC_DIR}/assets" excludes="**/source/" />
</copy>
</target>
<!-- 编译 -->
<target name="compile">
<fcsh consoleencoding="UTF8">
<arg value="mxmlc ${SRC_DIR}/${main}.as"/>
<arg value="-output=${DEPLOY_DIR}/${main}.swf"/>
<!-- 这个参数其实可要可不要,因为编译的时候,默认会调用这个xml文件。-->
<!-- 2011-05-30:这个参数在使用sdk4.5的时候如果加入,会报swf-version参数错误,因此不要 -->
<!--<arg value="-load-config=${FLEX_HOME}/frameworks/flex-config.xml"/>-->
<arg value="-source-path+=${SRC_DUDU}" />
<arg value="-debug=${debug}" />
<arg value="-static-link-runtime-shared-libraries=true"/>
</fcsh>
</target>
<!-- 打开调试器进行调试 -->
<target name="fdb">
<exec executable="cmd" spawn="true" osfamily="windows">
<arg line="/K start fdb ${DEPLOY_DIR}/${main}.swf" />
</exec>
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment