-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
289 lines (257 loc) · 13.8 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
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
<?xml version="1.0" encoding="UTF-8"?>
<project name="DbSync Toolkit" default="build" basedir=".">
<property name="appDir" value="${basedir}/DbSync" />
<property name="buildDir" value="${basedir}/build" />
<property name="logsDir" value="${buildDir}/logs" />
<property name="htmlDir" value="${buildDir}/html" />
<target name="cleanup">
<delete dir="${buildDir}" />
</target>
<target name="prepare" depends="cleanup">
<mkdir dir="${buildDir}" />
<mkdir dir="${logsDir}" />
<mkdir dir="${htmlDir}/docs" />
<mkdir dir="${htmlDir}/phpcb" />
<mkdir dir="${htmlDir}/coverage" />
<mkdir dir="${htmlDir}/phpunit" />
</target>
<target name="phploc" description="Tool for quickly measuring the size of a PHP project" depends="prepare">
<exec dir="${basedir}" executable="phploc" failonerror="false" osfamily="unix" output="${logsDir}/phploc.log">
<arg line="--count-tests" />
<arg line="--log-xml ${logsDir}/phploc.xml" />
<arg line="${appDir}" />
</exec>
<exec dir="${basedir}" executable="cmd" failonerror="false" osfamily="windows" output="${logsDir}\phploc.log">
<arg line="/c phploc.bat" />
<arg line="--count-tests" />
<arg line="--log-xml ${logsDir}\phploc.xml" />
<arg line="${appDir}" />
</exec>
<echo message="##teamcity[publishArtifacts '${logsDir}/phploc.xml']" />
<echo message="##teamcity[publishArtifacts '${logsDir}/phploc.log']" />
</target>
<target name="phpcpd" description="Copy/Paste Detector" depends="prepare">
<exec dir="${basedir}" executable="phpcpd" failonerror="false" osfamily="unix" output="${logsDir}/phpcpd.log">
<arg line="--log-pmd ${logsDir}/phpcpd.xml" />
<arg line="${appDir}" />
</exec>
<exec dir="${basedir}" executable="cmd" failonerror="false" osfamily="windows" output="${logsDir}\phpcpd.log">
<arg line="/c phpcpd.bat" />
<arg line="--log-pmd ${logsDir}\phpcpd.xml" />
<arg line="${appDir}" />
</exec>
<echo message="##teamcity[importData type='pmdCpd' path='${logsDir}/phpcpd.xml']"/>
<echo message="##teamcity[publishArtifacts '${logsDir}/phpcpd.log']" />
<echo message="##teamcity[publishArtifacts '${logsDir}/phpcpd.xml']" />
</target>
<target name="pmd" depends="prepare">
<exec executable="phpmd" dir="${basedir}/">
<arg line="application
xml codesize,unusedcode,naming
--reportfile '${logsDir}/pmd.xml'"/>
</exec>
</target>
<target name="phpmd" description="PHP Mess Detector" depends="prepare">
<property name="pmd" value="${logsDir}/phpmd.xml" />
<exec dir="${basedir}" executable="phpmd" failonerror="false" osfamily="unix">
<arg line="${appDir}" />
<arg line="xml" />
<arg line="naming,unusedcode,codesize" />
<arg line="--reportfile ${pmd}" />
</exec>
<exec dir="${basedir}" executable="cmd" failonerror="false" osfamily="windows">
<arg line="/c phpmd.bat" />
<arg line="${appDir}" />
<arg line="xml" />
<arg line="naming,unusedcode,codesize" />
<arg line="--reportfile ${pmd}" />
</exec>
<echo message="##teamcity[importData type='pmd' path='${pmd}']"/>
</target>
<target name="phpcs" description="PHP_CodeSniffer" depends="prepare">
<exec dir="${basedir}" executable="phpcs" failonerror="false" osfamily="unix" output="${logsDir}/phpcs.log">
<arg line="--tab-width=4" />
<arg line="--report=checkstyle" />
<arg line="--standard=Zend" />
<arg line="--report-file=${logsDir}/phpcs.xml" />
<arg line="${appDir}" />
</exec>
<exec dir="${basedir}" executable="cmd" failonerror="false" osfamily="windows" output="${logsDir}\phpcs.log">
<arg line="/c phpcs.bat" />
<arg line="--tab-width=4" />
<arg line="--report=checkstyle" />
<arg line="--standard=PEAR" />
<arg line="--report-file=${logsDir}\phpcs.xml" />
<arg line="${appDir}" />
</exec>
<echo message="##teamcity[publishArtifacts '${logsDir}/phpcs.xml']" />
<echo message="##teamcity[importData type='checkstyle' path='${logsDir}/phpcs.xml']" />
<echo message="##teamcity[publishArtifacts '${logsDir}/phpcs.log']" />
</target>
<target name="phpdoc" description="PhpDocumentor" depends="prepare">
<!--
@todo Use useconfig argument.
-->
<exec dir="${basedir}" executable="phpdoc" failonerror="false" osfamily="unix">
<arg line="--directory ${appDir}" />
<arg line="--target ${htmlDir}/phpdoc" />
<arg line="--quiet off" />
<arg line="--undocumentedelements on" />
<arg line="--title Collector Rest Service" />
<arg line="--parseprivate on" />
<arg line="--output HTML:Smarty:PHP" />
<arg line="--sourcecode on" />
</exec>
<exec dir="${basedir}" executable="cmd" failonerror="false" osfamily="windows">
<arg line="/c phpdoc.bat" />
<arg line="--directory ${appDir}" />
<arg line="--target ${htmlDir}\phpdoc" />
<arg line="--quiet off" />
<arg line="--undocumentedelements on" />
<arg line="--title Collector Rest Service" />
<arg line="--parseprivate on" />
<arg line="--output HTML:Smarty:PHP" />
<arg line="--sourcecode on" />
</exec>
<zip destfile="${htmlDir}/phpdoc.zip" basedir="${htmlDir}/phpdoc" />
<echo message="##teamcity[publishArtifacts '${htmlDir}/phpdoc.zip']" />
<delete dir="${htmlDir}/phpdoc"/>
</target>
<target name="doxygen" description="Doxygen" depends="prepare">
<exec dir="${basedir}" executable="doxygen" failonerror="false" osfamily="unix" output="${logsDir}/doxygen.log">
</exec>
<zip destfile="${htmlDir}/docs.zip" basedir="${htmlDir}/docs/html"/>
<echo message="##teamcity[publishArtifacts '${htmlDir}/docs.zip']" />
</target>
<target name="download" description="Create build for download and sharing without not needed files" depends="checkout, phpunit">
<tstamp/>
<exec dir="${basedir}" executable="zip" failonerror="true" osfamily="unix" output="${logsDir}/download.log">
<arg line="-r '${buildDir}/dbSync-${DSTAMP}.zip'"/>
<arg line="DbSync"/>
<arg line="dependencies"/>
<arg line="phpdbsync.ini.example"/>
<arg line="data.sh"/>
<arg line="schema.sh"/>
<arg line="trigger.sh"/>
<arg line="dbsync.sh"/>
<arg line="init.php"/>
<arg line="index.php"/>
<arg line="LICENSE.txt"/>
<arg line="README.txt"/>
</exec>
</target>
<target name="phar-download" description="Create build for download and sharing without not needed files" depends="prepare">
<tstamp/>
<copy todir="${buildDir}/phar/DbSync">
<fileset dir="${basedir}/DbSync"/>
</copy>
<copy todir="${buildDir}/phar/dependencies">
<fileset dir="${basedir}/dependencies"/>
</copy>
<copy file="${basedir}/LICENSE.txt" todir="${buildDir}/phar" />
<copy file="${basedir}/README.txt" todir="${buildDir}/phar" />
<copy file="${basedir}/index.php" todir="${buildDir}/phar" />
<copy file="${basedir}/init.php" todir="${buildDir}/phar" />
<copy file="${basedir}/phpdbsync.ini.example" todir="${buildDir}/phar" />
<exec dir="${buildDir}" executable="php" failonerror="true" osfamily="unix" output="${logsDir}/phar.log">
<arg line="${basedir}/pharBuilder.php"/>
</exec>
<move file="${buildDir}/dbsync.phar" tofile="${buildDir}/dbsync-${DSTAMP}.phar"/>
</target>
<target name="update-doc" description="Doxygen" depends="prepare, doxygen">
<exec dir="${basedir}" executable="doxygen" failonerror="false" osfamily="unix" output="${logsDir}/doxygen.log">
</exec>
<copy todir="${basedir}/docs">
<fileset dir="${htmlDir}/docs"/>
</copy>
</target>
<target name="phpunit" depends="prepare" description="PHPUnit">
<mkdir dir="${logsDir}/coverage"/>
<property name="junit" value="${logsDir}/tests-report.xml" />
<exec executable="phpunit" dir="${basedir}/tests" failonerror="false" osfamily="unix" output="${logsDir}/phpunit.log">
<arg line="--log-junit '${logsDir}/tests-report.xml'"/>
<arg line="--coverage-clover '${logsDir}/phpunit.clover.xml'"/>
<arg line="--coverage-html '${htmlDir}/coverage'"/>
<arg line="."/>
</exec>
<exec dir="${basedir}\tests" executable="cmd" failonerror="false" osfamily="windows" output="${logsDir}\phpunit.log">
<arg line="/c phpunit.bat" />
<arg line="--log-junit '${logsDir}\tests-report.xml'"/>
<arg line="--coverage-clover '${logsDir}\phpunit.clover.xml'"/>
<arg line="--coverage-html '${htmlDir}\coverage'"/>
<arg line="."/>
</exec>
<echo message="##teamcity[importData type='junit' path='${junit}']" />
<zip destfile="${htmlDir}/coverage.zip" basedir="${htmlDir}/coverage"/>
<echo message="##teamcity[publishArtifacts '${htmlDir}/coverage.zip']" />
</target>
<target name="phpdcd" description="PHP Dead Code Detector" depends="prepare">
<exec dir="${appDir}" executable="phpdcd" failonerror="false" osfamily="unix" output="${logsDir}/phpdcd.log">
<arg line="--recursive" />
<arg line="${appDir}" />
</exec>
<exec dir="${appDir}" executable="cmd" failonerror="false" osfamily="windows" output="${logsDir}\phpdcd.log">
<arg line="/c phpdcd.bat" />
<arg line="--recursive" />
<arg line="${appDir}" />
</exec>
<echo message="##teamcity[publishArtifacts '${logsDir}/phpdcd.log']" />
</target>
<target name="phpcb" description="PHP_CodeBrowser" depends="prepare, phpunit">
<exec dir="${basedir}" executable="phpcb" failonerror="false" osfamily="unix">
<arg line="--log ${logsDir}" />
<arg line="--source ${appDir}" />
<arg line="--output ${htmlDir}/phpcb" />
</exec>
<exec dir="${basedir}" executable="cmd" failonerror="false" osfamily="windows">
<arg line="/c phpcb.bat" />
<arg line="--log ${logsDir}" />
<arg line="--source ${appDir}" />
<arg line="--output ${htmlDir}\phpcb" />
</exec>
<zip destfile="${htmlDir}/phpcb.zip" basedir="${htmlDir}/phpcb" />
<echo message="##teamcity[publishArtifacts '${htmlDir}/phpcb.zip']" />
<delete dir="${htmlDir}/phpcb"/>
</target>
<target name="pdepend" description="PHP_Depend" depends="prepare">
<!--
@todo Use configuration=<file> argument.
-->
<exec dir="${basedir}" executable="pdepend" failonerror="false" osfamily="unix" output="${logsDir}/pdepend.log">
<arg line="--jdepend-chart=${logsDir}/pdepend.jdepend.chart.svg"/>
<arg line="--jdepend-xml=${logsDir}/pdepend.jdepend.xml"/>
<arg line="--overview-pyramid=${logsDir}/pdepend.overview.pyramid.svg"/>
<arg line="--phpunit-xml=${logsDir}/pdepend.phpunit.xml"/>
<arg line="--summary-xml=${logsDir}/pdepend.summary.xml"/>
<arg line="--coverage-report=${logsDir}/phpunit.clover.xml"/>
<arg line="--coderank-mode=inheritance,property,method"/>
<arg line="${appDir}"/>
</exec>
<exec dir="${basedir}" executable="cmd" failonerror="false" osfamily="windows" output="${logsDir}\pdepend.log">
<arg line="/c pdepend.bat" />
<arg line="--jdepend-chart=${logsDir}\pdepend.jdepend.chart.svg"/>
<arg line="--jdepend-xml=${logsDir}\pdepend.jdepend.xml"/>
<arg line="--overview-pyramid=${logsDir}\pdepend.overview.pyramid.svg"/>
<arg line="--phpunit-xml=${logsDir}\pdepend.phpunit.xml"/>
<arg line="--summary-xml=${logsDir}\pdepend.summary.xml"/>
<arg line="--coverage-report=${logsDir}\phpunit.clover.xml"/>
<arg line="--coderank-mode=inheritance,property,method"/>
<arg line="${appDir}"/>
</exec>
<echo message="##teamcity[publishArtifacts '${logsDir}/pdepend.jdepend.chart.svg']" />
<echo message="##teamcity[publishArtifacts '${logsDir}/pdepend.jdepend.xml']" />
<echo message="##teamcity[publishArtifacts '${logsDir}/pdepend.overview.pyramid.svg']" />
<echo message="##teamcity[publishArtifacts '${logsDir}/pdepend.phpunit.xml']" />
<echo message="##teamcity[publishArtifacts '${logsDir}/pdepend.summary.xml']" />
<echo message="##teamcity[publishArtifacts '${logsDir}/phpunit.clover.xml']" />
</target>
<target name="checkout" description="Update directory with new version from server and overwrite all conflicts with files from server" depends="prepare">
<exec executable="svn" failonerror="true" output="${logsDir}/svn.log">
<arg line="up" />
<arg line="--force" />
<arg line="--accept theirs-full" />
</exec>
<echo message="##teamcity[publishArtifacts '${logsDir}/svn.log']" description="Import detailed svn log to TeamCity"/>
</target>
<target name="build" depends="phpunit, phploc, phpcb, phpcs, pdepend, phpcpd, phpmd, doxygen" />
</project>