-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
110 lines (97 loc) · 4.21 KB
/
build.xml
File metadata and controls
110 lines (97 loc) · 4.21 KB
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
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="build" name="phing">
<property name="build.dir" value="./build"/>
<property name="build.bin" value="./vendor/bin"/>
<property name="build.strict" value="false"/>
<property name="build.argsSpace" value="src www tests"/>
<property name="build.argsComma" value="src,www,tests"/>
<target name="build"
depends="clean,lint,phpcs,phpcpd,test,phpcb"
description="Запуск тестов и инструментов анализа">
</target>
<target name="clean" hidden="true"
description="Очистка рабочей директории от устаревших артефактов">
<delete dir="${build.dir}/phpcs"/>
<delete dir="${build.dir}/phpcpd"/>
<delete dir="${build.dir}/phpmd"/>
<delete dir="${build.dir}/phpcb"/>
<delete dir="${build.dir}/test"/>
</target>
<target name="init" depends="" hidden="true"
description="Инициализация окружения для сборки">
<mkdir dir="${build.dir}/phpcs"/>
<mkdir dir="${build.dir}/phpcpd"/>
<mkdir dir="${build.dir}/phpmd"/>
<mkdir dir="${build.dir}/phpcb"/>
<mkdir dir="${build.dir}/test"/>
<if>
<equals arg1="${env.BUILD_STRICT}" arg2="1"/>
<then>
<property name="build.strict" value="1"/>
</then>
</if>
</target>
<target name="lint" depends="init"
description="Проверка исходных файлов на корректность синтаксиса">
<exec passthru="true"
checkreturn="${build.strict}"
executable="${build.bin}/parallel-lint">
<arg line="${build.argsSpace}"/>
<arg line="--exclude vendor"/>
</exec>
</target>
<target name="phpcs" depends="init"
description="Проверка исходных файлов на соответствие стилю">
<exec passthru="true"
checkreturn="${build.strict}"
executable="${build.bin}/phpcs">
<arg line="${build.argsSpace}"/>
<arg line="--report-checkstyle=${build.dir}/phpcs/report.xml"/>
<arg line="--encoding=UTF-8"/>
<arg line="--standard=PSR2"/>
<arg line="--extensions=php"/>
<arg line="--report-summary"/>
<arg line="--report-width=auto"/>
</exec>
</target>
<target name="phpcpd" depends="init"
description="Поиск дубликатов кода">
<exec passthru="true"
checkreturn="false"
executable="${build.bin}/phpcpd">
<arg line="${build.argsSpace}"/>
<arg line="--log-pmd ${build.dir}/phpcpd/report.xml"/>
<arg line="--exclude=vendor"/>
</exec>
</target>
<target name="phpmd" depends="init"
description="Проверка файлов на наличие грязного кода">
<exec passthru="true"
checkreturn="${build.strict}"
executable="${build.bin}/phpmd">
<arg line="${build.argsComma}"/>
<arg line="xml cleancode,codesize,controversial,design,unusedcode"/>
<arg line="--reportfile ${build.dir}/phpmd/report.xml"/>
<arg line="--exclude vendor"/>
</exec>
</target>
<target name="test" depends="init"
description="Запуск тестов и подсчёт покрытия">
<exec passthru="true"
checkreturn="${build.strict}"
executable="${build.bin}/phpunit">
<arg line="--coverage-clover=${build.dir}/test/coverage.xml"/>
<arg line="--log-junit=${build.dir}/test/junit.xml"/>
</exec>
</target>
<target name="phpcb" depends="init"
description="PHP Code Browser">
<exec passthru="true"
checkreturn="${build.strict}"
executable="${build.bin}/phpcb">
<arg line="--extensions=php"/>
<arg line="--log=${build.dir}"/>
<arg line="--output=${build.dir}/phpcb"/>
</exec>
</target>
</project>