-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.xml
87 lines (72 loc) · 3.3 KB
/
build.xml
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
<?xml version="1.0" encoding="UTF-8"?>
<project name="as3-travisci-test">
<property environment="env" />
<property file="user.properties" />
<property file="build.properties" />
<taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />
<taskdef resource="flexUnitTasks.tasks" classpath="${flexunit.dir}/flexUnitTasks-4.2.0-20140410.jar" />
<target name="init">
<echo message="Using FLEX_HOME: ${FLEX_HOME}"/>
<delete dir="${bin.dir}" />
<delete dir="${report.dir}" />
<mkdir dir="${bin.dir}" />
<mkdir dir="${report.dir}" />
</target>
<target name="compile" depends="init" description="Compile SWC">
<compc output="${bin.dir}/${project.versionedname}.swc">
<source-path path-element="${src.dir}" />
<include-sources dir="${src.dir}" includes="*" />
<compiler.external-library-path dir="${lib.dir}" append="true">
<include name="*.swc" />
</compiler.external-library-path>
<keep-as3-metadata name="Marshall" />
</compc>
</target>
<target name="test" depends="compile" description="Run unit tests">
<mxmlc file="${test-src.dir}/TestRunner.as" output="${bin.dir}/TestRunner.swf">
<compiler.library-path dir="${bin.dir}" append="true">
<include name="${project.versionedname}.swc" />
</compiler.library-path>
<compiler.library-path dir="${flexunit.dir}" append="true">
<include name="*.swc" />
</compiler.library-path>
<compiler.library-path dir="${lib.dir}" append="true">
<include name="*.swc" />
</compiler.library-path>
<static-link-runtime-shared-libraries>true</static-link-runtime-shared-libraries>
</mxmlc>
<antcall target="run-flexunit" />
<delete file="${bin.dir}/TestRunner.swf" />
<junitreport todir="${report.dir}">
<fileset dir="${report.dir}">
<include name="TEST-*.xml" />
</fileset>
<report format="frames" todir="${report.dir}/html" />
</junitreport>
<fail if="tests.failed" />
</target>
<target name="run-flexunit">
<!-- Decide how we want to start flexunit -->
<antcall target="run-flexunit-with-player"/>
<antcall target="run-flexunit-without-player"/>
</target>
<target name="run-flexunit-with-player" if="FLASH_PLAYER_CMD">
<!-- Used the supplied flash player path, set via -DFLASH_PLAYER_CMD="$path",
mainly just for Travis CI -->
<flexunit command="${FLASH_PLAYER_CMD}" swf="${bin.dir}/TestRunner.swf" toDir="${report.dir}" haltonfailure="false" failureproperty="tests.failed" timeout="10000" localtrusted="true" />
</target>
<target name="run-flexunit-without-player" unless="FLASH_PLAYER_CMD">
<!-- If no command is supplied, flexunit will open flash player using the system's
default mechanism; however this will fail under Travis CI -->
<flexunit swf="${bin.dir}/TestRunner.swf" toDir="${report.dir}" haltonfailure="false" failureproperty="tests.failed" timeout="10000" localtrusted="true" />
</target>
<target name="package" depends="test" description="Package the project for distribution">
<delete dir="${dist.dir}" />
<mkdir dir="${dist.dir}" />
<zip destfile="${dist.dir}/${project.versionedname}.zip">
<zipfileset dir="${bin.dir}" includes="${project.versionedname}.swc" prefix="bin" />
<zipfileset dir="${lib.dir}" excludes="**/flexunit/**" prefix="libs" />
<zipfileset dir="${basedir}" includes="README.mkd" />
</zip>
</target>
</project>