-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpmd.xml
executable file
·86 lines (66 loc) · 2.36 KB
/
pmd.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
<!--
This ant build file checks source code for potential
maintainability issues using PMD (http://pmd.sourceforge.net).
Usage:
ant -Dpmd.home=.../pmd-1.5 -f pmd.xml
-->
<project name="dynamator" default="pmd">
<!-- user-defined configuration -->
<property name="configuration.file" value="build.properties"/>
<property file="${user.home}/dynamator.build.properties" />
<property file="${user.home}/build.properties" />
<property file="${basedir}/${configuration.file}" />
<!-- destination directories -->
<property name="dir.build" location="${basedir}/build"/>
<property name="file.pmd-errors"
location="${dir.build}/pmd.errors"/>
<path id="classpath.pmd">
<fileset dir="${pmd.home}/lib">
<include name="*.jar"/>
</fileset>
</path>
<taskdef name="pmd"
classname="net.sourceforge.pmd.ant.PMDTask"
classpathref="classpath.pmd"/>
<taskdef name="propertyregexp"
classname="net.sf.antcontrib.property.RegexTask"/>
<target name="check-preconditions">
<available property="preconditions.satisfied"
classname="net.sourceforge.pmd.Rule"
classpathref="classpath.pmd"/>
</target>
<target name="preconditions"
depends="check-preconditions"
unless="preconditions.satisfied">
<fail>
PMD not found in classpath.
Property 'pmd.home' = '${pmd.home}'.</fail>
</target>
<target name="pmd"
depends="preconditions">
<delete file="${file.pmd-errors}" quiet="true"/>
<pmd rulesetfiles="${basedir}/ruleset.pmd">
<formatter type="text" toFile="${file.pmd-errors}"/>
<fileset dir=".">
<include name="src/**/*.java"/>
<include name="languages/**/*.java"/>
<include name="tools/**/*.java"/>
<exclude name="**/test/**"/>
</fileset>
</pmd>
<available file="${file.pmd-errors}" property="pmd.found.errors"/>
<antcall target="pmd-errors"/>
</target>
<target name="pmd-errors"
if="pmd.found.errors">
<antcall target="compilify"/>
<fail message="PMD found errors; see ${file.pmd-errors}"/>
</target>
<target name="compilify">
<replaceregexp file="${file.pmd-errors}"
match="^([^\s]+)\s+(\d+)"
replace="\1(\2):"
byline="true"
/>
</target>
</project>