-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.xml
151 lines (133 loc) · 5.11 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
<project name="symfony2-ci-example" basedir="." default="info">
<property file="build.properties"/>
<target name="info">
<echo>
info - Shows this help
prepare - Prepares the file estructure for the build of the project
build - Prepares environment for distribution
dist - Generates distributable package
clean - Deletes previously generated files under build/ and dist/
test - Tests if the code syntax is correct and executes phpunit tests
doc - Generates the project documentation using PHP Documentor.
analyze - Executes the tasks: phpcpd, pdepend, phpmd, phpcb, phploc and phpcs
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>
<!-- prepare - Prepares the file estructure for the build of the project -->
<target name="prepare">
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.src.dir}"/>
<mkdir dir="${report.dir}"/>
<mkdir dir="${report.dir}/code-browser"/>
</target>
<!-- build - Prepares environment for distribution -->
<target name="build" depends="prepare">
<copy todir="${build.src.dir}">
<fileset dir="${src.dir}"/>
</copy>
<exec executable="php">
<arg value="${build.src.dir}/app/console"/>
<arg value="assets:install"/>
<arg value="${build.src.dir}/web/"/>
</exec>
</target>
<!-- dist - Generates distributable package -->
<target name="dist" depends="build">
<mkdir dir="${dist.dir}"/>
<tar destfile="${dist.dir}/${project.name}.tar.gz" basedir="${build.src.dir}" compression="gzip" longfile="gnu"/>
</target>
<!-- test - Tests if the code syntax is correct and executes phpunit tests -->
<target name="test" depends="build">
<apply executable="php" failonerror="true">
<arg value="-l" />
<fileset dir="${build.src.dir}/src">
<include name="**/*.php" />
</fileset>
</apply>
<exec executable="phpunit" failonerror="true">
<arg value="-c" />
<arg path="${build.src.dir}/app/"/>
<arg value="--log-junit" />
<arg path="${report.dir}/phpunit.xml"/>
<arg value="--coverage-clover" />
<arg path=" ${report.dir}/clover.xml"/>
</exec>
</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}/src" />
<arg value="-t" />
<arg path="${doc.dir}" />
</exec>
</target>
<!-- analyze - Executes the tasks: phpcpd, pdepend, phpmd, phpcb, phploc and phpcs -->
<target name="analyze" depends="phpcpd,pdepend,phpmd,phpcb,phploc,phpcs"/>
<!-- 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="${build.src.dir}/src" />
</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="${build.src.dir}/src" />
</exec>
</target>
<!-- phpmd - Analyzes the code to discover potential problems on it. -->
<target name="phpmd" depends="build">
<exec executable="phpmd">
<arg path="${build.src.dir}/src" />
<arg value="xml" />
<arg value="codesize,design,naming,unusedcode"/>
<arg value="--reportfile"/>
<arg path="${report.dir}/phpmd.xml"/>
</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="${build.src.dir}/src" />
<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 path="${build.src.dir}/src" />
</exec>
</target>
<!-- phpcs - Detects standard violations on the code. -->
<target name="phpcs" depends="build">
<exec executable="phpcs">
<arg value="--report=checkstyle" />
<arg value="--report-file=${report.dir}/checkstyle.xml" />
<arg value="--standard=${checkstyle-rules.dir}/Symfony2" />
<arg path="${build.src.dir}/src" />
</exec>
</target>
</project>