forked from OPUS4/framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
214 lines (189 loc) · 9.28 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="opus4framework" default="build">
<property environment="env" />
<property name="configfile" location="${basedir}/../opus-config.properties" />
<property name="libsdir" value="/home/opus4ci/libs" />
<property name="testpath" value="" />
<property name="codingstandard" location="${basedir}/vendor/opus4-repo/codesniffer/ruleset.xml" />
<property name="bindir" value="${basedir}/vendor/bin" />
<property name="solrVersion" value="7.6.0" />
<property name="downloadDir" value="${basedir}/downloads" />
<!-- Properties for configuration files (tests/config.ini) used for testing. -->
<property name="dbName" value="opusdb" />
<property name="dbUserName" value="opus4admin" />
<property name="dbUserPassword" value="" />
<property name="dbAdminName" value="opus4" />
<property name="dbAdminPassword" value="" />
<property name="solrDefaultHost" value="localhost" />
<property name="solrDefaultPort" value="8983" />
<property name="solrDefaultPath" value="/solr/opus4" />
<property name="solrIndexHost" value="localhost" />
<property name="solrIndexPort" value="8983" />
<property name="solrIndexPath" value="/solr/opus4" />
<property name="solrExtractHost" value="localhost" />
<property name="solrExtractPort" value="8983" />
<property name="solrExtractPath" value="/solr/opus4" />
<target name="analyse-code" depends="phpcs,phpmd,phpcpd,phploc" />
<target name="build" depends="prepare,lint,analyse-code,pdepend,phpdoc,phpcb" />
<target name="build-fast" depends="prepare,lint,phpunit-fast"/>
<target name="clean">
<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 includeEmptyDirs="true">
<fileset dir="${basedir}/tests/workspace/cache" includes="**/*" />
</delete>
<delete includeEmptyDirs="true">
<fileset dir="${basedir}/tests/workspace/tmp" includes="**/*" />
</delete>
<delete includeEmptyDirs="true">
<fileset dir="${basedir}/tests/workspace" />
</delete>
</target>
<target name="prepare-workspace">
<mkdir dir="${basedir}/tests/workspace/cache" />
<mkdir dir="${basedir}/tests/workspace/tmp" />
<mkdir dir="${basedir}/tests/workspace/log" />
<mkdir dir="${basedir}/tests/workspace/files" />
</target>
<target name="setup" depends="prepare-dependencies,prepare-workspace,prepare-config"
description="Prepares the configuration." />
<target name="prepare-config">
<copy file="${basedir}/tests/config.ini.template" toFile="${basedir}/tests/config.ini" filtering="true"
overwrite="true">
<filterset>
<filter token="db.user.name" value="${dbUserName}" />
<filter token="db.user.password" value="${dbUserPassword}" />
<filter token="db.admin.name" value="${dbAdminName}" />
<filter token="db.admin.password" value="${dbAdminPassword}" />
<filter token="db.name" value="${dbName}" />
<filter token="searchengine.default.host" value="${solrDefaultHost}" />
<filter token="searchengine.default.port" value="${solrDefaultPort}" />
<filter token="searchengine.default.path" value="${solrDefaultPath}" />
<filter token="searchengine.index.host" value="${solrIndexHost}" />
<filter token="searchengine.index.port" value="${solrIndexPort}" />
<filter token="searchengine.index.app" value="${solrIndexPath}" />
<filter token="searchengine.extract.host" value="${solrExtractHost}" />
<filter token="searchengine.extract.port" value="${solrExtractPort}" />
<filter token="searchengine.extract.app" value="${solrExtractPath}" />
</filterset>
</copy>
</target>
<target name="prepare-dependencies">
<exec executable="${basedir}/bin/install-composer.sh" dir="${basedir}" failonerror="on" />
</target>
<target name="prepare" depends="clean,prepare-workspace,prepare-dependencies">
<mkdir dir="${basedir}/build/logs" />
<mkdir dir="${basedir}/build/api" />
<mkdir dir="${basedir}/build/coverage" />
<mkdir dir="${basedir}/build/pdepend" />
<mkdir dir="${basedir}/build/code-browser" />
</target>
<target name="lint">
<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="Measure project size using 'phploc'.">
<exec executable="${bindir}/phploc" dir="${basedir}">
<arg value="--log-csv" />
<arg value="${basedir}/build/logs/phploc.csv" />
<arg value="./library" />
</exec>
</target>
<target name="phpdoc">
<exec executable="${bindir}/phpdoc" dir="${basedir}" logerror="on">
<arg value="--directory" />
<arg path="${basedir}/library" />
<arg value="--target" />
<arg path="${basedir}/build/api" />
</exec>
</target>
<target name="phpcs">
<echo message="Coding Standard = '${codingstandard}'" />
<exec executable="${bindir}/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 path="${basedir}/library" />
</exec>
</target>
<target name="phpmd">
<exec executable="${bindir}/phpmd" dir="${basedir}" logerror="on" output="${basedir}/build/logs/pmd.xml" >
<arg line="library" />
<arg line="xml" />
<arg line="codesize,unusedcode,naming,design" />
</exec>
</target>
<target name="phpcpd">
<exec executable="${bindir}/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" />
</exec>
</target>
<target name="pdepend" depends="phpunit" description="Generates software metrics charts.">
<exec executable="${bindir}/pdepend" dir="${basedir}" logerror="on">
<arg value="--coverage-report=${basedir}/build/logs/phpunit.coverage.xml" />
<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 value="--suffix=php,phtml" />
<arg value="--coderank-mode=inheritance,property,method" />
<arg value="--ignore=tests" />
<arg value="${basedir}/library" />
</exec>
</target>
<target name="phpcb" description="Aggregates tool output with PHP_CodeBrowser.">
<exec executable="${bindir}/phpcb">
<arg value="--log" />
<arg path="${basedir}/build/logs" />
<arg value="--source" />
<arg path="${basedir}/library" />
<arg value="--output" />
<arg path="${basedir}/build/code-browser" />
</exec>
</target>
<target name="create-database">
<exec executable="php" dir="${basedir}/db" failonerror="on">
<arg line="createdb.php" />
</exec>
</target>
<target name="phpunit" depends="create-database">
<exec executable="${bindir}/phpunit" dir="${basedir}/tests" failonerror="on">
<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 value="${testpath}" />
</exec>
</target>
<target name="phpunit-fast" depends="create-database">
<tstamp />
<exec executable="${bindir}/phpunit" dir="${basedir}/tests" failonerror="on">
<arg line="--log-junit ${basedir}/build/logs/phpunit.xml" />
<arg line="--configuration phpunit.xml" />
<arg value="${testpath}" />
<redirector output="build/testresult-${DSTAMP}-${TSTAMP}.txt" alwayslog="true" />
</exec>
</target>
<target name="download-solr">
<mkdir dir="${downloadDir}" />
<get src="https://archive.apache.org/dist/lucene/solr/${solrVersion}/solr-${solrVersion}.tgz"
dest="${downloadDir}/solr-${solrVersion}.tgz"
skipexisting="true" />
<exec executable="tar" dir="${downloadDir}">
<arg line="xfz" />
<arg line="solr-${solrVersion}.tgz" />
<arg line="-C ${basedir}" />
</exec>
</target>
</project>