forked from aws/aws-sdk-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
193 lines (169 loc) · 8.95 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
<?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>
<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" />
</then>
<else>
<exec passthru="true" command="phpunit -c phpunit.functional.xml" />
</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="phar" description="Create a phar with an autoloader">
<phingcall target="test-init" />
<pharpackage destfile="build/aws.phar" stub="build/phar-stub.php" basedir=".">
<fileset dir=".">
<!-- Add AWS classes -->
<include name="src/**/*.php" />
<include name="src/**/*.json" />
<include name="src/**/*.xml" />
<!-- Include the Symfony2 class loader component -->
<include name="vendor/symfony/class-loader/Symfony/Component/ClassLoader/UniversalClassLoader.php" />
<!-- Install Guzzle and its dependencies -->
<include name="vendor/guzzle/guzzle/src/**/*.php" />
<include name="vendor/guzzle/guzzle/**/*.pem" />
<include name="vendor/symfony/event-dispatcher/**/*.php" />
<include name="vendor/doctrine/common/lib/Doctrine/Common/Cache/*.php" />
<include name="vendor/monolog/monolog/src/**/*.php" />
</fileset>
<metadata>
<element name="link" value="${sdk_url}" />
</metadata>
</pharpackage>
<exec command="php -d aws_phar=aws.phar `which phpunit`" passthru="true" />
</target>
<target name="composer-init" description="Downloads a local copy of composer.phar if necessary">
<if>
<available file="composer.phar" />
<then>
<echo>Composer is installed</echo>
</then>
<else>
<echo message="Installing composer" />
<exec command="curl -s http://getcomposer.org/installer | php" passthru="true" />
<exec command="php composer.phar install --dev" passthru="true" />
</else>
</if>
</target>
<target name="test-init" description="Initialize test dependencies" depends="composer-init">
<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" depends="composer-init" description="Updates Composer dependencies">
<exec command="php composer.phar update --dev" passthru="true" />
</target>
<target name="coverage">
<mkdir dir="${dir.output}/logs" />
<exec passthru="true" command="phpunit --coverage-html=${dir.output}/coverage --coverage-clover=${dir.output}/logs/clover.xml" />
</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"/>
<target name="update-regions" description="Downloads a new copy of the AWS regions and endpoints file used by the SDK">
<echo message="Downloading a new copy of http://aws-sdk-configurations.amazonwebservices.com/endpoints.xml to src/Aws/Common/Resources/endpoints.xml" />
<delete file="src/Aws/Common/Resources/endpoints.xml" />
<exec command="curl -s -S -o endpoints.xml http://aws-sdk-configurations.amazonwebservices.com/endpoints.xml" dir="src/Aws/Common/Resources" passthru="true"/>
<exec command="dos2unix endpoints.xml" dir="src/Aws/Common/Resources" passthru="true"/>
</target>
</project>