forked from albertogviana/phing-jenkins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
155 lines (137 loc) · 6.84 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
<?xml version="1.0" encoding="utf-8"?>
<project name="My Project" basedir="." default="main">
<property name="builddir" value="build" />
<property name="source" value="library/MyLibrary" />
<property name="testdir" value="tests" />
<fileset id="php-files" dir="${project.basedir}">
<include name="**/*.php"/>
<exclude name="library/Zend/**"/>
<exclude name="tests/**"/>
</fileset>
<!-- ============================================ -->
<!-- (DEFAULT) Target: main -->
<!-- ============================================ -->
<target name="main" description="Start analyzing our application">
<echo msg="Start Build" />
<phingCall target="prepare" />
<phingCall target="phpunit" />
<phingCall target="pdepend" />
<phingCall target="phpmd" />
<phingCall target="phpcpd" />
<phingCall target="phpdoc" />
<phingCall target="docblox" />
<phingCall target="phpcs" />
<phingCall target="phploc" />
<phingCall target="phpcb" />
<echo msg="Finished Build" />
</target>
<!-- ============================================ -->
<!-- (DEFAULT) Target: prepare -->
<!-- ============================================ -->
<target name="prepare" >
<echo msg="Making directory build" />
<delete dir="${builddir}/api" includeemptydirs="true" verbose="true" failonerror="true" />
<delete dir="${builddir}/code-browser" includeemptydirs="true" verbose="true" failonerror="true" />
<delete dir="${builddir}/coverage" includeemptydirs="true" verbose="true" failonerror="true" />
<delete dir="${builddir}/logs" includeemptydirs="true" verbose="true" failonerror="true" />
<delete dir="${builddir}/pdepend" includeemptydirs="true" verbose="true" failonerror="true" />
<mkdir dir="${builddir}/api"/>
<mkdir dir="${builddir}/api/docblox"/>
<mkdir dir="${builddir}/code-browser"/>
<mkdir dir="${builddir}/coverage"/>
<mkdir dir="${builddir}/logs"/>
<mkdir dir="${builddir}/pdepend"/>
</target>
<!-- ============================================ -->
<!-- Target: Unit test -->
<!-- ============================================ -->
<target name="phpunit" description="Run unit tests using PHPUnit and generates junit.xml and clover.xml">
<echo msg="Beginning of the tests" />
<exec command="phpunit --bootstrap=${testdir}/bootstrap.php
--configuration ${testdir}/phpunit.xml
--log-junit ${builddir}/logs/junit.xml
--coverage-clover ${builddir}/logs/clover.xml
--coverage-html ${builddir}/coverage/
${testdir}"
/>
</target>
<!-- ============================================ -->
<!-- Target: PHP Depend -->
<!-- ============================================ -->
<target name="pdepend" description="Calculate dependencies of the code base">
<exec command="pdepend --jdepend-xml=${builddir}/logs/jdepend.xml
--jdepend-chart=${builddir}/pdepend/dependencies.svg
--overview-pyramid=${builddir}/pdepend/overview-pyramid.svg
--suffix=php
--ignore=library/Zend,tests
${source}"
escape="false" />
</target>
<!-- ============================================ -->
<!-- Target: PHPMD (Project Mess Detector) -->
<!-- ============================================ -->
<target name="phpmd" description="Generate pmd.xml using PHPMD">
<phpmd>
<fileset refid="php-files"/>
<formatter type="xml" outfile="${builddir}/logs/pmd.xml"/>
</phpmd>
</target>
<!-- ============================================ -->
<!-- Target: PHPCPD (Copy/Paste Detector) -->
<!-- ============================================ -->
<target name="phpcpd" description="Copy/Paste Detection">
<phpcpd>
<fileset refid="php-files"/>
<formatter type="pmd" outfile="${builddir}/logs/pmd-cpd.xml"/>
</phpcpd>
</target>
<!-- ============================================ -->
<!-- Target: PHPCS (PHP Code Sniffer) -->
<!-- ============================================ -->
<target name="phpcs" description="Coding Standards Analysis">
<exec command="phpcs --standard=MyZend
--report=checkstyle
--report-file=${builddir}/logs/checkstyle.xml
--ignore=library/Zend,tests,docs,scripts
--extensions=php
${source}"
escape="false" />
</target>
<!-- ============================================ -->
<!-- Target: PHPDoc -->
<!-- ============================================ -->
<target name="phpdoc" description="Generate API documentation using PHPDocumentor">
<phpdoc title="${project.name} API Documentation"
destdir="${builddir}/api"
sourcecode="false"
output="HTML:Smarty:PHP"
quiet="true">
<fileset refid="php-files"/>
</phpdoc>
</target>
<!-- ============================================ -->
<!-- Target: Docblox -->
<!-- ============================================ -->
<target name="docblox" description="Generate API documentation with DocBlox">
<docblox
title="${project.name} API Documentation"
destdir="${builddir}/api/docblox">
<fileset refid="php-files"/>
</docblox>
</target>
<!-- ============================================ -->
<!-- Target: PHPLoc (PHP Lines of Code) -->
<!-- ============================================ -->
<target name="phploc" description="Generate phploc.csv">
<exec command="phploc --log-csv ${builddir}/logs/phploc.csv ${source} " />
</target>
<!-- ============================================ -->
<!-- Target: PHPCB (PHP Code Browser) -->
<!-- ============================================ -->
<target name="phpcb" description="Aggregate tool output with PHP_CodeBrowser">
<exec command="phpcb --log ${builddir}/logs
--ignore build,library/Zend,tests,docs
--source ${source}
--output ${builddir}/code-browser" />
</target>
</project>