-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
76 lines (65 loc) · 3.09 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
<project name="illuminate-foundation" default="pre-commit">
<property name="buildfile-version" value="1.0.0"/>
<property name="vendordir" value="${project.basedir}/../../../vendor"/>
<property name="toolsdir" value=""/>
<property name="phpdocfile" value="${project.basedir}/docs/structure.xml"/>
<target name="clean" unless="clean.done" description="Cleanup build artifacts">
<delete dir="${project.basedir}/vendor"/>
<delete file="${project.basedir}/composer.lock"/>
<property name="clean.done" value="true"/>
</target>
<target name="pre-commit" unless="pre-commit.done" depends="clean" description="Prepare for build">
<phingcall target="lint"/>
<phingcall target="phpcs"/>
<phingcall target="phpunit"/>
<phingcall target="phpdoc"/>
<property name="pre-commit.done" value="true"/>
</target>
<target name="lint" description="Perform syntax check of sourcecode files">
<apply executable="php" failonerror="true">
<arg value="-l"/>
<fileset dir="${project.basedir}/src" >
<include name="**/*.php"/>
</fileset>
<fileset dir="${project.basedir}/tests">
<include name="**/*.php"/>
</fileset>
</apply>
</target>
<target name="phpcbf" description="Fixes coding standard violations using PHP_CodeSniffer Fixer">
<exec executable="${toolsdir}phpcbf" logoutput="true">
<arg value="--tabWidth=4"/>
<arg value="--standard=PSR2"/>
<arg value="--extensions=php"/>
<arg value="--ignore=autoload.php"/>
<arg path="${project.basedir}/src"/>
<arg path="${project.basedir}/tests"/>
</exec>
</target>
<target name="phpcs" depends="phpcbf" description="Find coding standard violations using PHP_CodeSniffer and print human readable output. Intended for usage on the command line before committing.">
<exec executable="${toolsdir}phpcs" logoutput="true">
<arg value="--standard=PSR2"/>
<arg value="--extensions=php"/>
<arg value="--ignore=autoload.php"/>
<arg path="${project.basedir}/src"/>
<arg path="${project.basedir}/tests"/>
</exec>
</target>
<target name="phpunit" description="Run unit tests with PHPUnit">
<exec executable="${toolsdir}phpunit" logoutput="true">
<arg value="--configuration"/>
<arg path="${project.basedir}/phpunit.xml"/>
<arg value="--bootstrap"/>
<arg path="${vendordir}/autoload.php"/>
</exec>
</target>
<target name="phpdoc" description="Generate phpdoc structure xml and move into docs folder">
<exec executable="${toolsdir}phpdoc" dir="${project.basedir}" logoutput="true">
<arg line="-t ./phpdoc"/>
<arg line="-d ./src"/>
<arg line="--template=xml"/>
</exec>
<move file="${project.basedir}/phpdoc/structure.xml" tofile="${phpdocfile}"/>
<delete dir="${project.basedir}/phpdoc"/>
</target>
</project>