forked from Qafoo/QualityAnalyzer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparallel.xml
139 lines (123 loc) · 5.77 KB
/
parallel.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
<?xml version="1.0" encoding="UTF-8"?>
<project name="Qafoo Quality Analyzer - Example Build File" basedir="../../" default="analyze">
<!--
Include local project properties.
-->
<property file="${basedir}/environment.local" />
<property file="${basedir}/environment" />
<property name="logdir" value="${basedir}/qa-analyzer-log" />
<property name="bindir" value="${basedir}/vendor/bin" />
<property name="phpunit.config" value="${basedir}/phpunit.xml" />
<property name="phpcs.coding.standard" value="PSR-2" />
<property name="phpmd.rules" value="cleancode,codesize,design" />
<target name="prepare">
<fail unless="srcdir">
No source dir specified. Pass using `ant -Dsrcdir=src/` or configure it in `environment.local`.
</fail>
<delete dir="${logdir}"/>
<mkdir dir="${logdir}" />
</target>
<target name="phpunit" depends="prepare">
<exec executable="${bindir}/phpunit" failonerror="false" dir="${basedir}">
<arg value="--configuration" />
<arg value="${phpunit.config}" />
<arg value="--coverage-clover" />
<arg value="${logdir}/clover.xml" />
<arg value="--log-junit" />
<arg value="${logdir}/junit.xml" />
</exec>
</target>
<target name="pdepend" depends="prepare, phpunit">
<condition property="pdepend.coverage.report" value="--coverage-report=${logdir}/clover.xml" else="">
<resourceexists>
<file file="${logdir}/clover.xml"/>
</resourceexists>
</condition>
<exec executable="${bindir}/pdepend" failonerror="false" dir="${basedir}">
<arg value="--dependency-xml=${logdir}/dependencies.xml" />
<arg value="--summary-xml=${logdir}/summary.xml" />
<arg value="--coderank-mode=inheritance,property,method" />
<arg line="${pdepend.coverage.report}" />
<arg value="${srcdir}" />
</exec>
</target>
<target name="phpmd" depends="prepare">
<exec executable="${bindir}/phpmd" failonerror="false" resultproperty="phpmd.return-value" dir="${basedir}">
<arg line="--reportfile" />
<arg line="${logdir}/phpmd.xml" />
<arg value="${srcdir}" />
<arg value="xml" />
<arg value="${phpmd.rules}" />
</exec>
</target>
<target name="checkstyle" depends="prepare">
<exec executable="${bindir}/phpcs" failonerror="false" dir="${basedir}">
<arg value="--standard=${coding.standard}" />
<arg value="--extensions=php" />
<arg value="--report-checkstyle=${logdir}/checkstyle.xml" />
<arg value="${srcdir}" />
</exec>
</target>
<target name="phpcpd" depends="prepare">
<exec executable="${bindir}/phpcpd" failonerror="false" dir="${basedir}">
<arg value="--log-pmd" />
<arg value="${logdir}/cpd.xml" />
<arg value="${srcdir}" />
</exec>
</target>
<target name="phploc" depends="prepare">
<exec executable="${bindir}/phploc" failonerror="false" dir="${basedir}">
<arg value="--count-tests" />
<arg value="--log-xml=${logdir}/loc.xml" />
<arg value="${srcdir}" />
</exec>
</target>
<target name="parallel" depends="phpunit">
<parallel>
<antcall target="pdepend" />
<antcall target="phpmd" />
<antcall target="checkstyle" />
<antcall target="phpcpd" />
<antcall target="phploc" />
</parallel>
</target>
<target name="analyze" depends="parallel">
<condition property="analyze.coverage" value="--coverage=${logdir}/clover.xml" else="">
<resourceexists><file file="${logdir}/clover.xml"/></resourceexists>
</condition>
<condition property="analyze.pdepend" value="--pdepend=${logdir}/summary.xml" else="">
<resourceexists><file file="${logdir}/clover.xml"/></resourceexists>
</condition>
<condition property="analyze.dependencies" value="--dependencies=${logdir}/dependencies.xml" else="">
<resourceexists><file file="${logdir}/clover.xml"/></resourceexists>
</condition>
<condition property="analyze.phpmd" value="--phpmd=${logdir}/phpmd.xml" else="">
<resourceexists><file file="${logdir}/clover.xml"/></resourceexists>
</condition>
<condition property="analyze.tests" value="--tests=${logdir}/junit.xml" else="">
<resourceexists><file file="${logdir}/clover.xml"/></resourceexists>
</condition>
<condition property="analyze.cpd" value="--cpd=${logdir}/cpd.xml" else="">
<resourceexists><file file="${logdir}/clover.xml"/></resourceexists>
</condition>
<condition property="analyze.checkstyle" value="--checkstyle=${logdir}/checkstyle.xml" else="">
<resourceexists><file file="${logdir}/clover.xml"/></resourceexists>
</condition>
<condition property="analyze.phploc" value="--phploc=${logdir}/loc.xml" else="">
<resourceexists><file file="${logdir}/clover.xml"/></resourceexists>
</condition>
<exec executable="${basedir}/bin/analyze" failonerror="true" dir="${basedir}">
<arg line="${analyze.coverage}" />
<arg line="${analyze.pdepend}" />
<arg line="${analyze.dependencies}" />
<arg line="${analyze.phpmd}" />
<arg line="${analyze.tests}" />
<arg line="${analyze.cpd}" />
<arg line="${analyze.checkstyle}" />
<arg line="${analyze.phploc}" />
<arg value="analyze" />
<arg value="${srcdir}" />
</exec>
<delete dir="${logdir}"/>
</target>
</project>