forked from svn2github/fleXive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.tests.xml
533 lines (476 loc) · 26.1 KB
/
build.tests.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
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
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
<?xml version="1.0" encoding="UTF-8"?>
<project name="flexive-tests" basedir=".">
<import file="build.shared-properties.xml"/>
<!-- ========================== properties ========================== -->
<property name="tests.framework.dir" value="${flexive.base.framework.dir}/tests/java"/>
<property name="tests.framework.groovy.dir" value="${flexive.base.framework.dir}/tests/groovy"/>
<property name="tests.jsf.dir" value="${flexive.base.ui.jsf.dir}/tests/java"/>
<property name="tests.jsf.groovy.dir" value="${flexive.base.ui.jsf.dir}/tests/groovy"/>
<property name="tests.jar.dir" value="${flexive.base.build.dir}/framework/testjar"/>
<property name="tests.resources.dir" value="${flexive.base.framework.dir}/testresources"/>
<property name="tests.classes.dir" value="${flexive.base.build.dir}/framework/testclasses"/>
<property name="base.reports.dir" value="${basedir}/reports"/>
<property name="emma.dir" value="${flexive.lib.dir}/emma"/>
<property name="coverage.dir" value="${base.reports.dir}/coverage"/>
<property name="testng.report.dir" value="${base.reports.dir}/testNG"/>
<property name="testng.suite.dir" value="Ant suite"/>
<property name="tests.users" value=""/> <!-- set to "all" to enable all test users by default -->
<property name="debug.settings" value="-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=6006"/>
<property name="run.debug.settings" value=""/>
<property name="run.profile.settings" value=""/>
<property name="run.dist.settings" value=""/>
<property name="findbugs.dir" value="${flexive.lib.dir}/findbugs2"/>
<property name="findbugs.xsl" value="${findbugs.dir}/src/xsl/fancy.xsl"/>
<property name="findbugs.report.dir" value="${base.reports.dir}/findbugs"/>
<property name="checkstyle.dir" value="${flexive.resources.framework.dir}/checkstyle"/>
<property name="checkstyle.config" value="${checkstyle.dir}/flexive_checks.xml"/>
<property name="checkstyle.xsl" value="${checkstyle.dir}/checkstyle-frames.xsl"/>
<property name="checkstyle.report.dir" value="${base.reports.dir}/checkstyle"/>
<property name="pmd.dir" value="${flexive.lib.dir}/pmd"/>
<property name="pmd.report.dir" value="${base.reports.dir}/pmd"/>
<!-- ========================== paths =============================== -->
<!-- paths -->
<path id="emma.lib">
<fileset dir="${emma.dir}" includes="*.jar"/>
</path>
<path id="pmd.lib">
<fileset dir="${pmd.dir}" includes="*.jar"/>
</path>
<path id="build.classpath.testng">
<fileset dir="${flexive.lib.dir}" includes="*.jar" excludes="qdox.jar,javaee6.jar"/>
<fileset dir="${flexive.lib.dir}/testNG" includes="*.jar"/>
<fileset dir="${flexive.lib.dir}/xstream" includes="*.jar"/>
<fileset dir="${flexive.lib.dir}/groovy" includes="*.jar"/>
<fileset dir="${flexive.lib.dir}/jsf" includes="*.jar"/>
<fileset dir="${flexive.lib.dir}/antlr" includes="*.jar"/>
<path refid="emma.lib"/>
<path path="${build.ui.classes.dir}"/>
<path path="${build.ui.shared.classes.dir}"/>
</path>
<path id="ejb3-embedded.classpath">
<path refid="build.classpath.testng"/>
<fileset dir="${flexive.lib.dir}/jsf" includes="*.jar"/>
<fileset dir="${flexive.lib.dir}/text_extraction" includes="*.jar"/>
<fileset dir="${flexive.build.framework.jar.dir}" includes="flexive-tests.jar"/>
<path refid="flexive.ejb3-embedded.classpath"/>
</path>
<!-- ========================== tasks / macros ====================== -->
<!-- tasks -->
<taskdef resource="emma_ant.properties" classpathref="emma.lib"/>
<taskdef resource="testngtasks" classpathref="build.classpath.testng"/>
<taskdef resource="checkstyletask.properties" classpath="${flexive.lib.dir}/checkstyle/checkstyle-all-4.3.jar"/>
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd.lib"/>
<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask">
<classpath>
<fileset dir="${findbugs.dir}/lib" includes="*.jar"/>
</classpath>
</taskdef>
<macrodef name="runTests">
<attribute name="containerClasspathRef" default="build.classpath.testng"/>
<element name="body" optional="false" implicit="true"/>
<sequential>
<copy file="${tests.resources.dir}/testlog4j.xml" todir="${tests.classes.dir}"/>
<testng classpathref="@{containerClasspathRef}"
outputDir="${testng.report.dir}">
<classpath>
<fileset dir="${flexive.build.framework.jar.dir}" includes="*.jar, *.ejb3"/>
<fileset dir="${build.ui.jar.dir}" includes="*.jar"/>
<path path="${tests.classes.dir}"/>
</classpath>
<jvmarg value="-Dtests.users=${tests.users}"/>
<jvmarg value="-Dfxstreaming.port=18290"/>
<jvmarg value="-Djava.net.preferIPv4Stack=true"/>
<jvmarg value="-Demma.coverage.out.file=${coverage.dir}/coverage.ec"/>
<jvmarg value="-Demma.coverage.out.merge=true"/>
<!-- JDK6 classloader policy issue w/jboss embedded workaround -->
<jvmarg value="-Dsun.lang.ClassLoader.allowArraySyntax=true"/>
<jvmarg line="${run.debug.settings}"/>
<jvmarg line="${run.profile.settings}"/>
<!--Enable the following line for log output-->
<jvmarg value="-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger"/>
<jvmarg value="-Dlog4j.configuration=testlog4j.xml"/>
<body/>
</testng>
<junitreport todir="${testng.report.dir}">
<fileset dir="${testng.report.dir}/flexive">
<include name="*.xml"/>
</fileset>
<report format="noframes" todir="${testng.report.dir}"/>
</junitreport>
<move file="${testng.report.dir}/junit-noframes.html" tofile="${testng.report.dir}/flexive/reporter-output.html" overwrite="true"/>
</sequential>
</macrodef>
<!-- Compile the groovy test folder for the given files -->
<macrodef name="groovyc-tests">
<attribute name="srcdir"/>
<attribute name="includes"/>
<sequential>
<groovyc srcdir="@{srcdir}" destdir="${tests.classes.dir}" classpathref="build.classpath.testng" includes="@{includes}">
<classpath>
<path path="${build.framework.classes.dir}"/>
<path path="${build.ui.classes.dir}"/>
<path path="${build.ui.shared.classes.dir}"/>
<path path="${tests.classes.dir}"/>
<fileset dir="${build.ui.jar.dir}" includes="*.jar"/>
</classpath>
</groovyc>
</sequential>
</macrodef>
<!-- ========================== targets ============================= -->
<target name="emma.enable" if="tests.emma.enabled">
<groovy>
properties.'emma.enabled' = true
</groovy>
<delete file="${coverage.dir}/coverage.ec"/>
<mkdir dir="${coverage.dir}"/>
<echo message="EMMA coverage instrumentation will only be enabled"/>
<echo message="if target 'clean' has been called previously or on first-time builds!"/>
</target>
<target name="profile.netbeans.enable" if="profile.netbeans.enabled">
<groovy>
properties.'run.profile.settings' = "-agentpath:${properties.'profile.netbeans.root'}/${properties.'profile.netbeans.agent'}=${properties.'profile.netbeans.root'}/lib,5140"
</groovy>
<echo message="Run settings: ${run.profile.settings}"/>
</target>
<target name="tests.compile.all" depends="tests.compile.shared,tests.compile.ejb,tests.compile.jsf,tests.compile.browser,tests.compile.dist"/>
<target name="tests.package.dist" depends="tests.compile.all" description="Builds flexive-tests.jar in the distribution directory, including all testcases">
<mkdir dir="${flexive.dist.lib.dir}"/>
<jar destfile="${flexive.dist.lib.dir}/flexive-tests.jar">
<fileset dir="${tests.classes.dir}">
<include name="com/flexive/tests/**/*"/>
<include name="*.properties"/>
</fileset>
<fileset dir="${tests.resources.dir}">
<include name="flexive-application.properties"/>
<include name="scripts/**"/>
</fileset>
</jar>
</target>
<target name="tests.package.ear" depends="tests.compile.all" description="Builds flexive-tests.jar for inclusion in flexive.ear, including all testcases">
<mkdir dir="${flexive.build.framework.jar.dir}"/>
<jar destfile="${flexive.build.framework.jar.dir}/flexive-tests.jar">
<fileset dir="${tests.classes.dir}">
<include name="com/flexive/tests/**/*"/>
<include name="*.properties"/>
</fileset>
<fileset dir="${tests.resources.dir}">
<include name="flexive-application.properties"/>
<include name="scripts/**"/>
</fileset>
</jar>
<property name="package.testNG" value="true"/>
</target>
<target name="tests.prepare" depends="emma.enable, compile.ui.shared, profile.netbeans.enable">
<echo message="Preparing for tests ..."/>
<mkdir dir="${tests.classes.dir}"/>
<mkdir dir="${tests.jar.dir}"/>
</target>
<target name="tests.compile.shared" depends="tests.prepare, jar.framework.shared, jar.storages, compile.ui.shared">
<javac-call srcdir="${tests.framework.dir}/"
destdir="${tests.classes.dir}"
includes="com/flexive/tests/shared/*.java">
<classpath>
<fileset dir="${flexive.build.framework.jar.dir}" includes="*.jar"/>
</classpath>
<classpath refid="build.classpath.testng"/>
</javac-call>
<groovyc-tests srcdir="${tests.framework.groovy.dir}" includes="com/flexive/tests/shared/**/*"/>
</target>
<target name="tests.compile.browser" depends="tests.prepare, jar.framework.shared, compile.ui.shared">
<javac-call srcdir="${tests.framework.dir}/"
destdir="${tests.classes.dir}"
includes="com/flexive/tests/browser/*.java">
<classpath>
<fileset dir="${flexive.build.framework.jar.dir}" includes="*.jar"/>
</classpath>
<!-- <src path="${src.ui.shared.dir}"/>-->
<classpath refid="build.classpath.testng"/>
</javac-call>
<copy todir="${tests.classes.dir}">
<fileset dir="${tests.framework.dir}/com/flexive/tests/browser">
<include name="*.properties"/>
</fileset>
</copy>
<!--<groovyc-tests srcdir="${tests.framework.groovy.dir}" includes="com/flexive/tests/shared/**/*"/>-->
</target>
<target name="tests.compile.ejb" depends="tests.prepare, jar.framework">
<javac-call srcdir="${tests.framework.dir}/"
destdir="${tests.classes.dir}"
includes="com/flexive/tests/embedded/**/*.java, com/flexive/tests/shared/*.java, com/flexive/tutorial/**/*.java"
excludes="com/flexive/tests/embedded/jsf/**">
<classpath refid="ejb3-embedded.classpath"/>
<classpath>
<fileset dir="${flexive.build.framework.jar.dir}" includes="*.jar"/>
</classpath>
<!-- <src path="${src.ui.shared.dir}"/>-->
</javac-call>
<groovyc-tests srcdir="${tests.framework.groovy.dir}" includes="com/flexive/tests/embedded/**/*, com/flexive/tests/shared/**/*"/>
</target>
<target name="tests.compile.jsf" depends="tests.prepare,jar.ui,tests.compile.ejb">
<javac-call srcdir="${tests.jsf.dir}/"
destdir="${tests.classes.dir}"
includes="com/flexive/tests/**/jsf/**/*.java">
<classpath refid="ejb3-embedded.classpath"/>
<classpath>
<fileset dir="${flexive.build.framework.jar.dir}" includes="*.jar"/>
<fileset dir="${build.ui.jar.dir}" includes="*.jar"/>
</classpath>
</javac-call>
<groovyc-tests srcdir="${tests.jsf.groovy.dir}" includes="com/flexive/tests/**/jsf/**/*"/>
</target>
<target name="tests.compile.dist" depends="tests.prepare, jar.framework.shared">
<javac-call srcdir="${tests.framework.dir}/"
destdir="${tests.classes.dir}"
includes="com/flexive/tests/disttools/**/*.java">
<classpath>
<fileset dir="${flexive.build.framework.jar.dir}" includes="*.jar"/>
</classpath>
<classpath refid="build.classpath.testng"/>
</javac-call>
</target>
<!-- run all tests -->
<target name="tests.all" depends="tests.all.init, tests.groups.run, emma.report" description="run all the tests"/>
<target name="tests.all.init">
<groovy>
properties.'tests.groups' = "shared,ejb,jsf,tree,dist"
//properties.'tests.groups' = "shared,ejb,configuration,content,structure,jsf,security,workflow,streaming,scripting,valuetest,cache,image,tree,relation,search,tutorial,environment,mandator,importexport,roles"
</groovy>
</target>
<!-- shared tests that don't need an EJB3 container -->
<target name="tests.shared" depends="tests.shared.run, emma.report"/>
<target name="tests.shared.run" depends="tests.compile.shared">
<runTests>
<xmlfileset dir="${tests.resources.dir}" includes="shared-tests.xml"/>
</runTests>
</target>
<target name="tests.ejb" depends="tests.ejb.run, emma.report"/>
<target name="tests.ejb.run" depends="tests.compile.ejb">
<runTests containerClasspathRef="ejb3-embedded.classpath">
<xmlfileset dir="${tests.resources.dir}" includes="ejb-tests.xml"/>
</runTests>
</target>
<target name="tests.jsf" depends="tests.jsf.run, emma.report"/>
<target name="tests.jsf.run" depends="tests.jsf.init, tests.groups.run"/>
<target name="tests.jsf.init" depends="tests.prepare,jar.ui, tests.compile.jsf">
<groovy>
properties.'tests.groups' = "jsf"
</groovy>
</target>
<target name="tests.stress" depends="tests.stress.run, emma.report"/>
<target name="tests.stress.run" depends="tests.stress.init, tests.groups.run"/>
<target name="tests.stress.init" depends="tests.prepare,tests.compile.ejb">
<groovy>
properties.'tests.groups' = "tree-stress"
</groovy>
</target>
<target name="tests.groups" depends="tests.groups.run,emma.report"/>
<target name="tests.groups.prepare">
<property name="tests.openejb.configFile" value="${flexive.openejb.dir}/openejb-tests-${database.vendor}.conf.xml"/>
<available file="${tests.openejb.configFile}" property="openEjbConfigExists"/>
<fail unless="openEjbConfigExists" message="OpenEJB configuration file (${tests.openejb.configFile}) not found. A template can be found at ${flexive.openejb.dir}/openejb-tests.conf.xml.sample."/>
</target>
<target name="tests.groups.run" depends="tests.groups.prepare, tests.compile.all, tests.package.ear, db.update.test">
<!-- Run a given test group (set via the tests.groups property, e.g. via -Dtests.groups=...) -->
<echo>Test groups can be specified in the tests.groups property,</echo>
<echo>e.g. "ant tests.groups -Dtests.groups=shared,configuration"</echo>
<groovy>
if(properties.'tests.groups' == null) {
ant.fail "Please set the tests.groups property!"
}
// build dist target only when executing the dist group
if (properties.'tests.groups'.indexOf('dist') != -1) {
project.executeTarget('dist')
properties.'run.dist.settings' = '-Dflexive.test.dist.file="' + properties.'flexive.base.build.dir' + '/flexive-dist.zip"'
}
</groovy>
<echo>Running tests in group(s): ${tests.groups}</echo>
<copy file="${tests.resources.dir}/testlog4j.xml" todir="${tests.classes.dir}"/>
<!--<property name="myclasspath" refid="ejb3-embedded.classpath"/>-->
<!--<echo>${myclasspath}</echo>-->
<testng classpathref="ejb3-embedded.classpath"
outputDir="${testng.report.dir}" groups="${tests.groups}">
<classpath>
<fileset dir="${flexive.build.framework.jar.dir}" includes="*.jar"/>
<fileset dir="${build.ui.jar.dir}" includes="*.jar"/>
<!-- include .properties -->
<path path="${build.ui.jar.dir}/WEB-INF"/>
<path path="${tests.classes.dir}"/>
</classpath>
<jvmarg value="-Dtests.users=${tests.users}"/>
<jvmarg value="-Demma.coverage.out.file=${coverage.dir}/coverage.ec"/>
<jvmarg value="-Demma.coverage.out.merge=true"/>
<jvmarg value="-Dflexive.benchmark.resultlogger=com.flexive.tests.embedded.benchmark.logger.HudsonPlotLogger"/>
<!--<jvmarg value="-Dflexive.benchmark.resultlogger=com.flexive.tests.embedded.benchmark.logger.XmlLogger"/>-->
<jvmarg value="-Dflexive.cache.shared=false"/>
<jvmarg value="-Dfxstreaming.port=18290"/>
<jvmarg line="${run.debug.settings}"/>
<jvmarg line="${run.profile.settings}"/>
<jvmarg line="${run.dist.settings}"/>
<jvmarg value="-Djava.net.preferIPv4Stack=true"/>
<!-- JDK6 classloader policy issue w/jboss5 workaround -->
<jvmarg value="-Dsun.lang.ClassLoader.allowArraySyntax=true"/>
<jvmarg value="-Xmx768m"/>
<jvmarg value="-server"/>
<!--Enable the following line for log output-->
<jvmarg value="-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger"/>
<jvmarg value="-Dlog4j.configuration=testlog4j.xml"/>
<jvmarg value="-Dcompiler.fork=true"/> <!-- Overwrite default buildfile settings for dist tests -->
<jvmarg value="-Dopenejb.home=${flexive.openejb.dir}"/>
<jvmarg value="-Dopenejb.configuration=${tests.openejb.configFile}"/>
<jvmarg value="-Dopenejb.embedded.remotable=true"/>
<classfileset dir="${tests.classes.dir}" includes="com/flexive/tests/**/*.class"/>
</testng>
<junitreport todir="${testng.report.dir}">
<fileset dir="${testng.report.dir}/${testng.suite.dir}">
<include name="*.xml"/>
</fileset>
<report format="noframes" todir="${testng.report.dir}"/>
</junitreport>
<move file="${testng.report.dir}/junit-noframes.html" tofile="${testng.report.dir}/${testng.suite.dir}/reporter-output.html" overwrite="true"/>
</target>
<target name="tests.debug.enable">
<groovy>
properties.'run.debug.settings' = properties.'debug.settings'
</groovy>
</target>
<target name="tests.emma.enable">
<property name="tests.emma.enabled" value="1"/>
</target>
<target name="tests.ejb.debug" depends="tests.compile.ejb,tests.debug.enable">
<antcall target="tests.ejb"/>
</target>
<!--
<target name="tests.disttools" depends="dist" description="Tests the disttool by creating a sample project">
<property name="flexive.test.disttools.dir" value="${flexive.base.build.dir}/disttools"/>
<delete dir="${flexive.test.disttools.dir}" failonerror="false"/>
<mkdir dir="${flexive.test.disttools.dir}"/>
<copy todir="${flexive.test.disttools.dir}/dist">
<fileset dir="${flexive.dist.dir}"/>
</copy>
</target>
-->
<target name="emma.report" description="Generate a coverage report" if="tests.emma.enabled">
<emma>
<report sourcepath="${flexive.src.framework.dir}"
sort="+block,+name,+method,+class"
metrics="method:70,block:70,line:70,class:100"
encoding="UTF-8"
>
<infileset dir="${coverage.dir}" includes="*.em, *.ec"/>
<!-- for every type of report desired, configure a nested
element; various report parameters
can be inherited from the parent <report>
and individually overridden for each report type:
-->
<txt outfile="${coverage.dir}/coverage.txt"
depth="package"
columns="class,method,block,line,name"
/>
<xml outfile="${coverage.dir}/coverage.xml"
depth="package"
/>
<html outfile="${coverage.dir}/coverage.html"
depth="method"
columns="name,class,method,block,line"
/>
</report>
</emma>
</target>
<target name="emma.fetch">
<echo message="Fetching EMMA coverage information from application server..."/>
<emma>
<ctl connect="localhost:47653">
<command name="coverage.get" args="${coverage.dir}/coverage.ec,true,true"/>
</ctl>
</emma>
</target>
<target name="emma.reset">
<echo message="Resetting EMMA coverage information on application server..."/>
<delete dir="${coverage.dir}/_files"/>
<delete file="${coverage.dir}/coverage.html"/>
<delete file="${coverage.dir}/coverage.txt"/>
<delete file="${coverage.dir}/coverage.xml"/>
<delete file="${coverage.dir}/coverage.ec"/>
<emma>
<ctl connect="localhost:47653">
<command name="coverage.reset"/>
</ctl>
</emma>
</target>
<target name="checkstyle">
<delete dir="${checkstyle.report.dir}"/>
<mkdir dir="${checkstyle.report.dir}"/>
<checkstyle config="${checkstyle.config}" failonviolation="false" failureproperty="checkstyle.failed"
>
<fileset dir="${flexive.src.framework.dir}" includes="**/*.java" excludes="**/sqlParser/**"/>
<classpath>
<fileset dir="${flexive.build.framework.jar.dir}" includes="*.jar"/>
<fileset dir="${build.ui.jar.dir}" includes="*.jar"/>
</classpath>
<!--formatter type="plain"/-->
<formatter type="xml" toFile="${checkstyle.report.dir}/checkstyle_errors.xml"/>
</checkstyle>
<style in="${checkstyle.report.dir}/checkstyle_errors.xml" style="${checkstyle.xsl}" destdir="${checkstyle.report.dir}" out="${checkstyle.report.dir}/out">
<param name="output.dir" expression="${checkstyle.report.dir}"/>
</style>
</target>
<target name="findbugs" depends="jar.all">
<delete dir="${findbugs.report.dir}"/>
<mkdir dir="${findbugs.report.dir}"/>
<findbugs output="xml:withMessages" home="${findbugs.dir}"
outputFile="${findbugs.report.dir}/out.xml" workhard="false"
excludeFilter="${findbugs.dir}/excludeFilters.xml"
timeout="1200000"
jvmargs="-Xmx768M -server" failOnError="true">
<sourcePath path="${flexive.src.framework.dir}"/>
<sourcePath path="${flexive.src.framework.dir}/storages/H2/java"/>
<sourcePath path="${flexive.src.framework.dir}/storages/MySQL/java"/>
<sourcePath path="${flexive.src.ui.jsf.dir}"/>
<sourcePath path="${flexive.src.ui.components.dir}"/>
<sourcePath path="${flexive.src.ui.shared.dir}"/>
<class location="${flexive.build.framework.jar.dir}/flexive-shared.jar"/>
<class location="${flexive.build.framework.jar.dir}/flexive-ejb.jar"/>
<class location="${flexive.build.framework.jar.dir}/flexive-storage-H2.jar"/>
<class location="${flexive.build.framework.jar.dir}/flexive-storage-MySQL.jar"/>
<class location="${build.ui.jar.dir}/flexive-backend.jar"/>
<class location="${build.ui.jar.dir}/flexive-web-shared.jar"/>
<class location="${build.ui.jar.dir}/flexive-plugin-jsf-core.jar"/>
<class location="${build.ui.jar.dir}/flexive-plugin-globalconfig.jar"/>
<auxClasspath refid="classpath.build.framework"/>
</findbugs>
<style in="${findbugs.report.dir}/out.xml" style="${findbugs.xsl}" destdir="${findbugs.report.dir}"
out="${findbugs.report.dir}/report.html">
<param name="output.dir" expression="${findbugs.report.dir}"/>
</style>
</target>
<macrodef name="runPmd">
<attribute name="reportDir"/>
<attribute name="filesetId"/>
<sequential>
<mkdir dir="@{reportDir}"/>
<pmd targetjdk="1.5" shortFilenames="true" minimumPriority="3" rulesetfiles="${pmd.dir}/rules/flexive-common.xml">
<!-- Plain HTML formatter -->
<!--formatter type="html" toFile="@{reportDir}/pmd_report.html" linkPrefix="http://pmd.sourceforge.net/xref/"/-->
<fileset refid="@{filesetId}"/>
<!-- XML formatter for XSLT processing -->
<formatter type="xml" toFile="@{reportDir}/out.xml"/>
</pmd>
<xslt in="@{reportDir}/out.xml" style="${pmd.dir}/xslt/corley-pmd-report.xslt" out="@{reportDir}/report.html" />
<xslt in="@{reportDir}/out.xml" style="${pmd.dir}/xslt/wz-pmd-report.xslt" out="@{reportDir}/report2.html" />
<copy todir="@{reportDir}">
<fileset dir="${pmd.dir}/xslt">
<include name="*.js"/>
<include name="*.css"/>
</fileset>
</copy>
</sequential>
</macrodef>
<target name="pmd">
<fileset id="framework" dir="${flexive.src.framework.dir}" includes="**/*.java" excludes="**/sqlParser/** **/extractor/htmlExtractor/**"/>
<fileset id="ui.shared" dir="${flexive.src.ui.shared.dir}" includes="**/*.java"/>
<fileset id="ui.jsf" dir="${flexive.src.ui.jsf.dir}" includes="**/*.java"/>
<runPmd reportDir="${pmd.report.dir}/framework" filesetId="framework"/>
<runPmd reportDir="${pmd.report.dir}/ui.shared" filesetId="ui.shared"/>
<runPmd reportDir="${pmd.report.dir}/ui.jsf" filesetId="ui.jsf"/>
</target>
</project>