forked from aws/aws-sdk-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
254 lines (221 loc) · 10.3 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="aws-sdk-for-php" default="test">
<property name="dir.output" value="${project.basedir}/build/artifacts" />
<property name="coverage" value="false" />
<property name="mock" value="false" />
<property name="min" value="false" />
<property name="sdk_url" value="http://aws.amazon.com/sdkforphp2" />
<fileset id="src_files" dir="${project.basedir}/src" includes="**/*.php" />
<target name="test" description="Run unit tests" depends="test-init">
<exec passthru="true" command="vendor/bin/phpunit" />
</target>
<target name="integration" description="Run integration tests">
<if>
<isset property="service" />
<then>
<property name="testpath" value="tests/Aws/Tests/${service}" />
</then>
<else>
<property name="testpath" value="" />
</else>
</if>
<if>
<available file="phpunit.functional.xml" />
<then>
<if>
<equals arg1="${mock}" arg2="true" />
<then>
<echo>php -d mock=true `which phpunit` -c phpunit.functional.xml</echo>
<exec passthru="true" command="php -d mock=true `which phpunit` -c phpunit.functional.xml ${testpath}" />
</then>
<else>
<exec passthru="true" command="phpunit -c phpunit.functional.xml ${testpath}" />
</else>
</if>
</then>
<else>
<fail>You must copy phpunit.functional.dist to phpunit.functional.xml and modify the appropriate property settings</fail>
</else>
</if>
</target>
<target name="create-staging" description="Creates a staging directory for zip and phar creation">
<delete dir="${dir.output}/staging" failonerror="false" quiet="true"/>
<mkdir dir="${dir.output}/staging"/>
<mkdir dir="${dir.output}/staging/Aws"/>
<mkdir dir="${dir.output}/staging/Guzzle"/>
<mkdir dir="${dir.output}/staging/Doctrine/Common/Cache"/>
<mkdir dir="${dir.output}/staging/Symfony"/>
<mkdir dir="${dir.output}/staging/Monolog"/>
<patternset id="sdk-files">
<include name="**/*.php" />
<include name="**/*.pem" />
<include name="**/*.md5" />
<include name="**/LICENSE*" />
</patternset>
<!-- Copy AWS deps -->
<copy file="${project.basedir}/build/aws-autoloader.php" tofile="${dir.output}/staging/aws-autoloader.php"/>
<copy todir="${dir.output}/staging">
<fileset dir="src">
<patternset refid="sdk-files"/>
</fileset>
</copy>
<copy file="${project.basedir}/LICENSE.md" tofile="${dir.output}/staging/Aws/LICENSE.md"/>
<copy file="${project.basedir}/NOTICE.md" tofile="${dir.output}/staging/Aws/NOTICE.md"/>
<!-- Copy Symfony dependencies -->
<copy todir="${dir.output}/staging">
<fileset dir="vendor/symfony/event-dispatcher">
<include name="**/*.php" />
</fileset>
</copy>
<copy todir="${dir.output}/staging">
<fileset dir="vendor/symfony/class-loader">
<include name="**/*.php" />
</fileset>
</copy>
<!-- Copy Guzzle deps -->
<copy todir="${dir.output}/staging">
<fileset dir="vendor/guzzle/guzzle/src">
<patternset refid="sdk-files"/>
</fileset>
</copy>
<!-- Copy Monolog deps -->
<copy todir="${dir.output}/staging">
<fileset dir="vendor/monolog/monolog/src">
<patternset refid="sdk-files"/>
</fileset>
</copy>
<!-- Copy PSR deps -->
<copy todir="${dir.output}/staging">
<fileset dir="vendor/psr/log">
<include name="**/*.php" />
</fileset>
</copy>
<!-- Copy Doctrine deps -->
<copy todir="${dir.output}/staging">
<fileset dir="vendor/doctrine/cache/lib">
<patternset refid="sdk-files"/>
</fileset>
</copy>
</target>
<target name="phar" depends="create-staging" description="Create a phar with an autoloader">
<pharpackage destfile="build/aws.phar" stub="build/phar-stub.php" basedir="${dir.output}/staging">
<fileset dir="${dir.output}/staging">
<include name="**/**"/>
</fileset>
<metadata>
<element name="link" value="${sdk_url}" />
</metadata>
</pharpackage>
</target>
<target name="zip" depends="create-staging" description="Create a ZIP file containing the SDK and its dependencies">
<zip destfile="build/aws.zip" basedir="${dir.output}/staging">
<fileset dir="${dir.output}/staging">
<include name="**/**"/>
</fileset>
</zip>
</target>
<target name="test-init" description="Initialize test dependencies">
<copy file="phpunit.xml.dist" tofile="phpunit.xml" overwrite="false" />
<copy file="phpunit.functional.xml.dist" tofile="phpunit.functional.xml" overwrite="false" />
<copy file="test_services.json.dist" tofile="test_services.json" overwrite="false" />
</target>
<target name="clean" description="Deletes build artifacts">
<delete dir="${dir.output}"/>
</target>
<target name="prepare" depends="clean,test-init">
<mkdir dir="${dir.output}"/>
<mkdir dir="${dir.output}/logs" />
</target>
<target name="clean-dependencies" description="Deletes all dependencies downloaded by Composer">
<delete dir="${project.basedir}/vendor"/>
<delete file="composer.lock" />
</target>
<target name="update-dependencies" description="Updates Composer dependencies">
<exec command="php composer.phar update --dev" passthru="true" />
</target>
<target name="coverage">
<if>
<isset property="service" />
<then>
<property name="testpath" value="tests/Aws/Tests/${service}" />
</then>
<else>
<property name="testpath" value="" />
</else>
</if>
<mkdir dir="${dir.output}/logs" />
<exec passthru="true" command="phpunit --coverage-html=${dir.output}/coverage --coverage-clover=${dir.output}/logs/clover.xml ${testpath}" />
</target>
<target name="view-coverage">
<exec passthru="true" command="open ${dir.output}/coverage/index.html" />
</target>
<target name="phpdepend">
<delete dir="${dir.output}/pdepend" includeemptydirs="true" verbose="true" failonerror="true" />
<mkdir dir="${dir.output}/pdepend" />
<phpdepend>
<fileset refid="src_files" />
<analyzer type="coderank-mode" value="method"/>
<logger type="jdepend-chart" outfile="${dir.output}/pdepend/jdepend-chart.svg" />
<logger type="overview-pyramid" outfile="${dir.output}/pdepend/overview-pyramid.svg" />
<logger type="jdepend-chart" outfile="${dir.output}/pdepend/jdepend-chart.png" />
<logger type="overview-pyramid" outfile="${dir.output}/pdepend/overview-pyramid.png" />
<logger type="jdepend-xml" outfile="${dir.output}/pdepend/jdepend.xml" />
<logger type="phpunit-xml" outfile="${dir.output}/pdepend/phpunit.xml" />
<logger type="summary-xml" outfile="${dir.output}/pdepend/summary.xml" />
</phpdepend>
</target>
<target name="phpcs">
<delete dir="${dir.output}/phpcs" includeemptydirs="true" verbose="true" failonerror="true" />
<mkdir dir="${dir.output}/phpcs" />
<!-- <phpcodesniffer></phpcodesniffer> -->
</target>
<target name="phpmd">
<delete dir="${dir.output}/phpmd" includeemptydirs="true" verbose="true" failonerror="true" />
<mkdir dir="${dir.output}/phpmd" />
<phpmd>
<fileset refid="src_files" />
<formatter type="html" outfile="${dir.output}/phpmd/phpmd.html"/>
<formatter type="xml" outfile="${dir.output}/phpmd/phpmd.xml"/>
</phpmd>
</target>
<target name="phpcpd">
<delete dir="${dir.output}/phpcpd" includeemptydirs="true" verbose="true" failonerror="true" />
<mkdir dir="${dir.output}/phpcpd" />
<phpcpd>
<fileset refid="src_files" />
<formatter type="pmd" outfile="${dir.output}/phpcpd/pmd.xml" />
<formatter type="default" outfile="${dir.output}/phpcpd/default.xml" />
</phpcpd>
</target>
<target name="phploc">
<exec command="phploc --log-csv ${dir.output}/logs/phploc.csv ." dir="${project.basedir}/src" passthru="true" />
</target>
<target name="phplint">
<phplint>
<fileset refid="src_files" />
</phplint>
</target>
<target name="phpcb" description="Aggregate tool output with PHP_CodeBrowser">
<exec executable="phpcb">
<arg value="--log" />
<arg path="${dir.output}/logs" />
<arg value="--source" />
<arg path="${project.basedir}/src" />
<arg value="--output" />
<arg path="${dir.output}/code-browser" />
</exec>
</target>
<target name="install-build-deps">
<exec command="pear install --alldeps pear.phpunit.de/PHPUnit" passthru="true" />
<exec command="pear install --alldeps phpunit/PHP_CodeBrowser" passthru="true" />
<exec command="pear install --alldeps phpunit/phploc" passthru="true" />
<exec command="pear install --alldeps pear.pdepend.org/PHP_Depend-beta" passthru="true" />
<exec command="pear install --alldeps pear.phpmd.org/PHP_PMD" passthru="true" />
<exec command="pear install --alldeps pear.phpunit.de/phpcpd" passthru="true" />
<exec command="pear install --alldeps PHP_CodeSniffer" passthru="true" />
<exec command="pear install --alldeps pear.phing.info/phing" passthru="true" />
</target>
<target name="all" depends="clean, prepare, test-init, build, report"/>
<target name="build" depends="phplint, prepare, test-init, test, phar"/>
<target name="report" depends="coverage, phploc, phpcs, phpmd, phpcpd, phpdepend, phpcb"/>
</project>