forked from vufind-org/vufindhttp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
97 lines (83 loc) · 3.62 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="vufindhttp" basedir="." default="main">
<property name="tmp" value="/tmp" />
<property name="package" value="${phing.project.name}" override="true" />
<property name="builddir" value="${tmp}/build/${phing.project.name}" override="true" />
<property name="srcdir" value="${project.basedir}" override="true" />
<!-- Main Target -->
<target name="main" description="main target">
<trycatch property="exceptionmsg">
<try>
<phingcall target="startup" />
<phingcall target="ci-tasks" />
<phingcall target="shutdown" />
</try>
<catch>
<phingcall target="shutdown" />
<fail>Unexpected error during continuous integration tasks -- ${exceptionmsg}</fail>
</catch>
</trycatch>
</target>
<!-- Continuous Integration Tasks -->
<target name="ci-tasks" description="continuous integration tasks">
<!-- Create dirs -->
<mkdir dir="${builddir}/reports"/>
<mkdir dir="${builddir}/reports/coverage"/>
<!-- Call standard tasks -->
<phingcall target="phpcs"/>
<phingcall target="phpunit"/>
<phingcall target="phpdoc"/>
<phingcall target="phpcpd"/>
<phingcall target="phpmd"/>
<phingcall target="pdepend"/>
<phingcall target="phploc"/>
</target>
<!-- Report rule violations with PHPMD (mess detector) -->
<target name="phpmd">
<exec command="phpmd ${srcdir}/src xml ${srcdir}/tests/phpmd.xml --exclude ${srcdir}/tests --reportfile ${builddir}/reports/phpmd.xml" />
</target>
<!-- Measure project with phploc -->
<target name="phploc">
<exec command="phploc --log-csv ${builddir}/reports/phploc.csv ${srcdir}/src" />
</target>
<!-- PHP_Depend code analysis -->
<target name="pdepend">
<exec command="pdepend --jdepend-xml=${builddir}/reports/jdepend.xml --jdepend-chart=${builddir}/reports/dependencies.svg --overview-pyramid=${builddir}/reports/pdepend-pyramid.svg ${srcdir}/src" />
</target>
<!-- PHP copy-and-paste detection -->
<target name="phpcpd">
<exec command="phpcpd --log-pmd ${builddir}/reports/pmd-cpd.xml --exclude tests ${srcdir}/src" />
</target>
<!-- PHP CodeSniffer -->
<target name="phpcs">
<exec command="phpcs --standard=PEAR --ignore=tests/* --extensions=php --report=checkstyle ${srcdir}/src > ${builddir}/reports/checkstyle.xml" escape="false" />
</target>
<!-- PHP API Documentation -->
<target name="phpdoc">
<mkdir dir="${builddir}/apidocs"/>
<phpdoc2 title="VuFindHttp API Documentation"
destdir="${builddir}/apidocs">
<fileset dir=".">
<include name="src/**/*.php" />
</fileset>
</phpdoc2>
</target>
<!-- PHPUnit -->
<target name="phpunit" description="Run tests">
<exec dir="${srcdir}" command="phpunit -dzend.enable_gc=0 --log-junit ${builddir}/reports/phpunit.xml --coverage-clover ${builddir}/reports/coverage/clover.xml --coverage-html ${builddir}/reports/coverage/" passthru="true" checkreturn="true" />
</target>
<!-- PHPUnit without logging output -->
<target name="phpunitfast" description="Run tests">
<exec dir="${srcdir}" command="phpunit -dzend.enable_gc=0" passthru="true" checkreturn="true" />
</target>
<!-- Set up dependencies -->
<target name="startup" description="set up dependencies">
<exec command="composer install" />
</target>
<!-- Uninstall and Deactivate VuFind -->
<target name="shutdown" description="clean up file system">
<delete dir="${srcdir}/vendor" includeemptydirs="true" failonerror="true" />
<delete file="${srcdir}/composer.lock" failonerror="true" />
<exec command="git reset --hard" />
</target>
</project>