-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.xml
99 lines (87 loc) · 4.54 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="Lsv \ Timestring parser" default="dist">
<property name="title" value="${phing.project.name}" />
<property name="rootdir" value="." />
<property name="bindir" value="${rootdir}/vendor/bin" />
<property name="srcdir" value="src" />
<property name="builddir" value="${rootdir}/.build" />
<property name="docsdir" value="${builddir}/docs" />
<property name="BUILD_FAIL" value="false" />
<fileset dir="${srcdir}" id="src_fileset">
<include name="**/*.php" />
</fileset>
<fileset dir="${rootdir}" id="root_fileset">
<include name="**/*.php" />
<exclude name="vendor/**" />
</fileset>
<!-- ============================================ -->
<!-- Target: prepare -->
<!-- ============================================ -->
<target name="prepare">
<delete dir="${builddir}" />
<mkdir dir="${builddir}" />
</target>
<!-- ============================================ -->
<!-- PHP CS Fixer (php-cs-fixer) -->
<!-- ============================================ -->
<target name="phpcsfixer">
<exec command="${bindir}/php-cs-fixer fix ${srcdir} --level=psr2" logoutput="false" />
<exec command="${bindir}/phpcbf --standard=PSR2 ${srcdir}" logoutput="false" />
</target>
<!-- ============================================ -->
<!-- PHP_CodeSniffer (phpcs) -->
<!-- PHP MD (phpmd) -->
<!-- PHP CPD (phpcpf) -->
<!-- ============================================ -->
<target name="phpmessdetector">
<exec command="${bindir}/phpcs --standard=PSR2 ${srcdir} --report-file=${builddir}/phpcs.log" logoutput="false" />
<exec command="${bindir}/phpmd ${srcdir} text ${rootdir}/.phpmd.xml --reportfile '${builddir}/phpmd.log'" logoutput="false" />
<exec command="${bindir}/phpcpd ${srcdir} --log-pmd=${builddir}/phpcpd.log" logoutput="false" />
</target>
<!-- ============================================ -->
<!-- PHP Size (phploc) -->
<!-- ============================================ -->
<target name="phploc" description="Measures and logs the size of the project">
<phploc reportType="txt" reportName="phploc" reportDirectory="${builddir}" countTests="true">
<fileset refid="root_fileset" />
</phploc>
</target>
<!-- ============================================ -->
<!-- PHP Documentor 2 (phpdoc) -->
<!-- ============================================ -->
<target name="phpdoc">
<available property="test_phpdoc" type="file" file="${bindir}/phpdoc" />
<if>
<equals arg1="${test_phpdoc}" arg2="true" />
<then>
<exec command="${bindir}/phpdoc run -t ${docsdir} -d ${srcdir} --title='${title}' --sourcecode --log='${builddir}/phpdoc.log' --template=responsive-twig" logoutput="false" checkreturn="true" />
</then>
</if>
</target>
<!-- ============================================ -->
<!-- Apigen (agigen) -->
<!-- ============================================ -->
<target name="apigen">
<available property="test_apigen" type="file" file="${bindir}/apigen" />
<if>
<equals arg1="${test_apigen}" arg2="true" />
<then>
<exec command="${bindir}/apigen generate -s ${srcdir} -d ${docsdir} --tree --todo --title='${title}' --template-theme=bootstrap" logoutput="true" checkreturn="true" />
</then>
</if>
</target>
<!-- ============================================ -->
<!-- Unit tests (phpunit) -->
<!-- ============================================ -->
<target name="phpunit">
<exec command="${bindir}/phpunit --coverage-html=${builddir}/coverage" logoutput="true" checkreturn="true" />
</target>
<!-- ============================================ -->
<!-- Target: build -->
<!-- ============================================ -->
<target name="build" depends="prepare, phpcsfixer, phpunit, phpmessdetector, phploc, phpdoc, apigen" />
<!-- ============================================ -->
<!-- (DEFAULT) Target: dist -->
<!-- ============================================ -->
<target name="dist" depends="build" />
</project>