-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
build.xml
87 lines (72 loc) · 3.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
<?xml version="1.0" encoding="UTF-8"?>
<project name="version" default="setup">
<property name="phive.bin" value="phive"/>
<target name="setup" depends="clean,install-tools,install-dependencies"/>
<target name="clean" unless="clean.done" description="Cleanup build artifacts">
<delete dir="${basedir}/tools"/>
<delete dir="${basedir}/vendor"/>
<delete file="${basedir}/src/autoload.php"/>
<property name="clean.done" value="true"/>
</target>
<target name="prepare" unless="prepare.done" depends="clean" description="Prepare for build">
<property name="prepare.done" value="true"/>
</target>
<target name="install-tools" unless="tools-installed" depends="-tools-installed" description="Install tools with Phive">
<exec executable="${phive.bin}" taskname="phive" failonerror="true">
<arg value="install"/>
<arg value="--copy" />
<arg value="--trust-gpg-keys" />
<!-- php-cs-fixer ,psalm ,phpunit -->
<arg value="0xE82B2FB314E9906E,0x12CE0F1D262429A5,0x4AA394086372C20A" />
</exec>
</target>
<target name="install-dependencies" description="Install dependencies with Composer">
<exec executable="composer" taskname="composer">
<env key="COMPOSER_DISABLE_XDEBUG_WARN" value="1"/>
<arg value="install"/>
<arg value="--no-ansi"/>
<arg value="--no-interaction"/>
<arg value="--no-progress"/>
<arg value="--optimize-autoloader"/>
</exec>
</target>
<target name="php-cs-fixer" depends="install-tools" description="Dry run php-cs-fixer">
<exec executable="${basedir}/tools/php-cs-fixer" failonerror="true">
<arg value="fix" />
<arg value="--dry-run" />
</exec>
</target>
<target name="psalm" depends="install-tools,install-dependencies" description="Run psalm">
<exec executable="${basedir}/tools/psalm" taskname="psalm-cache-clear">
<arg value="--config=psalm.xml" />
<arg value="--clear-cache" />
</exec>
<exec executable="${basedir}/tools/psalm" taskname="psalm" failonerror="true">
<arg value="--config=psalm.xml" />
<arg value="--show-info=true" />
<arg value="--stats" />
</exec>
</target>
<target name="psalm-baseline" depends="install-tools,install-dependencies" description="Run psalm">
<exec executable="${basedir}/tools/psalm" taskname="psalm-cache-clear">
<arg value="--config=psalm.xml" />
<arg value="--clear-cache" />
</exec>
<exec executable="${basedir}/tools/psalm" taskname="psalm-baseline">
<arg value="--config=psalm.xml" />
<arg value="--set-baseline=build/psalm-baseline.xml" />
<arg value="--show-info=false" />
</exec>
</target>
<target name="test" depends="install-tools,install-dependencies" description="Run tests">
<exec executable="${basedir}/tools/phpunit" taskname="phpunit"/>
</target>
<target name="test-with-code-coverage" depends="install-tools,install-dependencies" description="Run tests with code coverage">
<exec executable="${basedir}/tools/phpunit" taskname="phpunit">
<arg value="--coverage-clover build/logs/clover.xml" />
</exec>
</target>
<target name="-tools-installed">
<available file="${basedir}/tools/phpunit" property="tools-installed" type="file"/>
</target>
</project>