-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
94 lines (84 loc) · 3.72 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="db-ping" default="check" basedir=".">
<!-- thanks to joomla https://github.com/joomla/joomla-platform/blob/staging/build.xml -->
<target name="clean" description="Remove caches and logs">
<delete dir="logs"/>
<delete dir="build"/>
<mkdir dir="logs"/>
<mkdir dir="build"/>
</target>
<target name="parallel-lint" description="Lint all php files">
<exec executable="vbin/parallel-lint" passthru="true">
<arg path="." />
<arg value="--exclude"/><arg path="vendor" />
</exec>
</target>
<target name="lint" depends="parallel-lint"/>
<target name="phpcs" description="Generate checkstyle.xml using PHP_CodeSniffer">
<exec executable="vbin/phpcs" passthru="true"/>
<exec executable="vbin/phpcs" passthru="true">
<arg value="--report=checkstyle"/>
<arg value="--report-file=logs/checkstyle.xml"/>
</exec>
</target>
<target name="phpcbf" description="Fix code style using PHP_CodeSniffer">
<exec executable="vbin/phpcbf" passthru="true">
<arg value="--no-patch"/>
</exec>
</target>
<target name="phpunit" description="Verify unit tests">
<exec executable="vbin/phpunit" passthru="true">
<arg value="--stderr"/>
<arg value="--verbose"/>
</exec>
</target>
<target name="check" depends="clean,parallel-lint,phpcs,phpunit"/>
<target name="fix" depends="clean,parallel-lint,phpcbf,phpcs,phpunit"/>
<target name="build-phar" description="Creates the phar">
<mkdir dir="build"/>
<delete file="./build/db-ping.phar"/>
<exec command="git log -n1 --pretty=%ct HEAD" outputProperty="version.date" />
<exec command="git log --pretty="%H" -n1 HEAD" outputProperty="version.hash" />
<echo msg="Removing composer require-dev..."/>
<exec command="composer config autoloader-suffix DbPingPhar${version.date}" passthru="true"/>
<exec command="composer install -q --no-dev" passthru="true"/>
<exec command="composer config autoloader-suffix --unset" passthru="true"/>
<pharpackage
destfile="./build/db-ping.phar"
basedir="./"
clistub="./bin/db-ping-phar"
compression="gzip">
<fileset dir="./">
<include name="build.xml" />
<include name="composer.json" />
<include name="composer.lock" />
<include name="*.dist" />
<include name="*.md" />
</fileset>
<fileset dir="./bin">
<include name="db-ping-phar" />
</fileset>
<fileset dir="./src">
<include name="**/*.php" />
</fileset>
<fileset dir="./vendor">
<include name="**/**" />
<exclude name="**/*Test*"/>
</fileset>
<metadata>
<element name="version" value="${version.date}" />
<element name="authors">
<element name="Finlay Beaton">
<element name="e-mail" value="[email protected]" />
</element>
<element name="db-ping Community">
<element name="website" value="https://github.com/ofbeaton/db-ping/graphs/contributors" />
</element>
</element>
</metadata>
</pharpackage>
<echo msg="Restoring composer require-dev..."/>
<exec command="composer install -q" passthru="true"/>
</target>
<target name="build" depends="check,build-phar"/>
</project>