forked from hanneskod/libmergepdf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
142 lines (128 loc) · 4.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
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
<?xml version="1.0" encoding="UTF-8"?>
<project name="libmergepdf" basedir="." default="buildAll">
<property name="APP_NAME" value="libmergepdf" />
<property name="APP_ROOT" value="${project.basedir}" />
<property name="SRC_DIR" value="${APP_ROOT}/src" />
<property name="TEST_DIR" value="${APP_ROOT}/tests" />
<property name="BUILD_DIR" value="${APP_ROOT}/build" />
<property name="CODE_STANDARD" value="PSR2" />
<fileset dir="${SRC_DIR}" id="filesetSource">
<include name="**/*.php" />
</fileset>
<fileset dir="${TEST_DIR}" id="filesetTests">
<include name="**/*.php" />
</fileset>
<target name="buildAll" depends="test,sniff,phpcpd,phpmd,pdepend,document">
</target>
<target name="test" depends="install,createBuildDir">
<exec
command="phpunit --coverage-html ${BUILD_DIR}/test-coverage --coverage-text=${BUILD_DIR}/test-coverage.txt"
dir="${APP_ROOT}"
checkreturn="true"
passthru="true"
/>
</target>
<target name="sniff" depends="createBuildDir">
<phpcodesniffer
standard="${CODE_STANDARD}"
showWarnings="true"
encoding="utf8"
haltonerror="true"
haltonwarning="false"
docGenerator="HTML"
docFile="${BUILD_DIR}/phpcs/rules.html"
>
<fileset refid="filesetSource"/>
<fileset refid="filesetTests"/>
<formatter type="full" outfile="${BUILD_DIR}/phpcs/sniff.txt"/>
<formatter type="summary" outfile="${BUILD_DIR}/phpcs/sniff-summary.txt"/>
<formatter type="full" usefile="false"/>
</phpcodesniffer>
</target>
<target name="phpcpd" depends="createBuildDir">
<phpcpd>
<fileset refid="filesetSource"/>
<fileset refid="filesetTests"/>
<formatter type="default" outfile="${BUILD_DIR}/phpcpd.txt"/>
</phpcpd>
</target>
<target name="phpmd" depends="createBuildDir">
<phpmd>
<fileset refid="filesetSource"/>
<fileset refid="filesetTests"/>
<formatter type="html" outfile="${BUILD_DIR}/phpmd.html"/>
</phpmd>
</target>
<target name="pdepend" depends="createBuildDir">
<phpdepend>
<fileset refid="filesetSource"/>
<logger type="jdepend-chart" outfile="${BUILD_DIR}/pdepend/jdepend.svg"/>
<logger type="overview-pyramid" outfile="${BUILD_DIR}/pdepend/pyramid.svg"/>
<logger type="summary-xml" outfile="${BUILD_DIR}/pdepend/summary.xml"/>
</phpdepend>
</target>
<target name="document" depends="createBuildDir">
<exec
command="phpdoc --title '${APP_NAME}' -d ${SRC_DIR} -t ${BUILD_DIR}/apidocs --defaultpackagename='${APP_NAME}' --validate"
dir="${APP_ROOT}"
passthru="true"
/>
<exec
command="chmod -R 777 apidocs"
dir="${BUILD_DIR}"
/>
</target>
<target name="createBuildDir">
<mkdir dir="${BUILD_DIR}"/>
<mkdir dir="${BUILD_DIR}/phpcs"/>
<mkdir dir="${BUILD_DIR}/pdepend"/>
<if>
<available file="${BUILD_DIR}/index.html"/>
<else>
<exec
command="wget https://raw.github.com/hanneskod/php-skeleton/0.1.1/index.html"
dir="${BUILD_DIR}"
passthru="true"
/>
</else>
</if>
</target>
<target name="update" depends="install">
<exec
command="php composer.phar self-update"
dir="${APP_ROOT}"
checkreturn="true"
/>
<exec
command="php composer.phar update"
dir="${APP_ROOT}"
checkreturn="true"
/>
</target>
<target name="install" depends="getcomposer">
<if>
<available file="${APP_ROOT}/vendor"/>
<else>
<exec
command="php composer.phar install --dev"
dir="${APP_ROOT}"
checkreturn="true"
passthru="true"
/>
</else>
</if>
</target>
<target name="getcomposer">
<if>
<available file="${APP_ROOT}/composer.phar"/>
<else>
<exec
command="curl -s http://getcomposer.org/installer | php"
dir="${APP_ROOT}"
checkreturn="true"
passthru="true"
/>
</else>
</if>
</target>
</project>