Skip to content

Instantly share code, notes, and snippets.

@yangboz
Created October 23, 2012 07:36
Show Gist options
  • Save yangboz/ed07deaaf2ea5c771fd4 to your computer and use it in GitHub Desktop.
Save yangboz/ed07deaaf2ea5c771fd4 to your computer and use it in GitHub Desktop.
Ant xml example for FLEX/AS3 code build.
<?xml version="1.0" encoding="utf-8"?>
<!-- myMXMLCBuild.xml -->
<project name="XXX_Flex_Compile"
basedir="."
default="main">
<property name="FLEX_HOME"
value="C:\Flex\sdks\flex_sdk_3.5.0_code_coverage"/>
<property name="TARGET_PLAYER"
value="11.3.0"/>
<property name="APP_ROOT"
value="."/>
<property name="swf-debug"
value="false"/>
<property name="bin.dir"
value="${basedir}/bin-debug/"/>
<tstamp>
<format property="BUILD_TIME"
pattern="MM/dd/yyyy HH:mm"
locale="en"/>
</tstamp>
<echo message="BUILD_TIME = ${BUILD_TIME}"/>
<property name="DEPLOY_DIR"
value="resources/"/>
<taskdef resource="flexTasks.tasks"
classpath="${FLEX_HOME}/ant/lib/flexTasks.jar"/>
<target name="main"
depends="compile_main-app">
</target>
<target name="update-version">
<propertyset id="tdate">
</propertyset>
<tstamp>
<format property="tdate"
pattern="yyyyMMdd"/>
</tstamp>
<buildnumber file="build.number"/>
<echo>updating version to current datetime: ${tdate}</echo>
<replaceregexp byline="true">
<regexp pattern="public static const BUILD_DATE: String = \'([0-9]+)'"/>
<substitution expression="public static const BUILD_DATE: String = '${tdate}'"/>
<fileset dir="src/com/autophotobook/www/oldStreet/utils">
<include name="VersionController.as"/>
</fileset>
</replaceregexp>
<echo>updating build number to: ${build.number}</echo>
<replaceregexp byline="true">
<regexp pattern="public static const BUILD_NUMBER: String = \'([0-9\.]+)'"/>
<substitution expression="public static const BUILD_NUMBER: String = '${build.number}'"/>
<fileset dir="src/com/autophotobook/www/oldStreet/utils">
<include name="VersionController.as"/>
</fileset>
</replaceregexp>
</target>
<target name="compile_main-app"
depends="update-version">
<ant antfile="./pmd.xml"/>
<ant antfile="./cpd.xml"/>
<ant antfile="./metrics.xml"/>
<ant antfile="./unit-test.xml"/>
<mxmlc file="${APP_ROOT}/src/Main.mxml"
output="${DEPLOY_DIR}/document_editor.swf"
keep-generated-actionscript="true"
maxmemory="512m">
<define name="D::LOG"
value="false"/>
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
<source-path path-element="${APP_ROOT}/src"/>
<compiler.library-path dir="${APP_ROOT}/libs"
append="true">
<include name="JSONLite.swc"/>
<include name="Cairngorm_2.2.1.swc"/>
<include name="popup-flex3-1.7.swc"/>
<include name="PreloaderAnimation.swc"/>
<include name="VKeyBoard.swc"/>
<include name="JSONLite.swc"/>
<include name="task-flex3-1.7.swc"/>
</compiler.library-path>
</mxmlc>
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment