forked from appserver-io/appserver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
166 lines (148 loc) · 8.61 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
<?xml version="1.0"?>
<project name="TechDivision_ApplicationServer" default="deploy" basedir=".">
<property file="${basedir}/build.properties"/>
<property file="${basedir}/build.default.properties"/>
<property file="${basedir}/build.${os.family}.properties"/>
<property environment="env" />
<property name="namespace" value="techdivision" />
<property name="module" value="appserver"/>
<property name="codepool" value="vendor"/>
<property name="unique.name" value="${codepool}/${namespace}/${module}" />
<property name="php-src.dir" value="${basedir}/src" />
<property name="php-test.dir" value="${basedir}/tests" />
<property name="php-target.dir" value="${basedir}/target"/>
<!-- ==================================================================== -->
<!-- Cleans the directories with the generated source files -->
<!-- ==================================================================== -->
<target name="clean" description="Cleans almost everything, so use carefully.">
<delete dir="${php-target.dir}" includeemptydirs="true" quiet="false" verbose="true" failonerror="true"/>
<symlink action="delete" link="instance-src"/>
</target>
<!-- ==================================================================== -->
<!-- Prepares all the required directories -->
<!-- ==================================================================== -->
<target name="prepare" depends="clean" description="Prepares all the required directories.">
<mkdir dir="${php-target.dir}" />
<mkdir dir="${php-target.dir}/reports/unit/coverage" />
<symlink resource="${instance.base.dir}" link="instance-src" overwrite="true"/>
</target>
<!-- ==================================================================== -->
<!-- Copies the sources to the target directory -->
<!-- ==================================================================== -->
<target name="copy" depends="prepare" description="Copies the sources to the target directory.">
<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.">
<antcall target="prepare"/>
<antcall target="copy"/>
<copy todir="${instance.base.dir}/app/code" preservelastmodified="true" overwrite="true">
<fileset dir="${php-target.dir}">
<include name="**/*"/>
</fileset>
</copy>
</target>
<!-- ==================================================================== -->
<!-- Generates the API documentation -->
<!-- ==================================================================== -->
<target name="apidoc" description="Generates the API documentation.">
<exec executable="phpdoc">
<arg line="-t ${php-target.dir}/docs -d ${php-src.dir}"/>
</exec>
</target>
<!-- ==================================================================== -->
<!-- Runs the code sniffer and generates a report -->
<!-- ==================================================================== -->
<target name="phpcs" description="Runs the code sniffer and generates a report.">
<exec executable="phpcs">
<arg line="--extensions=php,phtml --standard=Zend --report=checkstyle --report-file=${php-target.dir}/reports/checkstyle.xml ${php-src.dir}"/>
</exec>
</target>
<!-- ==================================================================== -->
<!-- Runs the copy and paste detection -->
<!-- ==================================================================== -->
<target name="phpcpd" description="Runs the copy and paste detection.">
<exec executable="phpcpd">
<arg line="--log-pmd ${php-target.dir}/reports/pmd-cpd.xml ${php-src.dir}"/>
</exec>
</target>
<!-- ==================================================================== -->
<!-- Generate phploc.csv -->
<!-- ==================================================================== -->
<target name="phploc" description="Generate phploc.csv">
<exec executable="phploc">
<arg line="--log-xml ${php-target.dir}/reports/phploc.xml ${php-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="pdepend">
<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 ${php-src.dir}" />
</exec>
</target>
<!-- ==================================================================== -->
<!-- Runs the PHP mess detector tool -->
<!-- ==================================================================== -->
<target name="phpmd" description="Runs the PHP Mess detector tool.">
<exec executable="phpmd">
<arg line="${php-src.dir} xml codesize,unusedcode --reportfile ${php-target.dir}/reports/pmd.xml" />
</exec>
</target>
<!-- ==================================================================== -->
<!-- Copies the test sources to the target directory -->
<!-- ==================================================================== -->
<target name="copy-tests" depends="copy" description="Copies the test sources to the target directory.">
<!-- copy the test classes to the target directory -->
<copy todir="${php-target.dir}/${unique.name}/src">
<fileset dir="${php-test.dir}">
<include name="**/*" />
</fileset>
<filterchain>
<expandproperties/>
</filterchain>
</copy>
<!-- copy the composer configuration file to the target directory -->
<copy file="${basedir}/composer.json" todir="${php-target.dir}" />
<!-- install composer packages -->
<exec dir="${php-target.dir}" executable="composer">
<env key="PATH" value="${instance.base.dir}/bin:${env.PATH}"/>
<arg line="update"/>
</exec>
</target>
<!-- ==================================================================== -->
<!-- Runs the PHPUnit tests on Travis-CI and generates a report -->
<!-- ==================================================================== -->
<target name="run-tests" depends="copy-tests" description="Runs the PHPUnit tests on Travis-CI and generates a report.">
<exec executable="phpunit" dir="${php-target.dir}/${unique.name}/src" failonerror="true">
<arg line="--configuration phpunit.xml.dist" />
</exec>
</target>
<!-- ==================================================================== -->
<!-- Runs the PHPUnit tests and generates a report -->
<!-- ==================================================================== -->
<target name="run-tests-in-runtime" depends="copy-tests" description="Runs the PHPUnit tests and generates a report.">
<exec executable="${instance.base.dir}/bin/php" dir="${php-target.dir}/${unique.name}/src" failonerror="true">
<arg line="-d zend_extension=xdebug.so ${instance.base.dir}/app/code/vendor/bin/phpunit --configuration phpunit.xml.dist" />
</exec>
</target>
<!-- ==================================================================== -->
<!-- Runs the PHPUnit tests and generates the code metrics -->
<!-- ==================================================================== -->
<target name="build" description="Runs the PHPUnit tests and generates the code metrics.">
<antcall target="run-tests"/>
<antcall target="apidoc"/>
<antcall target="phpcs"/>
<antcall target="phpcpd"/>
<antcall target="phploc"/>
<antcall target="pdepend"/>
<antcall target="phpmd"/>
</target>
</project>