Skip to content
This repository
tree: 24c6c16aec
file 136 lines (102 sloc) 5.168 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
<?xml version="1.0"?>
<project name="as3corelib" basedir="../" default="compile">

<!-- ============================== -->
<!-- Configuration -->
<!-- ============================== -->

<property environment="env" />

<fail unless="env.FLEX_HOME" message="FLEX_HOME needs to be defined as an environment variable or in the Ant build." />

<!-- Configuration -->
<property file="${basedir}/build/build.properties" />

<!-- Setup Flex Ant Resources -->
<!--property name="FLEX_HOME" location="${flex.sdk}" /-->
<property name="FLEX_HOME" location="${env.FLEX_HOME}" />
<taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />

<!-- ============================== -->
<!-- Clean and Init Targets -->
<!-- ============================== -->

<target name="clean" description="Removes artifacts from previous builds">
<delete includeemptydirs="true" failonerror="false">
<fileset dir="${bin.dir}" defaultexcludes="false">
<include name="**/*" />
</fileset>
<fileset dir="${test.bin.dir}" defaultexcludes="false">
<include name="**/*" />
</fileset>
<fileset dir="${docs.dir}" defaultexcludes="false">
<include name="**/*" />
</fileset>
<fileset dir="${report.dir}" defaultexcludes="false">
<include name="**/*" />
</fileset>
</delete>
</target>

<target name="init" description="Initializes project and destination folders">
<echo message="Project: ${ant.project.name}" />
<echo message="Flex SDK: ${FLEX_HOME}" />

<!-- Create direectories -->
<mkdir dir="${bin.dir}" />
<mkdir dir="${test.bin.dir}" />
<mkdir dir="${docs.dir}" />
<mkdir dir="${report.dir}" />
</target>

<!-- ======================================= -->
<!-- Unit Test Targets -->
<!-- ======================================= -->

<target name="compileTestRunner" depends="init" description="Compiles the test runner application.">

<!-- Compile TestRunner MXML as a SWF -->
<mxmlc file="${test.src.dir}/${test.application.name}.mxml"
output="${test.bin.dir}/${test.application.name}.swf">

<load-config filename="${FLEX_HOME}/frameworks/air-config.xml" />

<source-path path-element="${src.dir}" />
<source-path path-element="${test.src.dir}" />

<!-- The TestRunner needs the flexunit libraries in the build/libs folder -->
<library-path dir="${build.libs.dir}" append="true">
<include name="*.swc" />
</library-path>

<!-- Sets java.awt.headless=true so font compilation works in headless environments -->
<compiler.headless-server>true</compiler.headless-server>
</mxmlc>

<echo message="The ${test.application.name}.swf test runner has been created in ${test.bin.dir}" />
</target>

<target name="runTestsAndReport" depends="init" description="Launches the test runner, captures results, generates test report artifacts.">
<!-- Run FlexUnit Ant Task to execute the unit tests and capture reporting data -->
<taskdef resource="flexUnitTasks.tasks" classpath="${build.libs.dir}/flexUnitTasks-4.0.0.jar" />
<flexunit swf="${test.bin.dir}/${test.application.name}.swf" toDir="${report.dir}"
haltonfailure="false" verbose="false" localTrusted="false" player="air" />

<!-- Generate html JUnit-style reports based on test results -->
<junitreport todir="${report.dir}">
<fileset dir="${report.dir}">
<include name="TEST-*.xml" />
</fileset>
<report format="frames" todir="${report.html.dir}" />
</junitreport>

<echo message="The unit test reports have been created in ${report.dir}" />
</target>

<target name="test" depends="init, compileTestRunner, runTestsAndReport" description="Compiles unit tests and generates test report artiacts." />

<!-- ======================================= -->
<!-- Compile and Document -->
<!-- ======================================= -->

<target name="compile" depends="init" description="Compile the library .swc file">
<compc output="${bin.dir}/${library.name}.swc"
debug="false" optimize="true">

<load-config filename="${FLEX_HOME}/frameworks/air-config.xml" />

<source-path path-element="${src.dir}" />
<include-sources dir="${src.dir}" includes="*" />
</compc>
</target>

<target name="docs" depends="init" description="Generate ASDoc documentation">
<java jar="${FLEX_HOME}/lib/asdoc.jar"
dir="${FLEX_HOME}/frameworks" fork="true" failonerror="true">

<arg line="-load-config '${FLEX_HOME}/frameworks/air-config.xml'" />

<!-- Place the documentation in the "docs" directory -->
<arg line="-output ${docs.dir}" />

<!-- Specify the main source path as "src" -->
<arg line="-source-path ${src.dir}" />

<!-- Document all of the classes in the "src" tree -->
<arg line="-doc-sources ${src.dir} " />

<!-- Include the library name in the window title -->
<arg line="-window-title 'Adobe ActionScript 3.0 Core Library - ${library.name}' "/>

</java>

<echo message="Documentation has been created in ${docs.dir}" />
</target>

</project>
Something went wrong with that request. Please try again.