Revision: 41064
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 11, 2011 09:57 by meekgeek
Initial Code
<?xml version="1.0" encoding="utf-8"?>
<project name="Flex Application using Ant script"
default="compile">
<!-- load previously defined configuration properties file -->
<property file="build.properties"/>
<!-- points to our flexTasks.jar we copied to the libs folder to distribute with the project -->
<taskdef resource="flexTasks.tasks"
classpath="${LIBS_DIR}/flexTasks.jar"/>
<!-- This is what you have to include to be able to use the "foreach" ant task -->
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="${LIBS_DIR}/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
<!-- Build and output the Main swf-->
<target name="compile"
depends="init,compileApplication,compileModules,copyImages,copyRSLs">
</target>
<!-- delete and create the DEPLOY directory again -->
<target name="init">
<delete dir="${DEPLOY_DIR}"/>
<mkdir dir="${DEPLOY_DIR}"/>
</target>
<!-- Compile Application file -->
<target name="compileApplication">
<mxmlc file="${SRC_DIR}/${APPLICATION_FILE}.mxml"
output="${DEPLOY_DIR}/${APPLICATION_FILE}.swf"
actionscript-file-encoding="UTF-8"
keep-generated-actionscript="false"
debug="false
link-report="c:/link-report.xml">
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
<source-path path-element="${FLEX_HOME}/frameworks"/>
<library-path dir="${LIBS_DIR}"
append="true">
<include name="*.swc"/>
</library-path>
<!-- Using Runtime Shared Libraries -->
<runtime-shared-library-path path-element="${FLEX_FRAMEWORK}/framework.swc">
<url rsl-url="${FRAMEWORK_VERSION}.swz"/>
<url rsl-url="${FRAMEWORK_VERSION}.swf"/>
</runtime-shared-library-path>
</mxmlc>
</target>
<!-- Compile Modules -->
<target name="compileModules">
<pathconvert property="flex.modules"
pathsep=",">
<fileset dir="${MODULE_DIR}">
<include name="**/*.mxml"/>
</fileset>
<!-- Strips the module name out of the full path to the module -->
<compositemapper>
<mapper type="regexp"
from="^(.*)[\\|/](.*)(\.mxml)$$"
to="\2"/>
</compositemapper>
</pathconvert>
<echo>Modules that are found in current project are: ${flex.modules}</echo>
<!-- Calls the "compileModule" target and gives it the parameter "moduleName" -->
<foreach list="${flex.modules}"
delimiter=","
parallel="false"
param="moduleName"
trim="true"
target="compileModule"/>
</target>
<target name="compileModule">
<echo>Compiling ${moduleName} ...</echo>
<!-- Get the package path to the module from the full path -->
<pathconvert property="module.path"
pathsep=",">
<fileset dir="${MODULE_DIR}">
<include name="**/*.mxml"/>
</fileset>
<compositemapper>
<mapper type="regexp"
from="^(.*)[\\|/](src)[\\|/](.*)[\\|/](${moduleName}\.mxml)$$"
to="\3"/>
</compositemapper>
</pathconvert>
<mxmlc file="${MODULE_DIR}/${moduleName}.mxml"
output="${DEPLOY_DIR}/${module.path}/${moduleName}.swf"
actionscript-file-encoding="UTF-8"
keep-generated-actionscript="false"
optimize="true"
debug="false"
incremental="false"
load-externs="c:/link-report.xml">
<!-- Get default compiler options. -->
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
<!-- List of path elements that form the roots of ActionScript class hierarchies. -->
<source-path path-element="${FLEX_HOME}/frameworks"/>
<compiler.source-path path-element="src"/>
<!-- List of SWC files or directories that contain SWC files. -->
<!--<compiler.library-path dir="${FLEX_HOME}/frameworks"
append="true">
<include name="libs"/>
<include name="../bundles/{locale}"/>
</compiler.library-path> -->
<library-path dir="${LIBS_DIR}"
append="true">
<include name="*.swc"/>
</library-path>
</mxmlc>
</target>
<!-- Copy RSLs -->
<target name="copyRSLs">
<copy todir="${DEPLOY_DIR}"
file="${FLEX_HOME}/frameworks/rsls/${FRAMEWORK_VERSION}.swf"/>
<copy todir="${DEPLOY_DIR}"
file="${FLEX_HOME}/frameworks/rsls/${FRAMEWORK_VERSION}.swz"/>
</target>
<!-- Copy Images -->
<target name="copyImages">
<copy todir="${DEPLOY_DIR}/${IMAGE_PATH}">
<fileset dir="${SRC_DIR}/${IMAGE_PATH}"
includes="images/,swf/"/>
</copy>
</target>
</project>
Initial URL
Initial Description
Initial Title
Ant task for AS projects with Flash Builder
Initial Tags
Initial Language
XML