-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.xml
260 lines (218 loc) · 8.52 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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
<?xml version="1.0"?>
<project name="MidCOM 3" default="help" basedir=".">
<property file="build.properties" />
<property name="absolute_basedir" value="" />
<property name="phpdocdir" value="documentation/api" />
<property name="coreVersion" value="0.1beta" />
<property name="version" value="" />
<property name="state" value="" />
<resolvepath propertyName="absolute_basedir" file="${project.basedir}"/>
<taskdef classname="build.resolveComponentsStyleHandle"
name="resolveComponentsStyleHandle"
classpath="/${project.basedir}"
/>
<taskdef classname="build.resolveComponentNamePart"
name="resolveComponentNamePart"
classpath="/${project.basedir}"
/>
<taskdef classname="build.symlinkStatics"
name="symlinkStatics"
classpath="/{$project.basedir}"
/>
<target name="help">
<echo>
Usage:
To create a new component:
phing scaffold -Dcomponent=com_example_mycomponent
To run all tests: (this must be done as root or by sudo)
phing runtests
To create symlinks for all static folders:
phing linkstatics
Current settings:
install_dir = ${install_dir} // this is the dir that is linked to this checkout.
target_dir = ${target_dir} // this is where pear packages are saved.
</echo>
</target>
<fileset dir="." id="statics">
<include name="**/static/" />
<exclude name="static/" />
<exclude name="scaffold/static/" />
</fileset>
<fileset dir="." id="alltests">
<include name="tests/*Test.php" />
<include name="**/tests/*Test.php" />
<exclude name="scaffold/tests/*Test.php" />
</fileset>
<fileset dir="." id="midcom">
<include name="*.php" />
<include name="**/*.php" />
<exclude name="build/*.php" />
<exclude name="build/**/*.php" />
<exclude name="scaffold/*.php" />
<exclude name="scaffold/**/*.php" />
<exclude name="static/*.php" />
<exclude name="static/**/*.php" />
<exclude name="**/static/*.php" />
<exclude name="**/static/**/*.php" />
<exclude name="midcom_core/httpd/midcom-root.php" />
<exclude name="midcom_helper_datamanager/*.php" />
<exclude name="midcom_helper_datamanager/**/*.php" />
<exclude name="net_nemein_notifications/*.php" />
<exclude name="net_nemein_notifications/**/*.php" />
<exclude name="templates/*.php" />
<exclude name="**/templates/*.php" />
<exclude name="tests/*.php" />
<exclude name="**/tests/*.php" />
<exclude name="*Test.php" />
<exclude name="**/*Test.php" />
</fileset>
<target name="linkstatics">
<mkdir dir="static" />
<symlinkStatics static_dir="${static_dir}">
<fileset refid="statics" />
</symlinkStatics>
</target>
<target name="runtests" depends="prepare_tests">
<phpunit haltonfailure="false" printsummary="true" codecoverage="false">
<batchtest>
<fileset refid="alltests" />
</batchtest>
<formatter type="xml" todir="test_reports" outfile="alltests.xml" />
</phpunit>
<phpunitreport infile="test_reports/alltests.xml"
styledir="/opt/local/lib/php/data/phing/etc"
format="frames"
todir="test_reports"
/>
<phingcall target="code_coverage" />
</target>
<target name="code_coverage" depends="prepare_coverage">
<coverage-setup database="test_reports/coverage/coverage.db">
<fileset refid="midcom"/>
</coverage-setup>
<phpunit codecoverage="true">
<batchtest>
<fileset refid="alltests"/>
</batchtest>
</phpunit>
<coverage-report outfile="test_reports/coverage/coverage.xml">
<report todir="test_reports/coverage"/>
</coverage-report>
</target>
<target name="prepare_tests" depends="clean_tests">
<mkdir dir="test_reports" />
</target>
<target name="clean_tests">
<delete dir="test_reports" />
</target>
<target name="prepare_coverage" depends="clean_coverage">
<mkdir dir="test_reports" />
<mkdir dir="test_reports/coverage"/>
</target>
<target name="clean_coverage">
<delete dir="test_reports/coverage" />
</target>
<target name="scaffold" depends="resolve_component_to_dir">
<property name="template_dir" value="scaffold" />
<phingcall target="create_component" />
</target>
<target name="resolve_component_to_dir" >
<php function="str_replace" returnProperty="component">
<param value="."/>
<param value="_"/>
<param value="${component}"/>
</php>
<property name="component_dir" value="${component}"/>
<resolveComponentsStyleHandle
component="${component}"
returnProperty="component_style_handle"
/>
<resolveComponentNamePart
component="${component}"
part="name"
returnProperty="component_parts_name"
/>
<resolveComponentNamePart
component="${component}"
part="host"
returnProperty="component_parts_host"
/>
<resolveComponentNamePart
component="${component}"
part="domain"
returnProperty="component_parts_domain"
/>
<available
file="${basedir}/${component_dir}"
property="component_dir_exists"
value="yes"
type="dir"
/>
<property name="midcom_root" value="${project.basedir}" />
</target>
<target name="create_component" if="component_dir" unless="component_dir_exists">
<mkdir dir="${component_dir}"/>
<mkdir dir="${component_dir}/configuration"/>
<mkdir dir="${component_dir}/controllers"/>
<mkdir dir="${component_dir}/templates" />
<mkdir dir="${component_dir}/static" />
<mkdir dir="${component_dir}/tests" />
<input propertyname="component_description"
defaultValue="MidCOM component ${component}"
>
Enter component description:
</input>
<copy todir="${component_dir}">
<filterchain>
<expandproperties/>
</filterchain>
<fileset dir="${template_dir}/" >
<include name="*.php" />
<include name="*.yml" />
</fileset>
</copy>
<copy todir="${component_dir}/configuration">
<filterchain>
<expandproperties/>
</filterchain>
<fileset dir="${template_dir}/configuration/">
<include name="*.yml" />
</fileset>
</copy>
<copy todir="${component_dir}/controllers">
<filterchain>
<expandproperties/>
</filterchain>
<fileset dir="${template_dir}/controllers">
<include name="*.php" />
</fileset>
</copy>
<copy todir="${component_dir}/templates">
<filterchain>
<expandproperties/>
</filterchain>
<fileset dir="${template_dir}/templates">
<include name="xxx-show-index.php" />
</fileset>
</copy>
<exec command="mv templates/xxx-show-index.php templates/${component_style_handle}-show-index.php"
dir="${component_dir}"
/>
<copy todir="${component_dir}/static">
<filterchain>
<expandproperties/>
</filterchain>
<fileset dir="${template_dir}/static">
<include name="component.js" />
</fileset>
</copy>
<copy todir="${component_dir}/tests">
<filterchain>
<expandproperties/>
</filterchain>
<fileset dir="${template_dir}/tests">
<include name="*.php" />
</fileset>
</copy>
</target>
</project>