forked from ruflin/Elastica
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
executable file
·190 lines (169 loc) · 5.37 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="Elastica" default="build" basedir=".">
<property name="source" value="${basedir}/lib"/>
<target name="parallelTasks">
<parallel threadCount="2">
<sequential>
<antcall target="pdepend"/>
<antcall target="phpmd-ci"/>
</sequential>
<antcall target="phpcpd"/>
<antcall target="phpcs-ci"/>
<antcall target="docblox"/>
<antcall target="phpcb"/>
</parallel>
</target>
<target name="clean" description="Cleanup build artifacts">
<delete dir="${basedir}/build/api"/>
<delete dir="${basedir}/build/code-browser"/>
<delete dir="${basedir}/build/coverage"/>
<delete dir="${basedir}/build/logs"/>
<delete dir="${basedir}/build/pdepend"/>
<delete file="${basedir}/cache.properties"/>
</target>
<target name="prepare" depends="clean" description="Prepare for build">
<mkdir dir="${basedir}/build/api"/>
<mkdir dir="${basedir}/build/code-browser"/>
<mkdir dir="${basedir}/build/coverage"/>
<mkdir dir="${basedir}/build/logs"/>
<mkdir dir="${basedir}/build/pdepend"/>
</target>
<target name="lint">
<apply executable="php" failonerror="true">
<arg value="-lf"/>
<fileset dir="${source}">
<include name="**/*.php"/>
<modified/>
</fileset>
<fileset dir="${basedir}/test">
<include name="**/*.php"/>
<modified/>
</fileset>
</apply>
</target>
<target name="phpunit" depends="prepare">
<exec executable="phpunit" dir="${basedir}/test" failonerror="off" />
</target>
<!-- Generate jdepend.xml and software metrics charts -->
<target name="pdepend">
<exec executable="pdepend">
<arg value="--jdepend-xml=${basedir}/build/logs/jdepend.xml" />
<arg value="--jdepend-chart=${basedir}/build/pdepend/dependencies.svg" />
<arg value="--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg" />
<arg path="${source}" />
</exec>
</target>
<target name="phpmd-ci">
<exec executable="phpmd">
<arg path="${source}" />
<arg value="xml" />
<arg value="codesize,unusedcode,naming,design" />
<arg value="--reportfile" />
<arg value="${basedir}/build/logs/pmd.xml" />
</exec>
</target>
<!-- Generate pmd-cpd.xml -->
<target name="phpcpd">
<exec executable="phpcpd">
<arg line="--log-pmd ${basedir}/build/logs/pmd-cpd.xml ${source}" />
</exec>
</target>
<!-- Generate checkstyle.xml -->
<target name="phpcs-ci">
<exec executable="phpcs" output="/dev/null">
<arg line="--report=checkstyle --report-file=${basedir}/build/logs/checkstyle.xml --standard=${basedir}/test/CodeSniffer/Standards/Xodoa ${source}" />
</exec>
</target>
<target name="phploc" description="Generate phploc.csv">
<exec executable="phploc">
<arg value="--log-csv" />
<arg value="${basedir}/build/logs/phploc.csv" />
<arg path="${source}" />
</exec>
</target>
<!-- Generate API documentation -->
<target name="docblox">
<exec executable="docblox">
<arg line="run" />
</exec>
</target>
<target name="phpcb">
<exec executable="phpcb">
<arg line="--log ${basedir}/build/logs
--source ${source}
--output ${basedir}/build/code-browser" />
</exec>
</target>
<target name="build" depends="prepare,lint,parallelTasks,phpunit"/>
<!-- Checkstyle with human output -->
<target name="phpcs">
<exec executable="phpcs">
<arg line="--standard=${basedir}/test/CodeSniffer/Standards/Xodoa ${source}" />
</exec>
</target>
<target name="phpmd" description="Perform phpmd with human readable output">
<exec executable="phpmd">
<arg path="${source}"/>
<arg value="text"/>
<arg value="codesize,unusedcode,naming,design" />
<arg value="${basedir}/build/phpmd.xml"/>
</exec>
</target>
<!-- Setups test environment -->
<target name="setup" description="setups php libs for">
<exec executable="pear">
<arg line="channel-discover pear.pdepend.org" />
</exec>
<exec executable="pear">
<arg line="channel-discover pear.phpmd.org" />
</exec>
<exec executable="pear">
<arg line="channel-discover pear.phpunit.de" />
</exec>
<exec executable="pear">
<arg line="channel-discover components.ez.no" />
</exec>
<exec executable="pear">
<arg line="channel-discover pear.symfony-project.com" />
</exec>
<exec executable="pear">
<arg line="channel-discover pear.michelf.com" />
</exec>
<exec executable="pear">
<arg line="channel-discover pear.docblox-project.org" />
</exec>
<exec executable="pear">
<arg line="install pdepend/PHP_Depend" />
</exec>
<exec executable="pear">
<arg line="install phpmd/PHP_PMD" />
</exec>
<exec executable="pear">
<arg line="install phpunit/phpcpd" />
</exec>
<exec executable="pear">
<arg line="install phpunit/phploc" />
</exec>
<exec executable="pear">
<arg line="install --alldeps channel://pear.docblox-project.org/DocBlox-0.15.1" />
</exec>
<exec executable="pear">
<arg line="install PHP_CodeSniffer" />
</exec>
<exec executable="pear">
<arg line="install --alldeps phpunit/PHP_CodeBrowser" />
</exec>
<exec executable="pear">
<arg line="install --alldeps phpunit/PHPUnit" />
</exec>
</target>
<target name="gource" description="Visualize repos with gource">
<exec executable="gource">
<arg line="--log-format git" />
<arg line="--seconds-per-day 0.1" />
<arg line="--title 'Elastica (https://github.com/ruflin/Elastica)'" />
<arg line="--user-scale 1" />
<arg line="--max-user-speed 50" />
</exec>
</target>
</project>