-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
211 lines (187 loc) · 8.08 KB
/
build.xml
File metadata and controls
211 lines (187 loc) · 8.08 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
<?xml version="1.0" encoding="UTF-8"?>
<!-- build/clean.xml -->
<!-- http://joshuaestes.me/post/31732961725/symfony2-continuous-integration-with-jenkins-ant-and -->
<project name="project" default="build-parallel">
<target name="build"
depends="clean, git, prepare, lint, phploc, pdepend, phpmd-ci, phpcs-ci, phpcpd, symfony.test-all"/>
<target name="build-parallel" depends="clean, git, prepare">
<parallel threadCount="7">
<antcall target="lint" />
<antcall target="phploc" />
<antcall target="pdepend" />
<antcall target="phpmd-ci" />
<antcall target="phpcs-ci" />
<antcall target="phpcpd" />
<antcall target="symfony.test-all" />
</parallel>
</target>
<target name="clean"
description="Cleanup build artifacts">
<delete dir="${basedir}/build/api"/>
<delete dir="${basedir}/build/code-browser"/>
<delete dir="${basedir}/build/coverage"/>
<delete dir="${basedir}/build/logs"/>
<delete dir="${basedir}/build/pdepend"/>
<antcall target="symfony.clean" />
</target>
<target name="symfony.clean"
description="Cleans up symfony data">
<!--<delete file="${basedir}/composer.phar" />-->
<delete file="${basedir}/app/config/parameters.yml" />
<delete dir="${basedir}/app/cache" />
</target>
<target name="git"
depends="clean"
description="Updates submodules">
<exec executable="git">
<arg value="submodule"/>
<arg value="update"/>
<arg value="--init"/>
<arg value="--recursive"/>
</exec>
</target>
<target name="prepare"
depends="clean"
description="Prepare for build">
<mkdir dir="${basedir}/build/api"/>
<mkdir dir="${basedir}/build/code-browser"/>
<mkdir dir="${basedir}/build/coverage"/>
<mkdir dir="${basedir}/build/logs"/>
<mkdir dir="${basedir}/build/pdepend"/>
<antcall target="symfony.prepare" />
</target>
<target name="check-composer">
<available file="composer.phar" property="composer.present"/>
</target>
<target name="install-composer" depends="check-composer" unless="composer.present">
<exec executable="bash">
<arg value="-c" />
<arg value="curl -s http://getcomposer.org/installer | php" />
</exec>
</target>
<target name="symfony.prepare" depends="install-composer">
<exec executable="php">
<arg value="composer.phar" />
<arg value="update" />
</exec>
<!-- change db setup to use different schema for jenkins runs -->
<exec executable="bash">
<arg value="-c" />
<arg value=" cat ${basedir}/Tests/Resources/config/config_jenkins.yml >> ${basedir}/Tests/Resources/config/config_test.yml" />
</exec>
</target>
<target name="lint"
description="Syntax check">
<apply executable="php" failonerror="true">
<arg value="-l" />
<fileset dir="${basedir}/">
<exclude name="vendor/" />
<exclude name="Tests/" />
<include name="**/*.php" />
</fileset>
</apply>
</target>
<target name="phploc" description="Measure project size using PHPLOC">
<exec executable="phploc">
<arg value="--log-csv" />
<arg value="${basedir}/build/logs/phploc.csv" />
<arg path="${basedir}/" />
</exec>
</target>
<target name="pdepend" description="Calculate software metrics using PHP_Depend">
<exec executable="pdepend">
<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="--ignore=${basedir}/Tests,${basedir}/Resources,${basedir}/vendor,${basedir}/Model/map,${basedir}/Model/om" />
<arg path="${basedir}" />
</exec>
</target>
<target name="phpcpd" description="Find duplicate code using PHPCPD">
<exec executable="phpcpd">
<arg value="--log-pmd" />
<arg value="${basedir}/build/logs/pmd-cpd.xml" />
<!-- <arg value="- -exclude" />
<arg value="${basedir}/app" />
<arg value="- -exclude" />
<arg value="${basedir}/vendor" />-->
<arg value="--exclude" />
<arg value="Model/map" />
<arg value="--exclude" />
<arg value="Model/om" />
<arg value="--exclude" />
<arg value="DependencyInjection" />
<arg value="--exclude" />
<arg value="Tests" />
<arg value="--exclude" />
<arg value="vendor" />
<arg path="${basedir}" />
</exec>
</target>
<target name="phpcs"
description="Find coding standard violations using PHP_CodeSniffer and print human readable output. Intended for usage on the command line before committing.">
<exec executable="phpcs">
<arg value="--standard=${basedir}/build/phpcs.xml" />
<arg value="--ignore=${basedir}/vendor/*,${basedir}/Tests" />
<arg path="${basedir}/" />
</exec>
</target>
<target name="phpcs-ci" description="Find coding standard violations using PHP_CodeSniffer creating a log file for the continuous integration server">
<exec executable="phpcs" output="/dev/null">
<arg value="--report=checkstyle" />
<arg value="--report-file=${basedir}/build/logs/checkstyle.xml" />
<arg value="--standard=${basedir}/build/phpcs.xml" />
<arg value="--ignore=${basedir}/vendor/*,${basedir}/Tests,${basedir}/Resources" />
<!--<arg value="- -ignore=${basedir}/vendor/*,${basedir}/app/*,${basedir}/web/*,*.js,*.css" />-->
<arg path="${basedir}" />
</exec>
</target>
<target name="phpmd"
description="Perform project mess detection using PHPMD and print human readable output. Intended for usage on the command line before committing.">
<exec executable="phpmd">
<arg path="${basedir}/" />
<arg value="text" />
<arg value="${basedir}/build/phpmd.xml" />
<arg value="--exclude"/>
<arg value="vendor,Tests,Resources,Model/map,Model/om" />
</exec>
</target>
<target name="phpmd-ci" description="Perform project mess detection using PHPMD creating a log file for the continuous integration server">
<exec executable="phpmd">
<arg path="${basedir}/" />
<arg value="xml" />
<arg value="${basedir}/build/phpmd.xml" />
<arg value="--reportfile" />
<arg value="${basedir}/build/logs/pmd.xml" />
<arg value="--exclude"/>
<arg value="vendor,Tests,Resources,Model/map,Model/om" />
</exec>
</target>
<target name="phpdox" description="Generate API documentation using phpDox">
<exec executable="phpdox"/>
</target>
<target name="phpcb" description="Aggregate tool output with PHP_CodeBrowser">
<exec executable="phpcb">
<arg value="--log" />
<arg path="${basedir}/build/logs" />
<arg value="--source" />
<arg path="${basedir}/src" />
<arg value="--output" />
<arg path="${basedir}/build/code-browser" />
</exec>
</target>
<target name="symfony.test-all"
description="Runs all the functional and unit test">
<exec executable="phpunit"
failonerror="false">
<arg value="-c" />
<arg value="phpunit-jenkins.xml.dist" />
</exec>
</target>
<target name="symfony.test-only"
description="Runs all the functional and unit tests, but no code coverage">
<exec executable="phpunit"
failonerror="false">
</exec>
</target>
</project>