-
Notifications
You must be signed in to change notification settings - Fork 97
/
Copy pathbuild.xml
169 lines (148 loc) · 6.19 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<project name="PhalconEye" basedir="." default="info">
<property file="build.properties"/>
<target name="info">
<echo>
=============================
Main commands
=============================
info - Shows this help
build - Prepares environment for distribution.
dist - Generates distributable package.
assets - Install modules assets.
clean - Deletes previously generated files under build/ and dist/.
doc - Generates the project documentation using PHP Documentor.
check - Executes the tasks: phpmd, phpcs.
analyze - Executes the tasks: phpcpd, pdepend, phpcb, phploc.
=============================
Code tools
=============================
phpcpd - Detects copy/pastes in the code.
pdepend - Calculates some code metrics using PHP Depend.
phpmd - Analyzes the code to discover potential problems on it.
phpcb - Generates a browsable report of code violations using PHP CodeBrowser.
phploc - Calculates the size of the code using phploc.
phpcs - Detects standard violations on the code.
</echo>
</target>
<!-- clean - Deletes previously generated files under build/ and dist/ -->
<target name="clean">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
</target>
<target name="assets">
<!-- Clear assets -->
<delete>
<fileset dir="${public.dir}/assets" includes="**/*" />
<dirset dir="${public.dir}/assets" includes="**/*" />
</delete>
<exec executable="php">
<arg value="${public.dir}/index.php" />
<arg value="assets" />
<arg value="install" />
</exec>
</target>
<!-- build - Prepares environment for distribution -->
<target name="build">
<!-- Prepare structure for the build of the project -->
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.src.dir}"/>
<mkdir dir="${report.dir}"/>
<mkdir dir="${report.dir}/code-browser"/>
<!-- Copy files -->
<copy todir="${build.src.dir}/app">
<fileset dir="${src.dir}"/>
</copy>
<copy todir="${build.src.dir}/public">
<fileset dir="${public.dir}"/>
</copy>
<copy file="CHANGELOG.txt" todir="${build.src.dir}"/>
<copy file="LICENSE.txt" todir="${build.src.dir}"/>
<copy file="README.md" todir="${build.src.dir}"/>
<!-- Clear temp data -->
<delete>
<fileset dir="${build.src.dir}/public/external/pydio/data/cache" includes="*.ser,diag_result.php" />
<fileset dir="${build.src.dir}/app/var" includes="**/*.php" />
<fileset dir="${build.src.dir}/app/var" includes="**/*.cache" />
<fileset dir="${build.src.dir}/app/var" includes="**/*.log" />
</delete>
<delete dir="${build.src.dir}/app/var/temp/packages" />
</target>
<!-- dist - Generates distributable package -->
<target name="dist" depends="build,assets">
<mkdir dir="${dist.dir}"/>
<tar destfile="${dist.dir}/${project.name}.tar.gz" basedir="${build.src.dir}" compression="gzip"
longfile="gnu"/>
</target>
<!-- doc - Generates the project documentation using PHP Documentor. -->
<target name="doc" depends="build">
<exec executable="phpdoc">
<arg value="-d"/>
<arg path="${build.src.dir}"/>
<arg value="-t"/>
<arg path="${doc.dir}"/>
</exec>
</target>
<!-- check -->
<target name="check" depends="phpmd,phpcs"/>
<!-- phpmd - Analyzes the code to discover potential problems on it. -->
<target name="phpmd" depends="build">
<exec executable="phpmd" failonerror="true">
<arg path="${check.dir}"/>
<arg value="text"/>
<arg value="${checkstyle-rules.dir}/phpmd/ruleset.xml"/>
<arg value="--exclude"/>
<arg value="${ignor.dir}"/>
</exec>
</target>
<!-- phpcs - Detects standard violations on the code. -->
<target name="phpcs" depends="build">
<exec executable="phpcs" failonerror="true">
<arg value="--extensions=php"/>
<arg value="--standard=${checkstyle-rules.dir}/phpcs/PhalconEye"/>
<arg value="--ignore=${ignor.dir}"/>
<arg path="${check.dir}"/>
</exec>
</target>
<!-- analyze -->
<target name="analyze" depends="phpcpd,pdepend,phpcb,phploc"/>
<!-- phpcpd - Detects copy/pastes in the code. -->
<target name="phpcpd" depends="build">
<exec executable="phpcpd">
<arg value="--log-pmd"/>
<arg value="${report.dir}/cpd.xml"/>
<arg path="${check.dir}"/>
</exec>
</target>
<!-- pdepend - Calculates some code metrics using PHP Depend. -->
<target name="pdepend" depends="build">
<exec executable="pdepend">
<arg value="--jdepend-xml=${report.dir}/jdepend.xml"/>
<arg value="--jdepend-chart=${report.dir}/dependencies.svg"/>
<arg value="--overview-pyramid=${report.dir}/dependencies-pyramid.svg"/>
<arg value="--ignore=/${ignor.dir}"/>
<arg value="${check.dir}"/>
</exec>
</target>
<!-- phpcb - Generates a browsable report of code violations using PHP CodeBrowser. -->
<target name="phpcb" depends="build">
<exec executable="phpcb">
<arg value="--log"/>
<arg path="${report.dir}"/>
<arg value="--source"/>
<arg path="${check.dir}"/>
<arg value="--output"/>
<arg path="${report.dir}/code-browser"/>
</exec>
</target>
<!-- phploc - Calculates the size of the code using phploc. -->
<target name="phploc" depends="build">
<exec executable="phploc">
<arg value="--log-csv"/>
<arg value="${report.dir}/phploc.csv"/>
<arg value="--exclude"/>
<arg value="${ignor.dir}"/>
<arg path="${check.dir}"/>
</exec>
</target>
</project>