使用Ant编译出flex的swc文件
IDE构建swc:http://www.sadtojoy.com/aspx/Detail.aspx?id=3670
compc构建swc:http://blog.csdn.net/joeyshi/archive/2009/05/01/4141585.aspx
今天新构建了一个FlexLibraryproject项目,但是发现其自动编译的出的swc文件名是无法定义的,自动产生一个跟projectname相同的swc文件。这个很不爽,于是决定采用ant来自己编译。
首先可以参考http://blog.jodybrewster.net/2008/04/09/installing-ant-in-flex-builder-3/这篇文档,在FlexBuilder中安装antenviroment支持。
构建build.xml和build.properties文件,如下:
###### Flex Properties ############################## # change this path to your flex sdk directory # Use "/" in your directory path e.g. C:/FlexSDK/3.0.0 FLEX_HOME=D:/IDE/Adobe/Flex Builder 3/sdks/3.0.0 ###### Project Properties ########################### src-dir=${basedir}/src swc-file=sample.swc
<project name="Ant build SWC sample" basedir="." default="build SWC"> <!-- load user configuration properties --> <property file="build.properties" /> <taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" /> <target name="prepareEnv"> <mkdir dir="${basedir}/swc"/> </target> <target name="clear" depends="prepareEnv"> <delete file="${basedir}/swc/${swc-file}"/> </target> <target name="build SWC" depends="clear"> <fileset dir="${src-dir}" id="src.files"> <include name="**/**"/> </fileset> <echo message="${src.files}" /> <pathconvert property="evaFramework_classes" pathsep=" " dirsep="." refid="src.files" > <map from="\" to="/"/> <map from="${src-dir}/" to=""/> <mapper> <chainedmapper> <globmapper from="*.as" to="*"/> </chainedmapper> </mapper> </pathconvert> <echo message="${evaFramework_classes}"/> <compc output="${basedir}/swc/${swc-file}" include-classes="${evaFramework_classes}"> <source-path path-element="${src-dir}" /> </compc> </target> </project>
运行ant编辑既可。
From
http://blog.jodybrewster.net/2011/01/20/flashanttasks-update/
http://blog.jodybrewster.net/2009/04/26/flashanttasks-compiling-flash-movies-with-ant/
http://blog.jodybrewster.net/
http://blog.csdn.net/james999/archive/2009/01/05/3715018.aspx
http://blog.csdn.net/james999/archive/2009/03/05/3961239.aspx
http://www.adobe.com/devnet/flex/articles/flex_ant_pt1.html