forked from diamantidakos/Library
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.xml
314 lines (238 loc) · 10 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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
<project name="Library" default="compile" basedir="." xmlns:jacoco="antlib:org.jacoco.ant">
<property name="system.name" value="Library" />
<property name="src.dir" location="${basedir}/src" />
<property name="lib.dir" location="${basedir}/lib" />
<property name="build.dir" location="${basedir}/build" />
<property name="test.dir" location="${basedir}/test" />
<property name="doc.dir" location="${basedir}/doc"/>
<property name="testdoc.dir" location="${basedir}/doc"/>
<property name="reports.dir" location="${basedir}/reports"/>
<property name="junit.jar" location="${lib.dir}/junit-4.6.jar" />
<property name="api.doc.dir" location="${doc.dir}/api/"/>
<property name="design.doc.dir" location="${doc.dir}/design/"/>
<property name="umlet.home.dir" location="${lib.dir}/umlet/" />
<property name="design.diagrams.dir" location="${basedir}/design/diagrams" />
<property name="req.dir" location="${basedir}/requirements" />
<property name="req.doc.dir" location="${doc.dir}/requirements" />
<property name="coverage.dir" location="${reports.dir}/coverage" />
<patternset id = "meta.files">
<include name="**/*.xml"/>
</patternset>
<path id="compile.classpath">
<fileset dir ="${lib.dir}">
<include name ="**/*.jar"/>
<exclude name="umlet/**/*.jar"/>
</fileset>
</path>
<target name="init" description="Initialises Build.">
<mkdir dir="${build.dir}" />
<mkdir dir="${reports.dir}" />
<mkdir dir="${doc.dir}"/>
</target>
<target name="clean-diagrams">
<delete>
<fileset dir="${design.diagrams.dir}" includes="**/*.png"/>
</delete>
<delete>
<fileset dir="${req.dir}" includes="**/*.png"/>
</delete>
</target>
<target name="clean" description="Delete build directory.">
<delete dir="${build.dir}" />
<delete dir="${reports.dir}" />
<delete dir="${doc.dir}"/>
</target>
<target name="compile" depends="init" description="Compiles the code.">
<javac srcdir="${src.dir}"
destdir="${build.dir}"
encoding="UTF-8"
debug="on"
includeAntRuntime="no">
<classpath refid="compile.classpath" />
<compilerarg value="-Xlint:all" />
<compilerarg value="-Werror" />
</javac>
</target>
<target name="compile-test" depends = "compile" description="Compiles the Tests.">
<javac srcdir="${test.dir}"
destdir="${build.dir}"
encoding="UTF-8"
debug="on"
includeAntRuntime="no">
<classpath refid="compile.classpath" />
<compilerarg value="-Xlint:all" />
<compilerarg value="-Werror" />
</javac>
</target>
<property name="junit.dir" location="${reports.dir}/junit" />
<target name="test" depends="compile, compile-test" description="Run JUnit tests.">
<delete dir="${junit.dir}"/>
<mkdir dir="${junit.dir}" />
<junit printsummary="withOutAndErr" haltonfailure="${junit.haltonfailure}">
<classpath>
<pathelement location="${build.dir}" />
<path refid="compile.classpath" />
</classpath>
<formatter type="xml" />
<batchtest todir="${junit.dir}">
<fileset dir="${build.dir}" includes="**/*Test.class" />
</batchtest>
</junit>
</target>
<target name="testreport" depends = "test" description="HTML report for JUnit.">
<taskdef name="junitreport"
classname="org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator" />
<junitreport todir="${junit.dir}">
<fileset dir="${junit.dir}" includes="TEST-*.xml" />
<report format="frames" todir="${junit.dir}" />
</junitreport>
</target>
<target name= "coverage" depends="compile, compile-test">
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
<classpath path="${lib.dir}/jacocoant.jar"/>
</taskdef>
<jacoco:coverage>
<junit fork="true" forkmode="once" printsummary="withOutAndErr" haltonfailure="${junit.haltonfailure}">
<classpath>
<pathelement location="${build.dir}" />
<path refid="compile.classpath" />
</classpath>
<formatter type="xml" />
<batchtest todir="${junit.dir}">
<fileset dir="${build.dir}" includes="**/*Test.class" />
</batchtest>
</junit>
</jacoco:coverage>
</target>
<target name="coverage-report" depends="coverage">
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
<classpath path="${lib.dir}/jacocoant.jar"/>
</taskdef>
<jacoco:report>
<executiondata>
<file file="jacoco.exec"/>
</executiondata>
<structure name="Library">
<classfiles>
<fileset dir="${build.dir}"/>
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="src"/>
</sourcefiles>
</structure>
<html destdir="${coverage.dir}"/>
</jacoco:report>
</target>
<property name="checkstyle.dir" location="${reports.dir}/checkstyle"/>
<property name="checkstyle.jar" value="${lib.dir}/checkstyle-all-5.0.jar"/>
<path id="checkstyle.classpath">
<pathelement path="${build.dir}"/>
<path refid="compile.classpath"/>
</path>
<target name="checkstyle" depends="compile" >
<taskdef resource="checkstyletask.properties" classpath="${checkstyle.jar}" />
<mkdir dir="${checkstyle.dir}"/>
<checkstyle config="${lib.dir}/checkstyle/sun_checks.xml"
failOnViolation="false"
classpathref="checkstyle.classpath">
<fileset dir="${src.dir}" includes="**/*.java" />
<formatter type="plain"/>
<formatter type="xml" tofile="${checkstyle.dir}/checkstyle.xml" />
</checkstyle>
<xslt in="${checkstyle.dir}/checkstyle.xml"
out="${checkstyle.dir}/index.html"
style="${lib.dir}/checkstyle/checkstyle-noframes.xsl">
<param name="title" expression="Checkstyle Report" />
<param name="module" expression="Library" />
</xslt>
</target>
<target name="javadoc" depends="compile" description="Generate JavaDoc.">
<delete dir="${api.doc.dir}"/>
<mkdir dir="${api.doc.dir}"/>
<javadoc classpathref="compile.classpath"
sourcepath="${src.dir}"
destdir="${api.doc.dir}"
author="true"
version="true"
use="true"
package="true"
windowtitle="Library Documentation"
doctitle="Library Documentation"
encoding="UTF-8"
failonerror="true"/>
</target>
<target name="design-umlet" description="Converts Design UML diagram files to images">
<available file="${umlet.home.dir}/umlet.jar" property="umletExists"/>
<fail unless="umletExists" message="UMLet is not installed"/>
<java jar="${umlet.home.dir}/umlet.jar" fork="true">
<arg value="-action=convert" />
<arg value="-format=png" />
<arg value="-filename=${design.diagrams.dir}/*.uxf" />
<arg value="-output=${design.diagrams.dir}" />
</java>
</target>
<path id="wikitext.classpath">
<fileset dir="${lib.dir}">
<include name="org.eclipse.mylyn.wikitext.*core*.jar"/>
</fileset>
</path>
<taskdef classpathref="wikitext.classpath"
resource="org/eclipse/mylyn/wikitext/core/util/anttask/tasks.properties" />
<target name="design-doc" depends="design-umlet">
<delete dir="${design.doc.dir}"/>
<mkdir dir="${design.doc.dir}"/>
<wikitext-to-html markupLanguage="Textile" sourceEncoding="UTF-8">
<fileset dir="${basedir}/design">
<include name="*.textile"/>
</fileset>
<stylesheet url="styles/main.css"/>
</wikitext-to-html>
<move todir="${design.doc.dir}">
<fileset dir="${basedir}/design">
<include name="**/*.html"/>
</fileset>
</move>
<mkdir dir="${design.doc.dir}/diagrams"/>
<copy todir="${design.doc.dir}">
<fileset dir="${basedir}/design">
<include name="**/*.png"/>
<include name="**/*.jpg"/>
</fileset>
</copy>
</target>
<target name="req-umlet" description="Converts Requirements UML diagram files to images">
<available file="${umlet.home.dir}/umlet.jar" property="umletExists"/>
<fail unless="umletExists" message="UMLet is not installed"/>
<java jar="${umlet.home.dir}/umlet.jar" fork="true">
<arg value="-action=convert" />
<arg value="-format=png" />
<arg value="-filename=${req.dir}/*.uxf" />
<arg value="-output=${req.dir}" />
</java>
</target>
<target name="req-doc" depends="req-umlet">
<delete dir="${req.doc.dir}"/>
<mkdir dir="${req.doc.dir}"/>
<wikitext-to-html markupLanguage="Textile" sourceEncoding="UTF-8">
<fileset dir="${req.dir}">
<include name="*.textile"/>
</fileset>
<stylesheet url="styles/main.css"/>
</wikitext-to-html>
<move todir="${req.doc.dir}">
<fileset dir="${req.dir}">
<include name="**/*.html"/>
</fileset>
</move>
<mkdir dir="${req.doc.dir}"/>
<copy todir="${req.doc.dir}">
<fileset dir="${req.dir}">
<include name="**/*.png"/>
</fileset>
</copy>
</target>
<target name="technical-doc" depends="clean-diagrams, design-doc, req-doc" description="Builds Technical Documentation">
</target>
<target name="all"
depends="clean, compile, test, testreport, coverage-report, javadoc, checkstyle, technical-doc"/>
</project>