forked from odan/phinx-migrations-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
109 lines (91 loc) · 4.18 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="webapp" default="noop">
<target name="noop"/>
<property environment="env"/>
<condition property="is_windows">
<os family="windows"/>
</condition>
<tstamp>
<format property="now" pattern="yyyy-MM-dd HH:mm:ss" locale="en,UK"/>
<format property="now_num" pattern="yyyyMMddHHmmss" locale="en,UK"/>
<format property="now_file" pattern="yyyy-MM-dd_HHmmss" locale="en,UK"/>
</tstamp>
<!-- By default, we assume all tools to be on the $PATH -->
<condition property="ext" value=".bat">
<os family="windows"/>
</condition>
<!-- DISPLAYS WINDOWS OS -->
<target name="display_windows" if="is_windows" >
<echo message="OS Family is: Windows" />
</target>
<target name="build-prepare" description="Prepare for build">
<delete dir="${basedir}/build/logs"/>
<delete dir="${basedir}/build/master"/>
<mkdir dir="${basedir}/build"/>
<mkdir dir="${basedir}/build/logs"/>
<mkdir dir="${basedir}/build/master"/>
</target>
<condition property="is_windows">
<os family="windows"/>
</condition>
<condition property="is_linux">
<os family="unix" />
</condition>
<target name="build-composer" description="Install dependencies with Composer">
<tstamp>
<format property="thirty.days.ago" pattern="MM/dd/yyyy hh:mm aa" offset="-30" unit="day"/>
</tstamp>
<delete>
<fileset dir="${basedir}/build/master">
<include name="composer.phar" />
<date datetime="${thirty.days.ago}" when="before"/>
</fileset>
</delete>
<get src="https://getcomposer.org/composer.phar" dest="${basedir}/build/master/composer.phar" skipexisting="true"/>
<exec executable="php" searchpath="true" resolveexecutable="true">
<arg value="${basedir}/build/master/composer.phar"/>
<arg value="selfupdate"/>
</exec>
</target>
<target name="lint" description="Perform syntax check of sourcecode files">
<apply executable="php" failonerror="true">
<arg value="-l" />
<fileset dir="${basedir}">
<include name="**/*.php" />
<!-- exclude the tests directory, repeat line below to exclude more -->
<exclude name="tests/**" />
<exclude name="vendor/**" />
<modified />
</fileset>
<fileset dir="${basedir}/tests">
<include name="**/*.php" />
<modified />
</fileset>
</apply>
</target>
<target name="apigen" description="Generate API documentation using ApiGen">
<delete dir="${basedir}/build/api"/>
<mkdir dir="${basedir}/build/api"/>
<exec executable="apigen${ext}" searchpath="true" resolveexecutable="true" failonerror="true">
<arg line="generate -s ${basedir}/src -d ${basedir}/build/api --skip-doc-path *.html.php,Local.Example.phps,Local.php" />
</exec>
</target>
<target name="phpunit" depends="build-prepare" description="Run unit tests with PHPUnit">
<exec executable="${basedir}/vendor/bin/phpunit${ext}" searchpath="true" resolveexecutable="true" failonerror="true" taskname="phpunit">
<arg value="--configuration"/>
<arg path="${basedir}/phpunit.xml"/>
</exec>
</target>
<target name="phpunit-coverage" depends="build-prepare" description="Run unit tests with PHPUnit with coverage">
<delete dir="${basedir}/build/coverage"/>
<mkdir dir="${basedir}/build/coverage"/>
<exec executable="${basedir}/vendor/bin/phpunit${ext}" searchpath="true" resolveexecutable="true" failonerror="true" taskname="phpunit-coverage">
<arg value="--configuration"/>
<arg path="${basedir}/phpunit.xml"/>
<arg value="--coverage-clover"/>
<arg path="${basedir}/build/logs/clover.xml"/>
<arg value="--coverage-html"/>
<arg path="${basedir}/build/coverage"/>
</exec>
</target>
</project>