-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
264 lines (215 loc) · 11.5 KB
/
Copy pathbuild.xml
File metadata and controls
264 lines (215 loc) · 11.5 KB
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
<?xml version="1.0" encoding="UTF-8"?>
<project name="Phing targets" basedir="." default="">
<property file="build.properties" />
<property name="project.base-directory" value="${project.basedir}" />
<property name="project.data-subdirectory" value="data" />
<property name="project.library-subdirectory" value="library" />
<property name="project.build-subdirectory" value="build" />
<property name="project.tests-subdirectory" value="tests" />
<path id="project.class-path">
<pathelement dir="${project.library-subdirectory}" />
</path>
<fileset id="project.reportable-files" dir="${project.basedir}">
<include name="${project.project-library-subdirectory}/**/*.php" />
<include name="application/**/*.php" />
</fileset>
<taskdef name="zendproperties" classname="Bear_Phing_Task_ZendConfigPropertiesTask">
<classpath refid="project.class-path" />
</taskdef>
<zendproperties applicationEnvironment="${project.application-environment}" />
<!-- Build targets -->
<target name="build" depends="build:install" description="Build all the reports">
<phingcall target="build:api-documentation"/>
<!--<phingcall target="build:checkstyle"/>-->
<!--<phingcall target="build:code-browser"/>-->
<phingcall target="build:copy-paste-detection"/>
<phingcall target="build:dependency-analysis"/>
<!--<phingcall target="build:lines-of-code"/>-->
<phingcall target="build:project-mess-detection"/>
<phingcall target="build:unit-tests"/>
</target>
<target name="build:install">
<!--Install the build directory-->
<mkdir dir="${project.build-subdirectory}"/>
<mkdir dir="${project.build-subdirectory}/api"/>
<!--<mkdir dir="${project.build-subdirectory}/code-browser"/>-->
<mkdir dir="${project.build-subdirectory}/coverage"/>
<mkdir dir="${project.build-subdirectory}/logs"/>
<mkdir dir="${project.build-subdirectory}/pdepend"/>
</target>
<target name="build:api-documentation" depends="build:install" description="Generate API documentation">
<phpdoc title="API Documentation" destdir="${project.build-subdirectory}/api" output="HTML:Smarty:PHP" quiet="true">
<fileset refid="project.reportable-files" />
</phpdoc>
</target>
<!--<target name="build:checkstyle" depends="build:install" description="Generate a checkstyle report using PHP_CodeSniffer">-->
<!--
Broken
http://www.phing.info/trac/ticket/642 <- does not appear to have fixed problem
http://pear.php.net/bugs/bug.php?id=18247 <- appears to exist still in upstream
<phpcodesniffer standard="Zend" format="checkstyle" allowedFileExtensions="php phtml">
<fileset refid="project.reportable-files" />
<formatter type="checkstyle" outfile="${project.build-subdirectory}/logs/checkstyle.xml" />
</phpcodesniffer>
-->
<!--</target>-->
<!--<target name="build:code-browser" depends="build:install" description="Generate a code browser report with PHP_CodeBrowser">-->
<!--
Doesn't work with filesets, need workaround
NOTE: double dashes have been removed from the <exec> command so the comment would work. Add them back.
<exec command="phpcb -log ${project.build-subdirectory}/logs -source ${project.library-subdirectory} -output ${project.build-subdirectory}/code-browser" checkreturn="true" />
-->
<!--</target>-->
<target name="build:copy-paste-detection" depends="build:install" description="Generate a copy/paste detection report">
<phpcpd minTokens="25" minLines="5">
<formatter type="pmd" outfile="${project.build-subdirectory}/logs/cpd.xml" />
<fileset refid="project.reportable-files" />
</phpcpd>
</target>
<target name="build:dependency-analysis" depends="build:install" description="Generate dependency analysis report and software metric charts">
<phpdepend>
<logger type="jdepend-xml" outfile="${project.build-subdirectory}/logs/jdepend.xml" />
<logger type="jdepend-chart" outfile="${project.build-subdirectory}/pdepend/dependencies.svg" />
<logger type="overview-pyramid" outfile="${project.build-subdirectory}/pdepend/overview-pyramid.svg" />
<fileset refid="project.reportable-files" />
</phpdepend>
</target>
<!--<target name="build:lines-of-code" depends="build:install" description="Generate a lines of code report using PHPLOC">-->
<!--
Doesn't work with filesets, need workaround
NOTE: double dashes have been removed from the <exec> command so the comment would work. Add them back.
<exec command="phploc -log-csv ${project.build-subdirectory}/logs/phploc.csv ${project.library-subdirectory}" checkreturn="true" />
-->
<!--</target>-->
<target name="build:project-mess-detection" depends="build:install" description="Generate a PMD report using PHPMD">
<phpmd rulesets="codesize,design,naming,unusedcode">
<fileset refid="project.reportable-files" />
<formatter type="xml" outfile="${project.build-subdirectory}/logs/pmd.xml" />
</phpmd>
</target>
<target name="build:unit-tests" depends="build:install" description="Generate an xUnit result and code coverage report using PHPUnit">
<coverage-setup database="${project.build-subdirectory}/coverage.db">
<fileset refid="project.reportable-files" />
</coverage-setup>
<phpunit bootstrap="${project.tests-subdirectory}/bootstrap.php" codecoverage="true">
<formatter type="clover" outfile="${project.build-subdirectory}/logs/clover.xml" />
<formatter type="xml" outfile="${project.build-subdirectory}/logs/junit.xml" />
<batchtest name="Application Tests">
<fileset dir="${project.tests-subdirectory}/application">
<include name="**/*Test.php"/>
</fileset>
</batchtest>
<batchtest name="Library Tests">
<fileset dir="${project.tests-subdirectory}/library">
<include name="**/*Test.php"/>
</fileset>
</batchtest>
</phpunit>
<coverage-report outfile="${project.build-subdirectory}/coverage.db">
<report todir="${project.build-subdirectory}/coverage" />
</coverage-report>
<delete file="${project.build-subdirectory}/coverage.db"/>
</target>
<target name="build:uninstall">
<!--Uninstall the build directory-->
<delete dir="${project.build-subdirectory}"/>
</target>
<!-- Data directory targets -->
<target name="data:install">
<!--Install the data directory-->
<mkdir dir="${project.data-subdirectory}" />
<mkdir dir="${project.data-subdirectory}/logs" />
<touch file="${project.data-subdirectory}/logs/application.log" />
<touch file="${project.data-subdirectory}/logs/phperrors.log" />
<phingcall target="data:set-permissions" />
<!-- A symlink for the data directory is only necessary if the project.data-diectory it outside of the project.base-directory -->
<!-- This version of this script does not support this -->
<!--<phingcall target="data:symlink" />-->
</target>
<target name="data:set-permissions">
<!--Set the permission on the data directory-->
<!-- This would be better to give the Apache group read/write access -->
<!-- but not currently possible because user must be in Apache group to chgrp -->
<!--<exec command="chmod -R g+w ${project.data-directory}"/>-->
<!--<exec command="chgrp -R ${apache.group-name} ${project.data-directory}"/>-->
<exec command="chmod -R a+rwX ${project.data-subdirectory}"/>
</target>
<!--<target name="data:symlink" description="Setup the data directory symlinks">-->
<!--<symlink target="${project.data-directory}" link="${project.base-directory}/data" />-->
<!--</target>-->
<target name="data:uninstall">
<!--Uninstall the data directory-->
<delete dir="${project.data-subdirectory}" />
<!--<delete file="${project.base-directory}/data" />-->
</target>
<!-- Htaccess targets -->
<target name="htaccess:install">
<!--Install the htaccess file-->
<copy file="${project.base-directory}/public/.htaccess-dist" tofile="${project.base-directory}/public/.htaccess">
<filterchain>
<replacetokens>
<token key="APPLICATION_ENV" value="${project.application-environment}" />
<token key="REWRITE_BASE" value="${project.rewrite-base}" />
</replacetokens>
</filterchain>
</copy>
</target>
<target name="htaccess:uninstall">
<!--Uninstall the htaccess file-->
<delete file="${project.base-directory}/public/.htaccess" />
</target>
<!-- Report targets -->
<!--<target name="report:checkstyle" description="Run a checkstyle report using PHP_CodeSniffer">-->
<!--
Broken
http://www.phing.info/trac/ticket/642 <- does not appear to have fixed problem
http://pear.php.net/bugs/bug.php?id=18247 <- appears to exist still in upstream
<phpcodesniffer standard="Zend" format="checkstyle" allowedFileExtensions="php phtml">
<fileset refid="project.reportable-files" />
<formatter type="default" usefile="false"/>
</phpcodesniffer>
-->
<!--</target>-->
<target name="report:copy-paste-detection" description="Run a copy/paste detection using with PHPCPD">
<phpcpd minTokens="25" minLines="5">
<formatter type="default" usefile="false" />
<fileset refid="project.reportable-files" />
</phpcpd>
</target>
<!--<target name="report:lines-of-code" description="Run a lines of code report using PHPLOC">-->
<!--
Doesn't work with filesets, need workaround
<exec command="phploc ${project.library-subdirectory}" checkreturn="true" />
-->
<!--</target>-->
<target name="report:project-mess-detection" description="Run a PMD report using PHPMD">
<phpmd rulesets="codesize,design,naming,unusedcode">
<fileset refid="project.reportable-files" />
<formatter type="text" usefile="false" />
</phpmd>
</target>
<target name="report:unit-tests" description="Run the unit tests">
<phpunit bootstrap="${project.tests-subdirectory}/bootstrap.php" printsummary="true">
<formatter type="plain" usefile="false" />
<batchtest name="Application Tests">
<fileset dir="${project.tests-subdirectory}/application">
<include name="**/*Test.php" />
</fileset>
</batchtest>
<batchtest name="Library Tests">
<fileset dir="${project.tests-subdirectory}/library">
<include name="**/*Test.php"/>
</fileset>
</batchtest>
</phpunit>
</target>
<!-- Composite targets -->
<target name="install" description="Install the entire project">
<phingcall target="data:install" />
<phingcall target="htaccess:install" />
</target>
<target name="uninstall" description="Uninstall the entire project">
<phingcall target="data:uninstall" />
<phingcall target="htaccess:uninstall" />
</target>
</project>