forked from OPUS4/application
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
287 lines (244 loc) · 11.4 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="opus4server" default="build">
<property environment="env" />
<property name="workspace" value="${env.WORKSPACE}" /><!-- Wird von Jenkins gesetzt. -->
<property name="configfile" location="${workspace}/../opus-config.properties" />
<property name="libsdir" location="/home/opus4ci/libs" />
<property name="testpath" value="" />
<property name="codingstandard" location="${basedir}/vendor/opus4-repo/codesniffer/ruleset.xml" />
<property name="adminPassword" value="AdminAdmin" />
<target name="analyse-code" depends="phpcs,phpmd,phpcpd,phploc" />
<target name="build" depends="clean,prepare,lint,pdepend,analyse-code,phpdoc"
description="" />
<target name="build-parallel" depends="prepare,tools-parallel" />
<target name="build-fast" depends="clean,prepare,lint,phpunit-fast" description="" />
<target name="tools-parallel">
<parallel threadCount="2">
<sequential>
<antcall target="pdepend" />
<antcall target="phpmd" />
</sequential>
<antcall target="phpcpd" />
<antcall target="phpcs" />
<antcall target="phploc" />
<antcall target="phpdoc" />
</parallel>
</target>
<target name="clean" depends="clean-cache">
<delete dir="${basedir}/build/logs" />
<delete dir="${basedir}/build/api" />
<delete dir="${basedir}/build/coverage" />
<delete dir="${basedir}/build/pdepend" />
<delete dir="${basedir}/build/code-browser" />
<delete dir="${basedir}/build/release" />
<delete includeemptydirs="true">
<fileset dir="${basedir}/workspace/tmp" includes="**/*" />
</delete>
</target>
<target name="clean-cache">
<delete>
<fileset dir="${basedir}/workspace/cache" includes="*cache*-*" />
</delete>
<delete>
<fileset dir="${basedir}/tests/workspace/cache" includes="*cache*-*" />
</delete>
</target>
<target name="setup" depends="prepare-dependencies,prepare-javascript,prepare-config" />
<target name="prepare" depends="clean">
<mkdir dir="${basedir}/build/logs" />
<mkdir dir="${basedir}/build/coverage" />
<mkdir dir="${basedir}/build/api" />
<mkdir dir="${basedir}/build/pdepend" />
</target>
<target name="prepare-dependencies">
<exec executable="composer">
<arg value="install" />
</exec>
<exec executable="composer">
<arg value="update" />
</exec>
<symlink link="${basedir}/db/schema" resource="${basedir}/vendor/opus4-repo/framework/db/schema"
failonerror="false" />
</target>
<target name="prepare-javascript">
<mkdir dir="${basedir}/public/js" />
<symlink link="${basedir}/public/js/jquery.js" resource="${libsdir}/jquery.js" failonerror="false" />
</target>
<target name="prepare-config" description="Prepares the configuration files">
<!-- Prepare script for rebuilding database. --> <!-- TODO not really necessary anymore -->
<copy file="${basedir}/tests/rebuilding_database.sh.template"
toFile="${basedir}/tests/rebuilding_database.sh" />
<chmod file="${basedir}/tests/rebuilding_database.sh" perm="+x" />
<!-- Prepare test configuration. -->
<copy file="${basedir}/tests/config.ini.template" toFile="${basedir}/tests/config.ini" filtering="true"
overwrite="true">
<filterset filtersFile="${configfile}" />
</copy>
<!-- Prepare main configuration. Needed for scripts like SolrIndexBuilder. -->
<copy file="${basedir}/application/configs/config.ini.template"
toFile="${basedir}/application/configs/config.ini" filtering="true" overwrite="true">
<filterset filtersFile="${configfile}" />
</copy>
</target>
<target name="lint" description="Prüft, ob PHP Dateien Syntaxfehler enthalten.">
<apply executable="php" dir="${basedir}" failonerror="on" logerror="on">
<arg line="-l"/>
<fileset dir="${basedir}" followsymlinks="false">
<include name="**/*.php" />
<modified />
<exclude name="vendor/**" />
</fileset>
</apply>
</target>
<target name="phploc" description="">
<exec executable="phploc">
<arg value="--log-csv" />
<arg value="${basedir}/build/logs/phploc.csv" />
<arg path="${basedir}/modules" /> <!-- TODO library code -->
</exec>
</target>
<target name="phpdoc">
<exec executable="phpdoc" dir="${basedir}" logerror="on">
<arg value="--directory" />
<arg path="${basedir}/modules" />
<arg value="--target" />
<arg path="${basedir}/build/api" />
</exec>
</target>
<target name="phpcs">
<echo message="Coding Standard = '${codingstandard}'" />
<exec executable="phpcs" dir="${basedir}" output="${basedir}/build/logs/checkstyle.xml"
error="${basedir}/build/logs/checkstyle-error.log">
<arg value="--report=checkstyle" />
<arg value="--standard=${codingstandard}" />
<arg value="--ignore=${basedir}/Opus,${basedir}/Zend" />
<arg path="${basedir}/modules" />
<arg path="${basedir}/library" />
<arg path="${basedir}/scripts" />
</exec>
</target>
<target name="phpmd">
<exec executable="phpmd" dir="${basedir}" logerror="on" output="${basedir}/build/logs/pmd.xml" >
<arg line="--exclude tests . xml codesize,unusedcode,naming,design" />
</exec>
</target>
<target name="phpcpd">
<exec executable="phpcpd" dir="${basedir}" logerror="on" >
<arg line="--min-lines 3" />
<arg line="--min-tokens 30" />
<arg line="--log-pmd ${basedir}/build/logs/pmd-cpd.xml" />
<arg line="./library ./modules ./scripts" />
</exec>
</target>
<target name="pdepend" depends="phpunit" description="Generates software metrics charts.">
<exec executable="pdepend" dir="${basedir}" logerror="on">
<arg line="--coverage-report=${basedir}/build/logs/phpunit.coverage.xml" />
<arg line="--jdepend-xml=${basedir}/build/logs/jdepend.xml" />
<arg line="--jdepend-chart=${basedir}/build/pdepend/dependencies.svg" />
<arg line="--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg" />
<arg line="--suffix=php,phtml" />
<arg line="--coderank-mode=inheritance,property,method" />
<arg line="--ignore=tests" />
<arg line="${basedir}/library,${basedir}/modules,${basedir}/scripts" />
</exec>
</target>
<target name="phpcb" description="Aggregates tool output with PHP_CodeBrowser.">
<exec executable="phpcb">
<arg value="--log" />
<arg path="${basedir}/build/logs" />
<arg value="--source" />
<arg path="${basedir}/modules" />
<arg value="--output" />
<arg path="${basedir}/build/code-browser" />
</exec>
</target>
<target name="rebuild-database">
<exec executable="./rebuilding_database.sh" dir="${basedir}/tests" failonerror="on" />
</target>
<target name="rebuild-index">
<exec executable="php" dir="${basedir}/scripts" failonerror="on">
<arg line="SolrIndexBuilder.php" />
</exec>
</target>
<target name="phpunit" depends="rebuild-database,rebuild-index" description="Runs unit tests with coverage">
<exec executable="${basedir}/vendor/bin/phpunit" dir="${basedir}/tests" failonerror="true">
<arg line="--log-junit ${basedir}/build/logs/phpunit.xml" />
<arg line="--coverage-clover ${basedir}/build/logs/phpunit.coverage.xml" />
<arg line="--coverage-html ${basedir}/build/coverage" />
<arg line="--configuration phpunit.xml"/>
<arg line="${testpath}" />
</exec>
</target>
<target name="phpunit-fast" depends="rebuild-database,rebuild-index" description="Runs unit tests without coverage">
<exec executable="${basedir}/vendor/bin/phpunit" dir="${basedir}/tests" failonerror="true">
<arg line="--log-junit ${basedir}/build/logs/phpunit.xml" />
<arg line="--configuration phpunit.xml" />
<arg line="${testpath}" />
</exec>
</target>
<target name="demo-reset" depends="rebuild-database,demo-prepare-docs,rebuild-index,demo-reset-password">
</target>
<target name="demo-reset-password">
<exec executable="php" dir="${basedir}/scripts" failonerror="true">
<arg line="change-password.php" />
<arg line="admin" />
<arg line="${adminPassword}" />
</exec>
</target>
<target name="demo-prepare-docs">
<exec executable="php" dir="${basedir}/scripts" failonerror="true">
<arg line="opus-console.php" />
<arg line="snippets/delete_non-demo_docs.php" />
</exec>
</target>
<!--
requires: version, date, CHANGES and RELEASE_NOTES already updated
tag release
build tarball
copy, encode, commit CHANGES/RELEASE_NOTES
-->
<target name="prepare-release-check">
<condition property="runPrepareRelease">
<and>
<isset property="releaseVersion" />
<isset property="releaseTag" />
<!-- TODO check existence of tag -->
</and>
</condition>
</target>
<!-- TODO tagging: releaseDate -->
<target name="tag-release" depends="prepare-release-check" if="runPrepareRelease">
<exec executable="./tag-release.sh" dir="${basedir}/scripts/packaging">
<arg line="${releaseDate}" />
<arg line="${releaseVersion}" />
</exec>
</target>
<target name="prepare-release-notes">
<mkdir dir="${basedir}/build/release" />
<!-- prepare website files -->
<copy file="${basedir}/scripts/packaging/changelog/CHANGES.txt"
tofile="${basedir}/build/release/CHANGES.txt"
filtering="true" encoding="UTF-8" outputencoding="ISO-8859-1" />
<copy file="${basedir}/scripts/packaging/releasenotes/RELEASE_NOTES.txt"
tofile="${basedir}/build/release/RELEASE_NOTES.txt"
filtering="true" encoding="UTF-8" outputencoding="ISO-8859-1" />
</target>
<target name="prepare-release" depends="prepare-release-check" if="runPrepareRelease"
description="Builds release files (tarball, CHANGES, RELEASE_NOTES)">
<echo message="Preparing release files ..." />
<mkdir dir="${basedir}/build/release" />
<!-- build tarball -->
<exec executable="./prepare_tarball.sh" dir="${basedir}/scripts/packaging" failonerror="true">
<arg line="tags/${releaseTag}" />
<arg line="opus-${releaseVersion}" />
</exec>
<!-- Move release files to build folder. -->
<move todir="${basedir}/build/release">
<fileset dir="${basedir}/scripts/packaging">
<include name="opus-${releaseVersion}.*" />
</fileset>
</move>
<delete dir="${basedir}/scripts/packaging/opus-${releaseVersion}" />
<!-- TODO commit website files to svn -->
</target>
</project>