-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
71 lines (62 loc) · 2.68 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
<project name="phpcs" default="build">
<target name="build" depends="prepare, lint, phpunit, phpcpd, phpmd, phpcb, publishSniffs" description="Meta target, spouští ostatní targety"/>
<fileset id="allPhpFiles" dir="${project.basedir}/">
<include name="**/*.php"/>
<exclude name="**/data/*.php"/>
<exclude name="**/*Test/*.php"/>
<exclude name="PHP_CodeSniffer/**/*.*"/>
</fileset>
<target name="cleanup" description="Workspace cleanup">
<delete dir="${project.basedir}/build"/>
</target>
<target name="prepare" depends="cleanup" description="Workspace preparation">
<mkdir dir="${project.basedir}/build"/>
</target>
<target name="lint" description="PHP Lint check">
<phplint haltonfailure="true" level="info">
<fileset refid="allPhpFiles"/>
</phplint>
</target>
<target name="phpunit" depends="prepare" description="PHPUnit tests">
<exec command="ln -s ${project.basedir}/Collabim/ PHP_CodeSniffer/CodeSniffer/Standards" dir="${project.basedir}" passthru="true"/>
<exec executable="phpunit" dir="${project.basedir}/tests" passthru="true" checkreturn="true">
<arg line="--configuration ${project.basedir}/tests/phpunit-jenkins.xml --log-junit ${project.basedir}/build/phpunit-report.xml" />
</exec>
</target>
<target name="phpcpd" depends="prepare" description="PHP copy paste detector">
<phpcpd>
<fileset refid="allPhpFiles"/>
<formatter type="pmd" outfile="${project.basedir}/build/pmd-cpd.xml"/>
</phpcpd>
</target>
<target name="phpmd" depends="prepare" description="PHP Mass Detector">
<phpmd rulesets="${project.basedir}/phpmd.xml">
<fileset refid="allPhpFiles"/>
<formatter type="xml" outfile="${project.basedir}/build/pmd.xml"/>
</phpmd>
</target>
<target name="phpcb" depends="phpcpd, phpmd" description="Generates PHP_CodeBrowser summary">
<exec command="phpcb --log ${project.basedir}/build --source ${project.basedir} --output ${project.basedir}/build/code-browser" logoutput="true" />
</target>
<target name="publishSniffs" depends="phpcpd" description="Publish sniffs to the PHP PEAR directory">
<if>
<!-- publish updated sniffs from the main phing project only -->
<contains string="${project.basedir}" substring="/phpcs/"/>
<then>
<delete failonerror="true">
<fileset dir="/usr/share/php/collabimphpcs/Collabim">
<include name="**/*.*"/>
</fileset>
</delete>
<copy todir="/usr/share/php/collabimphpcs/Collabim" overwrite="true">
<fileset dir="${project.basedir}/Collabim">
<include name="**/*.*"/>
</fileset>
</copy>
</then>
<else>
<echo message="Sniffs not published" />
</else>
</if>
</target>
</project>