-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbuild.xml
More file actions
executable file
·360 lines (332 loc) · 12.4 KB
/
build.xml
File metadata and controls
executable file
·360 lines (332 loc) · 12.4 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
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
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
<?xml version="1.0"?>
<!--
Ant build file for Genesis.
Auther Hussein Hosseini Badakhchani (Hoos).
-->
<project name="genesis" default="test" basedir=".">
<description>
Genesis is an automated IT infrastructure provisioning application.
</description>
<!--
Project directories.
-->
<property name="build.dir" location="${basedir}/build"/>
<property name="dist.dir" location="${basedir}/dist"/>
<property name="etc.dir" location="${basedir}/etc"/>
<property name="lib.dir" location="${basedir}/lib"/>
<property name="src.dir" location="${basedir}/src"/>
<property name="thirdparty.dir" location="${basedir}/thirdparty"/>
<property name="build.classes.dir" location="${build.dir}/classes"/>
<property name="test.reports.dir" location="${build.dir}/reports"/>
<property name="project.dir" location="${dist.dir}/${ant.project.name}"/>
<property name="project.lib.dir" location="${project.dir}/engine/lib"/>
<property name="engine.dir" location="${project.dir}/engine"/>
<property name="distribution.dir" location="${etc.dir}/distribution"/>
<!--
Thridparty application locations.
-->
<property name="ant.dir" location="${thirdparty.dir}/apache-ant-1.8.2"/>
<property name="checkstyle.reports.dir" location="${test.reports.dir}/checkstyle"/>
<property name="pmd.dir" location="${thirdparty.dir}/pmd-4.2.5"/>
<property name="pmd.reports.dir" location="${test.reports.dir}/pmd"/>
<property name="findbugs.dir" location="${thirdparty.dir}/findbugs-1.3.9"/>
<property name="findbugs.reports.dir" location="${test.reports.dir}/findbugs"/>
<property name="emma.dir" location="${thirdparty.dir}/emma-2.0.5312"/>
<property name="emma.reports.dir" location="${test.reports.dir}/emma"/>
<property name="grinder.dir" location="${thirdparty.dir}/grinder-3.4"/>
<property name="grinder.reports.dir" location="${test.reports.dir}/grinder"/>
<property name="analyser.dir" location="${thirdparty.dir}/GrinderAnalyzer.V2.b13"/>
<property name="analyser.reports.dir" location="${test.reports.dir}/grinderReports"/>
<property name="junit.reports.dir" location="${test.reports.dir}/junit"/>
<!--
Javac compiler options.
-->
<property name="debug" value="true"/>
<property name="deprecation" value="on"/>
<!--
All dependant libraries are located in the project
library directory ${lib.dir}.
-->
<path id="classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
<pathelement location="${project.lib.dir}/${ant.project.name}.jar"/>
<pathelement location="${project.lib.dir}/${ant.project.name}-test.jar"/>
</path>
<!--
PMD classpath
-->
<path id="pmd.classpath">
<fileset dir="${pmd.dir}/lib">
<include name="**/*.jar"/>
</fileset>
</path>
<!--
FindBugs classpath
-->
<path id="findbugs.classpath">
<fileset dir="${findbugs.dir}/lib">
<include name="**/*.jar"/>
</fileset>
</path>
<!--
Emma classpath
-->
<path id="emma.classpath">
<fileset dir="${emma.dir}/lib">
<include name="**/*.jar"/>
</fileset>
</path>
<!--
Grinder classpath
-->
<path id="grinder.classpath">
<path refid="classpath"/>
<fileset dir="${grinder.dir}/lib">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${analyser.dir}/lib">
<include name="**/*.jar"/>
</fileset>
</path>
<!--
Create a time stamp for the build.
-->
<target name="init">
<tstamp/>
<mkdir dir="${dist.dir}"/>
<mkdir dir="${project.dir}"/>
<mkdir dir="${engine.dir}/lib"/>
<mkdir dir="${build.classes.dir}"/>
<mkdir dir="${test.reports.dir}"/>
<available file="${lib.dir}/weblogic.jar" property="weblogic"/>
</target>
<!--
Compile the weblogic package.
-->
<target name="weblogic" if="weblogic"
description=" - compiles the (weblogic) package">
<javac srcdir="${src.dir}" destdir="${build.classes.dir}"
optimize="${optimize}" debug="${debug}" deprecation="${deprecation}"
bootclasspath="${bootclasspath}" classpathref="classpath">
<include name="**/weblogic/*"/>
</javac>
</target>
<!--
Compile the java source code.
-->
<target name="comp" depends="clean, init, weblogic"
description=" - (comp)iles the source code">
<javac srcdir="${src.dir}" destdir="${build.classes.dir}"
optimize="${optimize}" debug="${debug}" deprecation="${deprecation}"
bootclasspath="${bootclasspath}" includeantruntime="true" classpathref="classpath">
<exclude name="**/weblogic/*"/>
</javac>
</target>
<!--
Create a distribution of Genesis.
-->
<target name="dist" depends="comp"
description=" - creates a (dist)ribution package of genesis">
<copy todir="${project.dir}">
<fileset dir="${distribution.dir}"/>
<fileset dir="${basedir}" includes="**/thirdparty/**"/>
</copy>
<chmod file="${project.dir}/genesis" perm="ugo+rx"/>
<chmod dir="${project.dir}/thirdparty/apache-ant-1.8.2/bin"
includes="*" perm="ug+rx"/>
<chmod dir="${project.dir}/contrib"
includes="*env" perm="ug+rx"/>
<jar basedir="${build.classes.dir}"
jarfile="${engine.dir}/lib/${ant.project.name}.jar"
manifest="${etc.dir}/MANIFEST.MF"
excludes="**/*Test.class">
</jar>
<jar basedir="${build.classes.dir}"
jarfile="${engine.dir}/lib/${ant.project.name}-test.jar"
manifest="${etc.dir}/MANIFEST.MF"
includes="**/*Test.class">
</jar>
</target>
<!--
Test the java source code.
-->
<target name="test-weblogic" depends="dist" if="weblogic"
description=" - (test) the (webogic) package">
<mkdir dir="${junit.reports.dir}"/>
<junit printsummary="yes" haltonfailure="yes">
<classpath>
<path refid="classpath"/>
</classpath>
<formatter type="xml"/>
<batchtest fork="no" todir="${junit.reports.dir}">
<fileset dir="${build.classes.dir}">
<include name="**/TripleDesTest.class"/>
</fileset>
</batchtest>
</junit>
</target>
<!--
Test the java source code.
-->
<target name="test" depends="test-weblogic, dist"
description=" - (test)s the genesis distribution">
<mkdir dir="${junit.reports.dir}"/>
<junit printsummary="yes" haltonfailure="yes">
<classpath>
<path refid="classpath"/>
</classpath>
<formatter type="xml"/>
<batchtest fork="no" todir="${junit.reports.dir}">
<fileset dir="${build.classes.dir}">
<include name="**/*Test*.class"/>
<exclude name="**/TripleDes*.class"/>
</fileset>
</batchtest>
</junit>
</target>
<!--
Run checkstyle against the source cocde.
-->
<target name="checkstyle"
description=" - runs the (checkstyle) source code analyser">
<mkdir dir="${checkstyle.reports.dir}"/>
<taskdef resource="checkstyletask.properties"
classpath="${ant.dir}/lib/checkstyle-5.4-all.jar"/>
<checkstyle config="${etc.dir}/sun_checks.xml" failOnViolation="false">
<formatter type="xml" tofile="${checkstyle.reports.dir}/checkstyle_report.xml"/>
<fileset dir="${src.dir}" includes="**/*.java"/>
</checkstyle>
<xslt style="${etc.dir}/checkstyle-frames.xsl"
in="${checkstyle.reports.dir}/checkstyle_report.xml"
out="${checkstyle.reports.dir}/checkstyle_report.html" />
</target>
<!--
Run PMD against the source cocde.
-->
<target name="pmd"
description=" - runs the (pmd) source code analyser">
<taskdef name="pmd"
classname="net.sourceforge.pmd.ant.PMDTask"
classpathref="pmd.classpath"/>
<mkdir dir="${pmd.reports.dir}"/>
<pmd targetjdk="1.6">
<ruleset>basic</ruleset>
<ruleset>braces</ruleset>
<ruleset>imports</ruleset>
<ruleset>unusedcode</ruleset>
<ruleset>clone</ruleset>
<ruleset>codesize</ruleset>
<ruleset>coupling</ruleset>
<ruleset>design</ruleset>
<ruleset>finalizers</ruleset>
<ruleset>imports</ruleset>
<ruleset>j2ee</ruleset>
<ruleset>javabeans</ruleset>
<ruleset>junit</ruleset>
<ruleset>logging-java</ruleset>
<!--ruleset>migrating_to_15</ruleset>
<ruleset>migrating_to_junit4</ruleset-->
<ruleset>naming</ruleset>
<ruleset>optimizations</ruleset>
<ruleset>strictexception</ruleset>
<ruleset>strings</ruleset>
<ruleset>sunsecure</ruleset>
<ruleset>typeresolution</ruleset>
<ruleset>unusedcode</ruleset>
<formatter type="xml"
toFile="${pmd.reports.dir}/pmd_report.xml"
showSuppressed="true"
toConsole="fale"/>
<fileset dir="${src.dir}">
<include name="**/*.java"/>
</fileset>
</pmd>
</target>
<!--
Run FindBugs against the source cocde.
-->
<target name="findbugs"
description=" - runs the (findbugs) source code analyser">
<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask"/>
<mkdir dir="${findbugs.reports.dir}"/>
<findbugs home="${findbugs.dir}"
reportLevel="low"
debug="true"
effort="max"
output="xml"
outputFile="${findbugs.reports.dir}/findbugs.xml">
<auxClasspath refid="classpath"/>
<sourcePath path="${src.dir}"/>
<class location="${project.dir}/engine/lib/${ant.project.name}.jar"/>
</findbugs>
</target>
<!--
Run Emma against the source cocde.
-->
<target name="emma"
description=" - runs the (emma) source code analyser">
<taskdef resource="emma_ant.properties" classpathref="emma.classpath"/>
<mkdir dir="${emma.reports.dir}"/>
<emmajava enabled="true" libclasspathref="emma.classpath"
classname="com.uk.genesis.GenesisLoader" classpathref="classpath">
<xml outfile="${emma.reports.dir}/report.xml"/>
</emmajava>
</target>
<!--
Run the Grinder test suite and create the Grinder reports.
-->
<target name="grinder" depends="test"
description=" - runs the Grinder and generates performance reports">
<echo>Test run for ${environment}</echo>
<mkdir dir="${grinder.reports.dir}"/>
<java classname="net.grinder.Grinder"
classpathref="grinder.classpath" fork="yes">
<jvmarg value="-Xmx256m" />
<sysproperty key="java.io.tmpdir" value="${build.dir}/tmp" />
<sysproperty key="python.cachedir" value="${build.dir}/tmp" />
<sysproperty key="grinder.logDirectory" value="${grinder.reports.dir}" />
<sysproperty key="grinder.jvm.arguments"
value="-Djava.io.tmpdir=${build.dir}/tmp
-Dpython.cachedir=${build.dir}/tmp" />
<arg file="${project.dir}/grinder.properties"/>
</java>
</target>
<!--
Run the Grinder analyser to generate charts from Grinder reports.
-->
<target name="analyse" depends="grinder"
description=" - (analyse)s the Grinder reports generating charts.">
<!--
The hostname is used to find the Grinder data and out logs.
COMPUTERNAME is also set so this works on WINDOWS OS.
-->
<property environment="env"/>
<property name="env.COMPUTERNAME" value="${env.HOSTNAME}"/>
<java classname="org.python.util.jython"
classpathref="grinder.classpath" fork="yes" dir="${analyser.dir}">
<jvmarg value="-Xmx256m" />
<sysproperty key="java.io.tmpdir" value="${build.dir}/tmp" />
<sysproperty key="python.cachedir" value="${build.dir}/tmp" />
<arg line="${analyser.dir}/analyzer.py
${grinder.reports.dir}/data_${env.COMPUTERNAME}-0.log
${grinder.reports.dir}/out_${env.COMPUTERNAME}-0.log"/>
</java>
<move file="${analyser.dir}/grinderReport" toFile="${analyser.reports.dir}"/>
</target>
<!--
Clean build
-->
<target name="clean" description=" - (clean)s the build">
<echo message="${ant.project.name}"/>
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
</target>
<!--
Build All.
-->
<target name="buildall" description=" - (build)s (all) the targets in the build"
depends="test, checkstyle, pmd, findbugs, emma, grinder, analyse">
</target>
</project>