-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.xml
121 lines (104 loc) · 4.45 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
110
111
112
113
114
115
116
117
118
119
120
121
<?xml version="1.0"?>
<project name="build" default="mainloop">
<property name="directories" value="src" />
<property name="mainPhingDir" value="report/phing" />
<php expression="chr(10)" returnProperty="NEWLINE"/>
<target name="mainloop">
<!-- Deleting old reports and creating an empty folder -->
<delete dir="${mainPhingDir}" failonerror="false" />
<mkdir dir="${mainPhingDir}" />
<!-- Folder by Folder, launch the PHP Checks -->
<foreach list="${directories}" param="directory" target="phpcheck" />
</target>
<!-- PHP Code checking -->
<target name="phpcheck">
<reflexive>
<fileset dir="${directory}" excludes="${excludeDirs}">
<include name="**/*.php"/>
</fileset>
<filterchain>
<replaceregexp>
<regexp multiline="true" pattern="<\?php.+namespace InetProcess" replace="<?php${NEWLINE}/**${NEWLINE}
* An API Wrapper made in PHP 5.6 for SugarCRM 7.x${NEWLINE}
*${NEWLINE}
* @package sugarcrm-apiwrapper${NEWLINE}
* @author Emmanuel Dyan${NEWLINE}
* @copyright 2005-2017 iNet Process${NEWLINE}
* @version 1.0.3 ${NEWLINE}
* @link http://www.inetprocess.com${NEWLINE}
*/${NEWLINE}${NEWLINE}namespace InetProcess" />
</replaceregexp>
</filterchain>
</reflexive>
<!-- Define the directory where we'll put our reports -->
<php function="str_replace" returnProperty="reportsSubDir">
<param value="/"/>
<param value="--"/>
<param value="${directory}"/>
</php>
<property name="reportsDir" value="${mainPhingDir}/${reportsSubDir}" />
<!-- Deleting old reports and creating an empty folder -->
<delete dir="${reportsDir}" failonerror="false" />
<mkdir dir="${reportsDir}" />
<!-- Executing phpCodeSniffer -->
<phpcodesniffer
standard="PSR2"
showSniffs="true"
showWarnings="true"
haltonerror="false"
docGenerator="HTML"
docFile="${mainPhingDir}/phpcs-coding-standards.html"
tabWidth="4">
<fileset dir="${directory}" excludes="${excludeDirs}">
<include name="**/*.php"/>
</fileset>
<formatter type="csv" usefile="true" outfile="${reportsDir}/phpcs.csv"/>
<formatter type="full" usefile="true" outfile="${reportsDir}/phpcs-full.txt"/>
</phpcodesniffer>
<!-- Executing phpCopyPasteDetector -->
<phpcpd>
<fileset dir="${directory}" excludes="${excludeDirs}">
<include name="**/*.php"/>
</fileset>
<formatter type="pmd" outfile="${reportsDir}/phpcpd.xml"/>
</phpcpd>
<!-- Executing phploc -->
<phploc countTests="true" reportType="txt" reportDirectory="${reportsDir}" reportName="phploc">
<fileset dir="${directory}" excludes="${excludeDirs}">
<include name="**/*.php"/>
</fileset>
</phploc>
<!-- Executing phpMessDetector -->
<phpmd>
<fileset dir="${directory}" excludes="${excludeDirs}">
<include name="**/*.php"/>
</fileset>
<formatter type="html" outfile="${reportsDir}/pmd.html"/>
</phpmd>
<!-- Executing phpdepend -->
<phpdepend>
<fileset dir="${directory}" excludes="${excludeDirs}">
<include name="**/*.php"/>
</fileset>
<logger type="jdepend-xml" outfile="${reportsDir}/phpdepend-jdepend.xml"/>
<analyzer type="coderank-mode" value="method"/>
</phpdepend>
<!-- Executing phpdoc2 -->
<delete dir="${reportsDir}/apidocs" failonerror="false" />
<mkdir dir="${reportsDir}/apidocs" />
<phpdoc2 title="API Documentation" destdir="${reportsDir}/apidocs" template="responsive-twig">
<fileset dir="${directory}" excludes="${excludeDirs}">
<include name="**/*.php" />
</fileset>
</phpdoc2>
<!-- Executing phpLint -->
<phplint
tofile="${reportsDir}/phplint.txt">
<fileset dir="${directory}" excludes="${excludeDirs}">
<include name="**/*.php"/>
</fileset>
</phplint>
<!-- As we use a docker image, force the right uid / gid at the end on the report directory -->
<chmod file="report" mode="0777" />
</target>
</project>