开发者

How to use flex ant taks to automate building of flex app?

开发者 https://www.devze.com 2023-01-24 04:56 出处:网络
I know I can use a combination of ant & flex ant tasks for automating builds. However, I\'m unclear on how to compile all the mxml and actionscript files of an app. For example, does the build fil

I know I can use a combination of ant & flex ant tasks for automating builds. However, I'm unclear on how to compile all the mxml and actionscript files of an app. For example, does the build file below compile just the Main.xml file or all files in the app?

<project name="flex-app-builder">
 <property name="FLEX_HOME" value="C:/flex/sdk"/>
 <property name="APP_ROOT" value="apps"/>
 <property name="DEPLOY_DIR" value="C:/builds/flex/"/>

 <target name="main">
        <m开发者_如何学Cxmlc 
            file="${APP_ROOT}/Main.mxml" 
            output="${DEPLOY_DIR}/Main.swf"
            actionscript-file-encoding="UTF-8"
            keep-generated-actionscript="true"
            incremental="true"
        />
 </target> 
</project>


Your question shows you aren't too clear on how SWFs are built.

MXMLC builds SWFs for which the root file is either an Application or Module. It builds the SWF starting with that class, and linking in any used classes / libraries.

COMPC builds SWCs which just requires a list of files. It builds the SWC containing any classes which you specify to be built.

MXMLC is for building an application or module. (Only the files needed)

COMPC is for building a library. (All the files specified)

Your question shows MXMLC, which means that any classes referenced by Main.mxml (and any classes referenced by them, and so on) will be built into Main.swf to be used as an application (or module depending on the root tag in Main.mxml)


The compiler will build the mxml file and any linked/included .as/mxml files. If I recall correctly, it will not include files which are not linked to any other files (Like utility classes that are unused.)

If you are compiling a library with utility classes, you have to specify each file that you want to include. You can use the JavaScript plugin and ant-contrib libraries to help automate including all files recursively.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号