You use the compc Flex Ant task to compile component SWC files. This task supports most compc command-line compiler options, including aliases. For more information on using the compc command-line compiler, see Using compc, the component compiler.
The only required attribute for the compc task is the output attribute, which specifies the name of the SWC file that the compc task creates.
The include-classes attribute takes a space-delimited list of class names. For example:
<compc include-classes="custom.MyPanel custom.MyButton" ... >
...
</compc>
When using the include-resource-bundles attribute, you should not specify them as a comma or space-delimited list in a single entry. Instead, add a separate nested tag for each resource bundle that you want to include, as the following example shows:
<compc output="${swf.output}/compc_rb.swc" locale="en_US">
<include-resource-bundles bundle="ErrorLog"/>
<include-resource-bundles bundle="LabelResource"/>
<sp path-element="locale/{locale}" />
</compc>
The following compc command-line compiler options are not supported by the compc task:
The following example compc task builds a new SWC file that contains two custom components and other assets. The components are added to the SWC file by using the include-classes attribute. The source files for the components are in a subdirectory called components. The other assets, including four images and a CSS file, are added to the SWC file by using the include-file element. This example defines two targets: main and clean. The main target compiles the MyComps.swc file. The clean target deletes the output of the main target.
<?xml version="1.0" encoding="utf-8"?>
<project name="My Component Builder" basedir=".">
<taskdef resource="flexTasks.tasks" classpath="${basedir}/flexTasks/lib/flexTasks.jar" />
<property name="FLEX_HOME" value="C:/flex/sdk"/>
<property name="DEPLOY_DIR" value="c:/jrun4/servers/default/default-war"/>
<property name="COMPONENT_ROOT" value="components"/>
<target name="main">
<compc
output="${DEPLOY_DIR}/MyComps.swc"
include-classes="custom.MyButton custom.MyLabel">
<source-path path-element="${basedir}/components"/>
<include-file name="f1-1.jpg" path="assets/images/f1-1.jpg"/>
<include-file name="f1-2.jpg" path="assets/images/f1-2.jpg"/>
<include-file name="f1-3.jpg" path="assets/images/f1-3.jpg"/>
<include-file name="f1-4.jpg" path="assets/images/f1-4.jpg"/>
<include-file name="main.css" path="assets/css/main.css"/>
</compc>
</target>
<target name="clean">
<delete>
<fileset dir="${DEPLOY_DIR}" includes="MyComps.swc"/>
</delete>
</target>
</project>