forked from as3/as3-utils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
236 lines (188 loc) · 7.13 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
<?xml version="1.0"?>
<project
name="as3-utils"
basedir="."
default="package">
<!--
as3-utils
usage:
$ ant -v clean package
@author drewbourne
-->
<!-- properties -->
<property environment="env" />
<property file="build.properties" />
<!-- paths: existing -->
<property name="src.loc" location="${basedir}/src" />
<property name="test.loc" location="${basedir}/test" />
<property name="lib.loc" location="${basedir}/libs" />
<property name="build.loc" location="${basedir}/build" />
<property name="build.pmd.loc" location="${build.loc}/pmd" />
<property name="build.flexunit.loc" location="${build.loc}/flexunit" />
<!-- paths: enerated -->
<property name="dist.loc" location="${basedir}/target" />
<property name="bin.loc" location="${dist.loc}/bin" />
<property name="doc.loc" location="${dist.loc}/doc" />
<property name="report.loc" location="${dist.loc}/report" />
<property name="report.flexunit.loc" location="${report.loc}/flexunit" />
<!-- Flex SDK -->
<property name="FLEX_HOME" location="${env.FLEX_HOME}" />
<!-- taskdefs -->
<taskdef resource="flexTasks.tasks"
classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />
<!-- targets -->
<target
name="clean"
description="Removes generated artifacts and directories">
<delete dir="${dist.loc}" />
</target>
<target
name="initialize"
description="Creates generated directories ">
<mkdir dir="${dist.loc}" />
<mkdir dir="${bin.loc}" />
<mkdir dir="${doc.loc}" />
<mkdir dir="${report.loc}" />
<mkdir dir="${report.flexunit.loc}" />
</target>
<target
name="compile-check-if-required"
description="Checks if a compile is required"
depends="initialize">
<uptodate
property="compile.not-required"
targetfile="${bin.loc}/${build.artifact}.swc">
<srcresources>
<fileset dir="${src.loc}">
<include name="**/*.as" />
<include name="**/*.mxml" />
</fileset>
<fileset dir="${lib.loc}">
<include name="**/*.swc" />
</fileset>
</srcresources>
</uptodate>
</target>
<target
name="compile"
description="Compiles the library"
depends="initialize, compile-check-if-required"
unless="compile.not-required">
<compc output="${bin.loc}/${build.artifact}.swc">
<source-path path-element="${src.loc}" />
<include-sources dir="${src.loc}">
<include name="**/*.as" />
<include name="**/*.mxml" />
</include-sources>
<library-path dir="${lib.loc}" append="true">
<include name="*.swc" />
</library-path>
<compiler.verbose-stacktraces>true</compiler.verbose-stacktraces>
<compiler.headless-server>true</compiler.headless-server>
</compc>
</target>
<target name="test"
description="Run the test suite"
depends="initialize">
<taskdef resource="flexUnitTasks.tasks"
classpath="${build.flexunit.loc}/flexUnitTasks-${flexunit.version}.jar" />
<!-- Compile Test -->
<mxmlc
file="${test.loc}/${test.runner}.${test.runner.ext}"
output="${bin.loc}/${test.runner}.swf">
<library-path dir="${bin.loc}" append="true">
<include name="${build.artifact}.swc" />
</library-path>
<library-path dir="${lib.loc}" append="true">
<include name="*.swc" />
</library-path>
<compiler.verbose-stacktraces>true</compiler.verbose-stacktraces>
<compiler.headless-server>true</compiler.headless-server>
</mxmlc>
<!-- Execute Tests -->
<flexunit
swf="${bin.loc}/${test.runner}.swf"
toDir="${report.flexunit.loc}"
headless="true"
haltonfailure="false"
verbose="true"
localTrusted="true" />
</target>
<target name="report"
description="Generates test reports from FlexUnit, FlexPMD, FlexCPD, FlexMetrics"
depends="test">
<!-- Generate readable report for FlexUnit -->
<junitreport todir="${report.flexunit.loc}">
<fileset dir="${report.flexunit.loc}">
<include name="TEST-*.xml" />
</fileset>
<report format="frames" todir="${report.flexunit.loc}/html" />
</junitreport>
<!-- FlexPMD config -->
<path id="flexpmd.base">
<pathelement location="${build.pmd.loc}/as3-parser-${flexpmd.version}.jar" />
<pathelement location="${build.pmd.loc}/as3-parser-api-${flexpmd.version}.jar" />
<pathelement location="${build.pmd.loc}/as3-plugin-utils-${flexpmd.version}.jar" />
<pathelement location="${build.pmd.loc}/flex-pmd-files-${flexpmd.version}.jar" />
<pathelement location="${build.pmd.loc}/pmd-4.2.5.jar" />
</path>
<taskdef name="pmd" classname="com.adobe.ac.pmd.ant.FlexPmdAntTask" classpath="${build.pmd.loc}/flex-pmd-ant-task-${flexpmd.version}.jar">
<classpath>
<path refid="flexpmd.base" />
<pathelement location="${build.pmd.loc}/commons-lang-2.4.jar" />
<pathelement location="${build.pmd.loc}/flex-pmd-core-${flexpmd.version}.jar" />
<pathelement location="${build.pmd.loc}/flex-pmd-ruleset-api-${flexpmd.version}.jar" />
<pathelement location="${build.pmd.loc}/flex-pmd-ruleset-${flexpmd.version}.jar" />
<pathelement location="${build.pmd.loc}/plexus-utils-1.0.2.jar" />
</classpath>
</taskdef>
<taskdef name="cpd" classname="com.adobe.ac.cpd.ant.FlexCpdAntTask" classpath="${build.pmd.loc}/flex-pmd-cpd-ant-task-${flexpmd.version}.jar">
<classpath>
<path refid="flexpmd.base" />
<pathelement location="${build.pmd.loc}/flex-pmd-cpd-${flexpmd.version}.jar" />
</classpath>
</taskdef>
<taskdef name="metrics" classname="com.adobe.ac.pmd.metrics.ant.FlexMetricsAntTask" classpath="${build.pmd.loc}/flex-pmd-metrics-ant-task-${flexpmd.version}.jar">
<classpath>
<path refid="flexpmd.base" />
<pathelement location="${build.pmd.loc}/commons-lang-2.4.jar" />
<pathelement location="${build.pmd.loc}/dom4j-1.6.1.jar" />
<pathelement location="${build.pmd.loc}/flex-pmd-metrics-${flexpmd.version}.jar" />
<pathelement location="${build.pmd.loc}/flex-pmd-ruleset-api-${flexpmd.version}.jar" />
</classpath>
</taskdef>
<!-- Executions -->
<pmd sourceDirectory="${src.loc}" outputDirectory="${report.loc}" />
<cpd minimumTokenCount="50" outputFile="${report.loc}/cpd.xml">
<fileset dir="${src.loc}">
<include name="**/*.as" />
<include name="**/*.mxml" />
</fileset>
</cpd>
<metrics sourcedirectory="${src.loc}" outputfile="${report.loc}/javancss.xml" />
</target>
<target name="doc"
description="Generate ASDoc for ${ant.project.name}"
depends="initialize">
<!-- Generate asdocs -->
<java jar="${FLEX_HOME}/lib/asdoc.jar" fork="true" failonerror="true">
<arg line="+flexlib '${FLEX_HOME}/frameworks'" />
<arg line="-doc-sources '${src.loc}'" />
<arg line="-source-path+='${src.loc}'" />
<arg line="-output '${doc.loc}'" />
<arg line="-main-title '${project.name} API Documentation'" />
<arg line="-window-title '${project.name} API Documentation'" />
</java>
</target>
<target name="package"
description="Package ${ant.project.name} into a zip"
depends="compile, test, report, doc">
<!-- Create distribution for binaries with docs -->
<zip destfile="${dist.loc}/${build.artifact}.zip">
<zipfileset dir="${bin.loc}">
<include name="${build.artifact}.swc" />
</zipfileset>
<zipfileset dir="${doc.loc}" prefix="doc" />
</zip>
</target>
</project>