This repository has been archived by the owner on Feb 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
139 lines (123 loc) · 6.23 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
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
137
138
139
<?xml version="1.0"?>
<project name="nobien-toolkit-actionscript3" default="usage" basedir=".">
<description>Nobien ActionScript 3 Toolkit</description>
<property file="user.properties" />
<property file="build.properties" />
<!-- Add the ant-contrib tasks -->
<taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="${resources.dir}/ant/ant-contrib.jar" />
<!-- Set up FlexUnit Ant tasks -->
<taskdef resource="flexUnitTasks.tasks" classpath="${resources.dir}/ant/flexUnitTasks.jar" />
<target name="usage">
<echo message=""/>
<echo message="${project.name.full}"/>
<echo message="-----------------------------------"/>
<echo message=""/>
<echo message="Available targets:"/>
<echo message=""/>
<echo message="test --> Build Nobien ActionScript 3 Toolkit SWC and run unit tests"/>
<echo message="build --> Build Nobien ActionScript 3 Toolkit SWC"/>
<echo message="clean --> Remove all folders created by build script"/>
<echo message="init --> Create build folders"/>
<echo message=""/>
</target>
<target name="init" depends="clean">
<echo>[init] Creating directories: bin, report</echo>
<mkdir dir="${bin.dir}"/>
<mkdir dir="${report.dir}"/>
<echo>[init] Directories created: bin, report</echo>
</target>
<target name="clean">
<echo>[clean] Removing directories: bin, report, dist</echo>
<delete includeemptydirs="true" failonerror="false">
<fileset dir="${docs.dir}" defaultexcludes="false">
<include name="**/*"/>
</fileset>
<fileset dir="${report.dir}" defaultexcludes="false">
<include name="**/*"/>
</fileset>
<fileset dir="${dist.dir}" defaultexcludes="false">
<include name="**/*"/>
</fileset>
<fileset dir="${bin.dir}" defaultexcludes="false">
<include name="**/*"/>
</fileset>
</delete>
<echo>[clean] Directories removed: bin, report, dist</echo>
</target>
<target name="build" depends="test">
<echo>[build] Compiling SWC</echo>
<echo>[build] Using Flex SDK at: ${FLEX_HOME}</echo>
<java jar="${FLEX_HOME}/lib/compc.jar" dir="${FLEX_HOME}/frameworks" fork="true" failonerror="true">
<arg value="-output=${bin.dir}/${project.name.versioned}.swc"/>
<arg value="-include-sources=${src.dir}" />
<arg value="-incremental=true"/>
<arg value="-static-link-runtime-shared-libraries=true"/>
<arg value="-verbose-stacktraces=true"/>
<arg value="-headless-server=true"/>
</java>
<echo>[build] Release SWC ${project.name.versioned}.swc created successfully</echo>
</target>
<target name="docs" depends="test">
<echo>[docs] Generating ASDoc documentation </echo>
<tstamp><format property="year" pattern="yyyy" /></tstamp>
<tstamp>
<format property="docgen.time" pattern="MM/dd/yyyy hh:mm aa" unit="hour"/>
</tstamp>
<java jar="${FLEX_HOME}/lib/asdoc.jar" dir="${FLEX_HOME}/frameworks" fork="true" failonerror="true">
<arg value="-output=${docs.dir}" />
<arg value="-doc-sources=${src.dir}" />
<arg value="-source-path=${src.dir}" />
<arg value="-main-title=${project.name.full} ${project.version}" />
<arg value="-window-title=${project.name.full} ${project.version}" />
<arg value="-footer=Copyright © ${year} Nobien" />
</java>
<echo>[docs] ASDoc documentation generated successfully.</echo>
</target>
<target name="test" depends="init">
<echo>[test] Compiling unit tests</echo>
<java jar="${FLEX_HOME}/lib/mxmlc.jar" dir="${FLEX_HOME}/frameworks" maxmemory="512m" fork="true" failonerror="true">
<arg value="${test.target}"/>
<arg value="-output=${report.dir}/flash/${test.output}.swf"/>
<arg value="-source-path=${test.dir}"/>
<arg value="-source-path=${src.dir}"/>
<arg value="-library-path+=${resources.dir}/lib"/>
<arg value="-default-size=1024,768"/>
<arg value="-default-background-color=0xFFFFFF"/>
<arg value="-incremental=true"/>
<arg value="-verbose-stacktraces=true"/>
<arg value="-headless-server=true"/>
</java>
<echo>[test] Unit tests compiled successfully</echo>
<echo>[test] Running FlexUnit Ant task on ${report.dir}/flash/${test.output}.swf</echo>
<flexunit swf="${report.dir}/flash/${test.output}.swf"
toDir="${report.dir}/xml"
haltonfailure="false"
verbose="true"
localTrusted="true"
failureproperty="flexunit.failed" />
<!-- Copy HTML container for FlexUnit UI -->
<echo>[test] Generating Flash report container</echo>
<copy file="${resources.dir}/html/test-runner.html" tofile="${report.dir}/flash/index.html"/>
<copy file="${resources.dir}/js/swfobject.js" tofile="${report.dir}/flash/swfobject.js"/>
<replace file="${report.dir}/flash/index.html">
<replacefilter token="@SWF@" value="${test.output}.swf"/>
</replace>
<!-- Generate readable JUnit-style reports -->
<echo>[test] Generating JUnit (HTML) report </echo>
<junitreport todir="${report.dir}/xml">
<fileset dir="${report.dir}/xml">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${report.dir}/html"/>
</junitreport>
<if>
<isset property="flexunit.failed"/>
<then>
<fail message="Failures exist in unit tests." />
</then>
<else>
<echo>[test] Tests completed with 0 failures or errors</echo>
</else>
</if>
</target>
</project>