forked from lunetics-org/LocaleBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphing.xml
165 lines (145 loc) · 6.46 KB
/
phing.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
<?xml version="1.0" encoding="UTF-8"?>
<project name="LuneticsLocaleBundle" basedir="." default="build:main">
<!-- Properties -->
<property name="dir.src" value="${project.basedir}"/>
<property name="dir.vendor" value="${project.basedir}/vendor"/>
<property name="dir.build" value="${project.basedir}/build"/>
<property name="dir.docs" value="${dir.build}/docs"/>
<property name="dir.docs.phpdoc" value="${dir.docs}/phpdoc"/>
<property name="dir.reports" value="${dir.build}/logs"/>
<property name="dir.reports.phpunit" value="${dir.build}/phpunit"/>
<property name="dir.reports.pdepend" value="${dir.reports}/pdepend"/>
<property name="dir.reports.coverage" value="${dir.reports}/coverage"/>
<!-- Filesets -->
<fileset id="sourcecode" dir="${dir.src}">
<include name="**/*.php"/>
<exclude name="Tests/"/>
<exclude name="vendor/"/>
</fileset>
<!-- Default target -->
<target name="build:main"
depends="build:clean, build:prepare, build:install-dependencies, build:check, build:test, build:doc"
description="Run all test and build everything"/>
<!-- Doc target -->
<target name="build:doc"
depends="build:prepare, doc:phpdoc2"
description="Generates app API documentation."/>
<!-- Check target -->
<target name="build:check"
depends="check:cs, check:md, check:cpd, check:depend"
description="Analyzes app code."/>
<!-- Test target -->
<target name="build:test"
depends="test:unit, test:report"
description="Executes all tests.."/>
<!-- Project build clean -->
<target name="build:clean" description="Clean up build directories.">
<echo msg="Cleaning build directories ..."/>
<delete dir="${dir.vendor}" verbose="true"/>
<delete dir="${dir.build}" verbose="true"/>
</target>
<!-- Project build prepare -->
<target name="build:prepare" description="Create build directories.">
<echo msg="Creating build directories ..."/>
<mkdir dir="${dir.vendor}"/>
<mkdir dir="${dir.build}"/>
<mkdir dir="${dir.docs}"/>
<mkdir dir="${dir.docs.phpdoc}"/>
<mkdir dir="${dir.reports}"/>
<mkdir dir="${dir.reports.coverage}"/>
<mkdir dir="${dir.reports.pdepend}"/>
<mkdir dir="${dir.reports.phpunit}"/>
</target>
<target name="build:getcomposer" description="Installing composer">
<echo msg="Fetching Composer"/>
<exec
command="curl -s http://getcomposer.org/installer | php"
passthru="true"/>
</target>
<target name="build:install-dependencies"
depends="build:getcomposer"
description="Installing dependencies">
<echo msg="Installing dependencies"/>
<exec
command="php composer.phar install --no-ansi --dev"
passthru="true"/>
</target>
<!-- PHPDOC API documentation target -->
<target name="doc:phpdoc2" description="Generate API documentation.">
<echo msg="Generating API documentation with PHPDoc..."/>
<phpdoc2 title="${phing.project.name} :: API Documentation"
destdir="${dir.docs.phpdoc}">
<fileset refid="sourcecode"/>
</phpdoc2>
</target>
<!-- Symfony2 code sniffer -->
<target name="check:cs" description="Checks coding standard.">
<echo msg="Checking coding standard ..."/>
<phpcodesniffer standard="Symfony2"
showSniffs="true"
showWarnings="true">
<fileset refid="sourcecode"/>
<formatter type="checkstyle" outfile="${dir.reports}/checkstyle.xml"/>
</phpcodesniffer>
</target>
<!-- copy/paste detector -->
<target name="check:cpd" description="Checks similar code blocks.">
<echo msg="Checking similar code blocks ..."/>
<phpcpd>
<fileset refid="sourcecode"/>
<formatter type="pmd" outfile="${dir.reports}/pmd-cpd.xml"/>
</phpcpd>
</target>
<!-- Mess detector -->
<target name="check:md" description="Generate code metrics.">
<echo msg="Generating code metrics ..."/>
<phpmd rulesets="codesize,unusedcode">
<fileset refid="sourcecode"/>
<formatter type="xml" outfile="${dir.reports}/pmd.xml"/>
</phpmd>
</target>
<!-- Code dependency -->
<target name="check:depend" description="Checks coupling and dependency.">
<echo msg="Checking coupling and dependency ..."/>
<phpdepend>
<fileset refid="sourcecode"/>
<logger type="jdepend-xml" outfile="${dir.reports.pdepend}/jdepend.xml"/>
<logger type="jdepend-chart" outfile="${dir.reports.pdepend}/dependencies.svg"/>
<logger type="overview-pyramid" outfile="${dir.reports.pdepend}/overview-pyramid.svg"/>
</phpdepend>
</target>
<!-- Unit tests -->
<target name="test:unit" description="Executes unit tests.">
<echo msg="Running unit tests ..."/>
<!-- Using usual exec method, till the coverage report works after phpunit (phpunit unloads the composer autoload
<echo msg="Setting up Coverage Database ..."/>
<coverage-setup database="${dir.reports}/coverage.db">
<fileset refid="sourcecode"/>
</coverage-setup>
<echo msg="Running unit tests ..."/>
<phpunit codecoverage="true"
bootstrap="Tests/bootstrap.php"
printsummary="true"
haltonfailure="true"
haltonerror="true">
<formatter todir="${dir.reports}"
type="xml"/>
<batchtest>
<fileset dir="Tests">
<include name="**/*Test.php"/>
</fileset>
</batchtest>
</phpunit>
<coverage-report outfile="${dir.reports}/coverage.xml" />
-->
<exec command="phpunit --testdox --log-junit '${dir.reports}/phpunit.xml' --coverage-clover '${dir.reports}/clover.xml' --coverage-html '${dir.reports.coverage}' -c phpunit.xml.dist"
passthru="true"/>
</target>
<target name="test:report" description="Generating unit test reports.">
<echo msg="Generating unit test reports ..."/>
<phpunitreport infile="${dir.reports}/phpunit.xml"
format="noframes"
todir="${dir.reports.phpunit}"
/>
</target>
</project>