forked from FluidTYPO3/vhs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
190 lines (168 loc) · 8.79 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="FluidTYPO3/vhs" default="build-parallel" basedir=".">
<!-- Note, this build script requires your extension to be linked and installed in a typo3 installation properly! -->
<property name="output" location="${basedir}/Build/"/>
<property name="tooldir" location="${basedir}/Build/Libraries/bin"/>
<property file="${basedir}/build.properties"/>
<target name="build"
depends="prepare,getcomposer,import-checkstyleset,lint,phploc,pdepend,phpmd-ci,phpcs-ci,phpcpd,phpcb"/>
<target name="build-parallel"
depends="prepare,getcomposer,import-checkstyleset,lint,tools-parallel"/>
<target name="metrics" depends="phploc,pdepend,phpmd-ci,phpcs-ci,phpcpd,phpcb"/>
<target name="tools-parallel" description="Run tools in parallel">
<parallel threadCount="2">
<sequential>
<antcall target="pdepend"/>
<antcall target="phpmd-ci"/>
</sequential>
<antcall target="phpcpd"/>
<antcall target="phpcs-ci"/>
<antcall target="phploc"/>
<!--
<antcall target="apigen"/>
-->
<antcall target="phpcb"/>
</parallel>
</target>
<target name="getcomposer" description="Get Composer and Deps">
<get src="http://getcomposer.org/composer.phar" dest="${output}/tools/"/>
<chmod file="${output}/tools/composer.phar" perm="+x"/>
<exec executable="${output}/tools/composer.phar" dir="${basedir}/Build">
<arg value="update"/>
<arg value="--dev"/>
<arg value="--prefer-dist"/>
</exec>
</target>
<target name="clean" description="Cleanup build artifacts">
<delete dir="${output}/api"/>
<delete dir="${output}/code-browser"/>
<delete dir="${output}/coverage"/>
<delete dir="${output}/logs"/>
<delete dir="${output}/pdepend"/>
<delete dir="${output}/tools"/>
<delete dir="${output}/Libraries"/>
</target>
<target name="prepare" depends="clean" description="Prepare for build">
<mkdir dir="${output}/api"/>
<mkdir dir="${output}/code-browser"/>
<mkdir dir="${output}/coverage"/>
<mkdir dir="${output}/logs"/>
<mkdir dir="${output}/pdepend"/>
<mkdir dir="${output}/tools"/>
<mkdir dir="${output}/Libraries"/>
</target>
<target name="lint" description="Perform syntax check of sourcecode files">
<apply executable="php" failonerror="true">
<arg value="-l"/>
<fileset dir="${basedir}/Classes">
<include name="**/*.php"/>
<modified/>
</fileset>
</apply>
</target>
<target name="phploc" description="Measure project size using PHPLOC">
<exec executable="${tooldir}/phploc" output="${output}/logs/phploc.txt">
<arg line="--log-xml ${output}/logs/phploc.xml"/>
<arg line="--log-csv ${output}/logs/phploc.csv"/>
<arg path="${basedir}/Classes"/>
</exec>
<echo message="##teamcity[publishArtifacts '${output}/logs/phploc.xml']"/>
<echo message="##teamcity[publishArtifacts '${output}/logs/phploc.csv']"/>
<echo message="##teamcity[publishArtifacts '${output}/logs/phploc.txt']"/>
</target>
<target name="pdepend" description="Calculate software metrics using PHP_Depend">
<exec executable="${tooldir}/pdepend" output="${output}/logs/pdepend.txt">
<arg value="--jdepend-xml=${output}/pdepend/jdepend.xml"/>
<arg value="--jdepend-chart=${output}/pdepend/dependencies.svg"/>
<arg value="--overview-pyramid=${output}/pdepend/overview-pyramid.svg"/>
<arg line="--phpunit-xml=${output}/pdepend/phpunit.xml"/>
<arg line="--summary-xml=${output}/pdepend/summary.xml"/>
<arg line="--coverage-report=${output}/pdepend/phpunit.clover.xml"/>
<arg line="--coderank-mode=inheritance,property,method"/>
<arg path="${basedir}/Classes"/>
</exec>
<echo message="##teamcity[publishArtifacts '${output}/pdepend/dependencies.svg']"/>
<echo message="##teamcity[publishArtifacts '${output}/pdepend/jdepend.xml']"/>
<echo message="##teamcity[publishArtifacts '${output}/pdepend/overview-pyramid.svg']"/>
<echo message="##teamcity[publishArtifacts '${output}/pdepend/phpunit.xml']"/>
<echo message="##teamcity[publishArtifacts '${output}/pdepend/summary.xml']"/>
<echo message="##teamcity[publishArtifacts '${output}/pdepend/phpunit.clover.xml']"/>
</target>
<target name="import-checkstyleset"
description="Imports Checkstyle ruleset">
<exec executable="git">
<arg line="clone https://github.com/FluidTYPO3/FluidTYPO3-CodingStandards.git Build/tools/CodingStandards"/>
</exec>
</target>
<target name="phpmd-ci"
description="Perform project mess detection using PHPMD creating a log file for the continuous integration server">
<exec executable="${tooldir}/phpmd" output="${output}/logs/phpmd-ci.log">
<arg line="${basedir}/Classes"/>
<arg line="xml"/>
<arg line="naming,unusedcode,codesize,design"/>
<arg line="--reportfile ${output}/logs/pmd.xml"/>
<arg line="--exclude Tests/"/>
</exec>
<echo message="##teamcity[importData type='pmd' path='${output}/logs/pmd.xml']"/>
</target>
<target name="phpcs-ci"
description="Find coding standard violations using PHP_CodeSniffer and print human readable output. Intended for usage on the command line before committing.">
<exec executable="${tooldir}/phpcs" output="${output}/logs/phpcs-ci.txt">
<arg line="--report=checkstyle"/>
<arg line="--report-file=${output}/logs/checkstyle.xml"/>
<arg line="--extensions=php"/>
<arg line="--standard=Build/tools/CodingStandards/ruleset.xml"/>
<arg line="Classes"/>
</exec>
</target>
<target name="phpcpd" description="Find duplicate code using PHPCPD">
<exec executable="${tooldir}/phpcpd" output="${output}/logs/pmd-cpd.txt">
<arg value="--log-pmd"/>
<arg value="${output}/logs/pmd-cpd.xml"/>
<arg path="${basedir}/Classes"/>
</exec>
<echo message="##teamcity[importData type='pmdCpd' path='${output}/logs/pmd-cpd.xml']"/>
<echo message="##teamcity[publishArtifacts '${output}/logs/pmd-cpd.txt']"/>
<echo message="##teamcity[publishArtifacts '${output}/logs/pmd-cpd.xml']"/>
</target>
<target name="apigen" description="Generate API documentation using apigen">
<exec executable="${tooldir}/apigen.php" failonerror="false">
<arg line="--debug"/>
<arg line="--progressbar no"/>
<arg line="--destination ${output}/api/"/>
<arg line="--source ${basedir}/Classes/"/>
</exec>
<zip destfile="${output}/api.zip" basedir="${output}/api" update="true"/>
<echo message="##teamcity[publishArtifacts '${output}/api.zip']"/>
</target>
<target name="phpunit" description="Run unit tests with PHPUnit">
<exec executable="php" failonerror="true" output="${output}/logs/phpunit.txt">
<arg line="-d include_path='.;${typo3path-61}/typo3;${typo3path-61}/t3lib;${basedir}/Resources/Private/Php/andrewsville/php-token-reflection/TokenReflection/Exception'"/>
<arg line="-d memory_limit='1024M'"/>
<arg path="${typo3path-61}/typo3/cli_dispatch.phpsh"/>
<arg value="phpunit"/>
<arg line="--log-junit ${output}/logs/junit.xml"/>
<arg line="--verbose"/>
<arg line="--configuration ${basedir}/Tests/phpunit.xml"/>
<arg path="${basedir}/Tests"/>
</exec>
<echo message="##teamcity[publishArtifacts '${output}/logs/junit.xml']"/>
<echo message="##teamcity[publishArtifacts '${output}/logs/junit.txt']"/>
<echo message="##teamcity[importData type='junit' path='${output}/logs/junit.xml']"/>
</target>
<target name="phpcb" description="Aggregate tool output with PHP_CodeBrowser">
<exec executable="${tooldir}/phpcb" output="${output}/logs/phpcb.txt">
<arg value="--log"/>
<arg path="${output}/logs"/>
<arg value="--source"/>
<arg path="${basedir}/Classes"/>
<arg value="--source"/>
<arg path="${basedir}/Tests"/>
<arg value="--output"/>
<arg path="${output}/code-browser"/>
</exec>
<zip destfile="${output}/phpcb.zip" basedir="${output}/code-browser"/>
<echo message="##teamcity[publishArtifacts '${output}/phpcb.zip']"/>
<delete dir="${output}/code-browser"/>
</target>
</project>