-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
193 lines (168 loc) · 6.32 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
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model
href="/usr/share/php5/PEAR/data/phing/etc/phing-grammar.rng"
type="application/xml"
schematypens="http://relaxng.org/ns/structure/1.0" ?>
<!-- The build file used to check EWay. -->
<project name="EWay" default="build">
<!-- Build properties. -->
<property name="project.build"
description="The directory for the build information."
value="${project.basedir}/build"/>
<property name="project.config"
description="The directory for build configuration."
value="${project.build}/config"/>
<property name="project.reports"
description="Build report directory"
value="${project.build}/reports"/>
<property name="project.source"
description="The directory for the PHP source files."
value="${project.basedir}/src"/>
<property name="project.test"
description="The directory for the PHP test files."
value="${project.basedir}/test"/>
<!-- File sets used in targets. -->
<fileset id="src" dir="${project.source}">
<include name="**/*.php"/>
</fileset>
<fileset id="tst" dir="${project.test}">
<include name="EWay/**/*.php"/>
</fileset>
<!-- Main Target definitions -->
<target name="build"
description="Check for code quality produce reports on it."
depends="check-build-sanity,
clean,
environment-setup,
create-reports"/>
<target name="check-build-sanity"
description="Check to see whether a build can be made."
depends="lint-src,lint-test"/>
<target name="clean"
description="Remove all of the build artefacts.">
<if>
<available file="${project.reports}" type="dir"/>
<then>
<delete dir="${project.reports}"/>
</then>
</if>
</target>
<target name="environment-setup"
description="Setup the environment for the build.">
<composer composer="/usr/bin/composer" command="update"/>
<if>
<not>
<available file="${project.reports}" type="dir"/>
</not>
<then>
<mkdir dir="${project.reports}"/>
</then>
</if>
</target>
<target name="create-reports"
description="Create reports on the build."
depends="environment-setup,
loc,
code-sniffer,
copy-paste-detector,
depend,
documentor,
mess-detector,
unit"/>
<!-- Sub Target definitions -->
<target name="code-sniffer"
description="Detect coding standard violations. Output to the Command line.">
<phpcodesniffer standard="PSR2">
<formatter type="checkstyle" outfile="${project.reports}/code-sniffer-checkstyle.xml"/>
<fileset refid="src"/>
</phpcodesniffer>
</target>
<target name="copy-paste-detector">
<phpcpd>
<fileset refid="src"/>
<formatter type="pmd" outfile="${project.reports}/copy-paste-detector.xml"/>
</phpcpd>
</target>
<target name="depend"
depends="clean, unit"
description="Calculate software metrics using PHP_Depend">
<phpdepend>
<fileset refid="src"/>
<logger type="jdepend-chart"
outfile="${project.reports}/depend-chart"/>
<logger type="jdepend-xml"
outfile="${project.reports}/depend.xml"/>
<logger type="overview-pyramid"
outfile="${project.reports}/depend-overview-pyramid"/>
<logger type="summary-xml"
outfile="${project.reports}/depend-summary.xml"/>
</phpdepend>
</target>
<target name="documentor"
description="Generate or update API documentation using phpDocumentor">
<if>
<not>
<available file="${project.reports}/doc" type="dir"/>
</not>
<then>
<mkdir dir="${project.reports}/doc"/>
</then>
</if>
<phpdoc2
defaultPackageName="EWay"
destdir = "${project.reports}/doc"
title="Evoke-PHP/EWay">
<fileset refid = "src"/>
</phpdoc2>
</target>
<target name="lint-src"
description="Syntax check the php source files.">
<phplint deprecatedAsError="true">
<fileset refid="src"/>
</phplint>
</target>
<target name="lint-test"
description="Syntax check the php test files.">
<phplint deprecatedAsError="true">
<fileset refid="tst"/>
</phplint>
</target>
<target name="loc"
description="Measure project size using PHPLOC">
<phploc countTests="true"
reportDirectory="${project.reports}"
reportName="loc"
reportType="csv">
<fileset refid="src"/>
<fileset refid="tst"/>
</phploc>
</target>
<target name="mess-detector"
depends="clean"
description="Perform project mess detection using PHPMD and print human readable output. Intended for usage
on the command line before committing.">
<phpmd rulesets="codesize,controversial,design,naming,unusedcode">
<fileset refid="src"/>
<formatter type="xml" outfile="${project.reports}/mess-detector.xml"/>
</phpmd>
</target>
<target name="unit"
depends="clean"
description="Run unit tests with PHPUnit">
<composer composer="/usr/bin/composer" command="update">
<arg value="-d ${project.test}"/>
</composer>
<exec executable="phpunit" passthru="true">
<arg value="-c"/>
<arg file="${project.config}/unit.xml"/>
</exec>
</target>
<target name="unit-quick"
depends=""
description="Run unit tests with PHPUnit without logging">
<exec executable="phpunit" passthru="true">
<arg value="-c"/>
<arg file="${project.config}/unit-quick.xml"/>
</exec>
</target>
</project>