/
build.xml
185 lines (185 loc) · 8.29 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
<?xml version="1.0"?>
<!--
*
* phpRack: Integration Testing Framework
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt. It is also available
* through the world-wide-web at this URL: http://www.phprack.com/LICENSE.txt
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@phprack.com so we can send you a copy immediately.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @copyright Copyright (c) 2009-2012 phpRack.com
* @version $Id$
* @category phpRack
*
* This Phing build file. For more information see this document:
* http://phing.info/docs/guide/current/
*
-->
<project name="phpRack tests" basedir="." default="main">
<tstamp/>
<includepath classpath="${project.basedir}"/>
<includepath classpath="${project.basedir}/test/"/>
<php expression="ini_set('memory_limit', '128M');"/>
<property name="package.name" value="phpRack-stable"/>
<property name="build.tgz" value="${project.basedir}/build/${package.name}.tgz"/>
<target name="main" depends="lint, jslint, phpcs, phpmd, test, zca, jscoverage, doc">
</target>
<exec command="git log -n 1 --pretty=format:%h" outputproperty="git.hash"/>
<target name="clean" description="Remove all build-related files">
<delete dir="${project.basedir}/build"/>
</target>
<target name="lint" description="Run syntax check for all classes">
<phplint haltonfailure="yes" level="verbose">
<fileset dir="${project.basedir}/src">
<include name="**/*.php"/>
<include name="**/*.html"/>
<include name="**/*.phtml"/>
</fileset>
</phplint>
</target>
<target name="jslint" description="Validate syntax in all JS files">
<!--
<jsllint haltonfailure="true">
<fileset dir="${project.basedir}">
<include name="**/index.js"/>
<exclude name="build/**"/>
</fileset>
</jsllint>
-->
</target>
<target name="phpcs" description="Validate the quality of PHP code with PHPCS utility">
<exec command="${project.basedir}/vendor/squizlabs/php_codesniffer/scripts/phpcs
-n
--report=full
--standard=Zend
--extensions='php,phtml'
${project.basedir}/src" escape="false" checkreturn="true" passthru="true"/>
</target>
<target name="phpmd" description="PHP Mess Detector (PHPMD)">
<exec command="${project.basedir}/vendor/phpmd/phpmd/src/bin/phpmd
${project.basedir}/src
text
codesize,unusedcode
--extensions='php,phtml'" escape="false" checkreturn="true" passthru="true"/>
</target>
<target name="zca" description="Zend Code Analyzer">
<zendcodeanalyzer analyzerPath="zca" haltonwarning="true">
<fileset dir="${project.basedir}/src">
<include name="**/*.php"/>
<include name="**/*.phtml"/>
</fileset>
</zendcodeanalyzer>
</target>
<target name="jscoverage" description="JSCoverage">
<exec command="jscoverage
-v
--exclude=.svn
--exclude=jquery-1.4.2.min.js
${project.basedir}/src/phpRack/layout/js
${project.basedir}/build/instrumented-js" escape="false" checkreturn="true" passthru="true"/>
</target>
<target name="test" description="Run all existing unit-tests">
<mkdir dir="${project.basedir}/build"/>
<property name="coverage.database" value="${project.basedir}/build/coverage.data"/>
<coverage-setup database="${coverage.database}">
<fileset dir="${project.basedir}/src/phpRack">
<include name="**/*.php"/>
</fileset>
</coverage-setup>
<phpunit printsummary="yes" haltonerror="yes" haltonfailure="yes" codecoverage="true">
<formatter type="plain" usefile="no"/>
<batchtest>
<fileset dir="${project.basedir}/src/test">
<include name="**/*Test*.php"/>
<exclude name="**/Abstract*.php"/>
<exclude name="**/_*.php"/>
<exclude name="**/integration-tests/**"/>
</fileset>
</batchtest>
</phpunit>
<mkdir dir="${project.basedir}/build/coverage"/>
<coverage-report outfile="${project.basedir}/build/coverage.xml">
<report todir="${project.basedir}/build/coverage"/>
</coverage-report>
<coverage-threshold database="${coverage.database}" perProject="65" perClass="0" perMethod="0"/>
<delete file="${coverage.database}"/>
</target>
<target name="package" description="Package the product into TGZ">
<tar destfile="${build.tgz}" compression="gzip">
<fileset dir="${project.basedir}/src">
<include name="phpRack/**"/>
<include name="LICENSE.txt"/>
</fileset>
</tar>
</target>
<target name="doc" description="Generate phpDocumentor files">
<php expression="define('PHPRACK_PATH', '${project.basedir}/src/phpRack');"/>
<php expression="set_error_handler(create_function('', 'return true;'));"/>
<phpdoc title="API Documentation, rev.${git.hash}" destdir="${project.basedir}/build/apidocs" sourcecode="false" quiet="true" output="HTML:frames:default">
<fileset dir="${project.basedir}/phpRack">
<include name="**/*.php"/>
</fileset>
<projdocfileset dir=".">
<include name="README.txt"/>
<include name="LICENSE.txt"/>
</projdocfileset>
</phpdoc>
</target>
<target name="deploy" description="Deploy stable TGZ by FTP and other files">
<property file="${project.basedir}/../external.properties"/>
<mkdir dir="${project.basedir}/build/ftp-upload"/>
<copy todir="${project.basedir}/build/ftp-upload">
<filterchain>
<stripwhitespace/>
</filterchain>
<fileset dir="${project.basedir}/src">
<include name="phpRack/**"/>
</fileset>
<fileset dir="${project.basedir}/src/test">
<include name="integration-tests/**"/>
</fileset>
</copy>
<copy todir="${project.basedir}/build/ftp-upload/public">
<fileset dir="${project.basedir}/phprack.com">
<include name="**/*"/>
<exclude name=".svn/**"/>
</fileset>
<fileset dir="${project.basedir}/src/phpRack/layout">
<include name="logo.png"/>
</fileset>
<fileset dir="${project.basedir}/src/">
<include name="LICENSE.txt"/>
</fileset>
</copy>
<copy todir="${project.basedir}/build/ftp-upload/public/api">
<fileset dir="${project.basedir}/build/apidocs">
<include name="**/*"/>
</fileset>
</copy>
<copy todir="${project.basedir}/build/ftp-upload/public/coverage">
<fileset dir="${project.basedir}/build/coverage">
<include name="**/*"/>
</fileset>
</copy>
<echo message="uploading PHP code to the server..."/>
<ftpdeploy host="${ftp.host}" username="${ftp.username}" password="${ftp.password}" clearfirst="true" port="${ftp.port}" passive="true">
<fileset dir="${project.basedir}/build/ftp-upload"/>
</ftpdeploy>
</target>
</project>