-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
163 lines (138 loc) · 5.73 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="Metrics" basedir="." default="build">
<property name="php-executable" value="/usr/bin/php"/>
<property name="npm-executable" value="/usr/bin/npm"/>
<property name="client-root" value="${basedir}/web"/>
<property name="server-root" value="${basedir}/web/php"/>
<property name="config-root" value="${basedir}/web/config"/>
<property name="core-root" value="${basedir}/core"/>
<property name="dist" value="${basedir}/build/dist"/>
<property name="phpunit" value="${basedir}/phpunit"/>
<include file="${basedir}/composer.xml" as="composer"/>
<target name="build" depends="clean, prepare, check, build-js, build-server, build-core, dist"/>
<target name="clean">
<delete dir="${basedir}/build"/>
</target>
<target name="check" depends="prepare,test-server,test-core,test-js,phpcs,phpmd,phpcpd,lint,pdepend"/>
<target name="style" depends="prepare,phpcs,phpmd,phpcpd,pdepend"/>
<target name="prepare">
<mkdir dir="${basedir}/build"/>
<mkdir dir="${basedir}/build/dist"/>
<mkdir dir="${basedir}/build/dist/web"/>
<mkdir dir="${basedir}/build/logs"/>
<mkdir dir="${basedir}/build/logs/pdepend"/>
</target>
<target name="install-js">
<exec executable="${npm-executable}" dir="${client-root}" failonerror="true">
<arg value="install"/>
<arg value="-l"/>
</exec>
<exec executable="node_modules/.bin/bower" dir="${client-root}" failonerror="true">
<arg value="install"/>
</exec>
</target>
<target name="test-js" depends="install-js">
<exec executable="node_modules/.bin/grunt" dir="${client-root}" failonerror="true">
<arg value="test"/>
</exec>
</target>
<target name="build-js" depends="install-js,test-js">
<echo message="Building Web-js"/>
<exec executable="node_modules/.bin/grunt" dir="${client-root}" failonerror="true">
<arg value="build"/>
</exec>
<copy todir="${dist}/web/public">
<fileset dir="${client-root}/dist"/>
</copy>
</target>
<target name="install-server" depends="install-php"/>
<target name="install-php">
<antcall target="composer.composer">
<param name="composer.basedir" value="${basedir}"/>
<param name="composer.phar" value="${basedir}/composer.phar"/>
<param name="composer.lock" value="${basedir}/composer.lock"/>
</antcall>
</target>
<target name="test-server" depends="install-server">
<exec failonerror="true" executable="${phpunit}">
<arg value="${server-root}"/>
</exec>
</target>
<target name="build-server" depends="install-server, test-server">
<echo message="Building Web-Server"/>
<copy todir="${dist}/web/php">
<fileset dir="${server-root}"/>
</copy>
<copy todir="${dist}/web/config">
<fileset dir="${config-root}">
<exclude name="application.yml"/>
</fileset>
</copy>
</target>
<target name="install-core" depends="install-php"/>
<target name="test-core" depends="install-core">
<exec executable="${phpunit}" failonerror="true">
<arg value="${core-root}"/>
</exec>
</target>
<target name="build-core" depends="install-core, test-core">
<echo message="Building Metrics-Core"/>
<copy todir="${dist}/core">
<fileset dir="${core-root}"/>
</copy>
<copy todir="${dist}/vendor">
<fileset dir="${basedir}/vendor"/>
</copy>
</target>
<target name="install" depends="install-js, install-server"/>
<target name="dist">
<copy todir="${dist}" file="${basedir}/resources/configure.xml"/>
<copy todir="${dist}" file="${basedir}/resources/start.sh"/>
<chmod perm="777" file="${dist}/start.sh"/>
</target>
<target name="lint">
<apply executable="php" failonerror="true">
<arg value="-l"/>
<fileset dir="${basedir}/core">
<include name="**/*.php"/>
<modified/>
</fileset>
<fileset dir="${basedir}/web">
<include name="**/*.php"/>
<modified/>
</fileset>
</apply>
</target>
<target name="pdepend">
<exec executable="${basedir}/vendor/bin/pdepend" failonerror="true">
<arg value="--jdepend-xml=${basedir}/build/logs/jdepend.xml"/>
<arg value="--jdepend-chart=${basedir}/build/logs/pdepend/dependencies.svg"/>
<arg value="--overview-pyramid=${basedir}/build/logs/pdepend/overview-pyramid.svg"/>
<arg value="--ignore=${basedir}/vendor"/>
<arg value="${core-root},${server-root}"/>
</exec>
</target>
<target name="phpmd">
<exec executable="${basedir}/vendor/bin/phpmd" failonerror="true">
<arg value="${core-root},${server-root}"/>
<arg value="text"/>
<arg value="${basedir}/phpmd.xml"/>
</exec>
</target>
<target name="phpcs">
<exec executable="${basedir}/vendor/bin/phpcs" failonerror="true">
<arg value="--standard=PSR2"/>
<arg value="--ignore=vendor/**,build/**,web/dist"/>
<arg value="--extensions=php"/>
<arg path="${basedir}"/>
</exec>
</target>
<target name="phpcpd">
<exec executable="${basedir}/vendor/bin/phpcpd" failonerror="true">
<arg value="--log-pmd"/>
<arg value="${basedir}/build/logs/pmd-cpd.xml"/>
<arg path="${core-root}"/>
<arg path="${server-root}"/>
</exec>
</target>
</project>