-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcommon.xml
159 lines (142 loc) · 8.56 KB
/
common.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
<?xml version="1.0"?>
<!DOCTYPE project>
<project name="common">
<!-- initialize ENV variable -->
<property environment="env" />
<!-- initialize the common properties -->
<property name="php-src.dir" value="${basedir}/src" />
<property name="php-test.dir" value="${basedir}/tests" />
<property name="php-target.dir" value="${basedir}/target"/>
<property name="unique.name" value="${codepool}/${ant.project.name}" />
<!-- initialize file based common properties -->
<property file="${build.dir}/common.default.properties"/>
<property file="${build.dir}/common.${os.family}.properties"/>
<!-- ==================================================================== -->
<!-- Deletes the directory with the generated artefacts -->
<!-- ==================================================================== -->
<target name="clean" description="Deletes the directory with the generated artefacts.">
<delete dir="${php-target.dir}" includeemptydirs="true" quiet="false" verbose="true" failonerror="true"/>
</target>
<!-- ==================================================================== -->
<!-- Prepares the directory to temporarily store generated artefacts -->
<!-- ==================================================================== -->
<target name="prepare" description="Prepares the directory to temporarily store generated artefacts.">
<!-- clean the build environment -->
<antcall target="clean" />
<!-- create the default build environment folders -->
<mkdir dir="${php-target.dir}" />
<mkdir dir="${php-target.dir}/reports" />
</target>
<!-- ==================================================================== -->
<!-- Copies the sources to the temporary directory -->
<!-- ==================================================================== -->
<target name="copy" description="Copies the sources to the temporary directory.">
<!-- prepare the build environment -->
<antcall target="prepare" />
<!-- copy the source files -->
<copy todir="${php-target.dir}/${unique.name}/src" preservelastmodified="true" overwrite="true">
<fileset dir="${php-src.dir}">
<include name="**/*" />
</fileset>
</copy>
</target>
<!-- ==================================================================== -->
<!-- Copies the sources to the deploy directory -->
<!-- ==================================================================== -->
<target name="deploy" description="Copies the sources to the deploy directory.">
<!-- copy the files to the target directory -->
<antcall target="copy" />
<!-- copy the files to the deploy directory -->
<copy todir="${deploy.dir}" preservelastmodified="true" overwrite="true">
<fileset dir="${php-target.dir}">
<include name="**/*"/>
</fileset>
</copy>
</target>
<!-- ==================================================================== -->
<!-- Runs the code sniffer and generates a report -->
<!-- ==================================================================== -->
<target name="phpcs" description="Runs the code sniffer and generates a report.">
<exec executable="${vendor.dir}/bin/phpcs" dir="${basedir}" failonerror="true">
<arg line="-n --report-full --report-checkstyle=${php-target.dir}/reports/phpcs.xml --extensions=php --standard=${coding.standard} ${phpcs-additional.args} ."/>
</exec>
</target>
<!-- ==================================================================== -->
<!-- Runs the copy and paste detection -->
<!-- ==================================================================== -->
<target name="phpcpd" description="Runs the copy and paste detection.">
<exec executable="${vendor.dir}/bin/phpcpd" dir="${basedir}" failonerror="true">
<arg line="--log-pmd ${php-target.dir}/reports/pmd-cpd.xml ${phpcpd-additional.args} ${phpcpd-src.dir}"/>
</exec>
</target>
<!-- ==================================================================== -->
<!-- Generate phploc.csv -->
<!-- ==================================================================== -->
<target name="phploc" description="Generate phploc.csv">
<exec executable="${vendor.dir}/bin/phploc" dir="${basedir}" failonerror="true">
<arg line="--log-xml ${php-target.dir}/reports/phploc.xml --exclude ${phploc-exclude.dir} ${phploc-src.dir}"/>
</exec>
</target>
<!-- ==================================================================== -->
<!-- Runs the PHPDepend tool and generats a graphs -->
<!-- ==================================================================== -->
<target name="pdepend" description="Runs the PHPDepend tool and generats a graphs.">
<exec executable="${vendor.dir}/bin/pdepend" dir="${basedir}" failonerror="true">
<arg line="--summary-xml=${php-target.dir}/reports/pdepend.xml
--jdepend-xml=${php-target.dir}/reports/jdepend.xml
--jdepend-chart=${php-target.dir}/reports/jdepend.svg
--overview-pyramid=${php-target.dir}/reports/pdepend-pyramid.svg
--ignore=${pdepend-ignore.dir}
${pdepend-src.dir}" />
</exec>
</target>
<!-- ==================================================================== -->
<!-- Runs the PHP mess detector tool -->
<!-- ==================================================================== -->
<target name="phpmd" description="Runs the PHP Mess detector tool.">
<exec executable="${vendor.dir}/bin/phpmd" dir="${basedir}" failonerror="false">
<arg line="${phpmd-src.dir} xml ${phpmd.standard} --exclude ${phpmd-exclude.dir} --reportfile ${php-target.dir}/reports/pmd.xml" />
</exec>
</target>
<!-- ==================================================================== -->
<!-- Runs a PHP lint syntax check on the PHP source files -->
<!-- ==================================================================== -->
<target name="phplint" description="Runs a PHP lint syntax check on the PHP source files.">
<apply executable="php" failonerror="true">
<arg value="-l" />
<fileset dir="${phplint-src.dir}"
includes="${phplint-include.dir}"
excludes="${phplint-exclude.dir}"/>
</apply>
</target>
<!-- ==================================================================== -->
<!-- Reports the test results to code climate -->
<!-- ==================================================================== -->
<target name="report-codeclimate" description="Reports the test results to code climate.">
<exec executable="${vendor.dir}/bin/test-reporter" dir="${basedir}" failonerror="true">
<env key="CODECLIMATE_REPO_TOKEN" value="${CODECLIMATE_REPO_TOKEN}"/>
<arg line="--coverage-report=${php-target.dir}/reports/unit/clover.xml"/>
</exec>
</target>
<!-- ==================================================================== -->
<!-- Runs the PHPUnit tests on Travis-CI and generates a report -->
<!-- ==================================================================== -->
<target name="run-tests" description="Runs the PHPUnit tests on Travis-CI and generates a report.">
<exec executable="${vendor.dir}/bin/phpunit" dir="${basedir}" failonerror="true">
<arg line="--bootstrap bootstrap.php --configuration phpunit.xml" />
</exec>
</target>
<!-- ==================================================================== -->
<!-- Builds the library -->
<!-- ==================================================================== -->
<target name="build" description="Builds the library.">
<antcall target="prepare" />
<antcall target="phpcs" />
<antcall target="run-tests" />
<antcall target="phpcpd" />
<antcall target="phplint" />
<antcall target="phpmd" />
<antcall target="phploc" />
<antcall target="pdepend" />
</target>
</project>