-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.xml
331 lines (294 loc) · 11.6 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
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
<?xml version="1.0" encoding="UTF-8"?>
<project name="Tracks" default="site" basedir=".">
<property file="build/build.properties" />
<!-- Default properties, set only if not already assigned in the build.properties file -->
<property name="dirs.root" value="." />
<property name="src" value="." />
<property name="dirs.component" value="component" />
<property name="dirs.languages" value="languages" />
<property name="dirs.modules" value="modules" />
<property name="dirs.release" value="release" />
<property name="dirs.plugins" value="plugins" />
<property name="dirs.3pd" value="3pd" />
<property name="dirs.tmp" value="tmp" />
<property name="version" value="dev" />
<property name="dirs.bin" value="bin" />
<property name="dirs.bin.libxml" value="${dirs.bin}/libxml" />
<property name="dirs.bin.fop" value="${dirs.bin}/fop" />
<property name="dirs.bin.dbxsl" value="${dirs.bin}/dbxsl" />
<property name="dirs.bin.release" value="../release" />
<xmlproperty file="redCORE/extensions/redcore.xml" prefix="redCOREDetails" keepRoot="false" />
<property
name="redCOREVersion"
value="${redCOREDetails.version}"
override="true"/>
<taskdef name="gitversion" classname="build.phingext.GitVersionTask" />
<taskdef name="gitdate" classname="build.phingext.GitDateTask" />
<!--
====================================================================================================
Tasks - General
====================================================================================================
-->
<target name="all" description="Makes everything"
depends="dev-release">
</target>
<target name="dev-release" description="Makes the release"
depends="new-release,setup-properties,release">
</target>
<target name="new-release" description="Create the release directory afresh">
<!-- Recreate the release directory -->
<delete dir="${dirs.release}" quiet="yes" includeemptydirs="false" />
<mkdir dir="${dirs.release}" />
</target>
<target name="setup-properties" description="Set up version and build properties">
<!-- Initialize the build.date timestamp -->
<tstamp>
<format property="build.date" pattern="%Y-%m-%d" />
</tstamp>
<!-- Initialize the version if it's not set -->
<if>
<equals arg1="${version}" arg2="dev" />
<then>
<gitversion propertyname="git.lastrevision" />
<gitdate propertyname="git.timestamp" />
<!--<property name="version" value="rev${git.lastrevision}" override="true" />-->
<property name="version" value="${git.lastrevision}" override="true" />
</then>
</if>
</target>
<!--
====================================================================================================
Tasks - Joomla! packages
====================================================================================================
-->
<target name="copyredcore">
<phing phingfile="${dirs.root}/redCORE/build/redcore_copy_mandatory.xml"
target="copyframework"
haltonfailure="true">
<property name="redcoretargetdir" value="${dirs.tmp}/component/redCORE" />
<property name="redcorepath" value="${dirs.root}/redCORE" />
</phing>
</target>
<target name="release" description="Tracks Installation Package for Joomla!"
depends="setup-properties, new-release, copyredcore">
<copy todir="${dirs.tmp}/component" >
<fileset dir="${dirs.component}">
<include name="**" />
</fileset>
<filterchain>
<replacetokens begintoken="##" endtoken="##">
<token key="DATE" value="${build.date}" />
<token key="VERSION" value="${version}" />
</replacetokens>
</filterchain>
</copy>
<!-- Create the package -->
<tar basedir="${dirs.tmp}/component" destfile="${dirs.release}/com_tracks-${version}.tar.gz" includeemptydirs="true" compression="gzip" />
<zip basedir="${dirs.tmp}/component" destfile="${dirs.release}/com_tracks-${version}.zip" includeemptydirs="true" />
<!-- Light version without redcore -->
<delete dir="${dirs.tmp}/component/redCORE" quiet="yes" includeemptydirs="false" />
<zip basedir="${dirs.tmp}/component" destfile="${dirs.release}/com_tracks-${version}_no_redCORE.zip" includeemptydirs="true" />
<!-- admin modules -->
<foreach param="dirname" absparam="absname" target="zipfolder">
<property name="myp" value="modules/backend" />
<fileset dir="${dirs.modules}/backend">
<type type="dir"/>
<depth max="0" min="0" />
</fileset>
</foreach>
<!-- site modules -->
<foreach param="dirname" absparam="absname" target="zipfolder">
<property name="myp" value="modules/frontend" />
<fileset dir="${dirs.modules}/frontend">
<type type="dir"/>
<depth max="0" min="0" />
</fileset>
</foreach>
<!-- languages -->
<foreach param="dirname" absparam="absname" target="zipfolder">
<property name="myp" value="language" />
<fileset dir="${dirs.languages}">
<type type="dir"/>
<depth max="0" min="0" />
</fileset>
</foreach>
<!-- plugins -->
<foreach param="pdirname" absparam="pabsname" target="zipplugins">
<fileset dir="${dirs.root}/plugins">
<type type="dir"/>
<depth max="0" min="0" />
</fileset>
</foreach>
<!-- global zip -->
<zip destfile="${dirs.release}/tracks-all-unzip-first-${version}.zip">
<fileset dir="${dirs.release}" excludes="**.tar.gz">
</fileset>
</zip>
<tar destfile="${dirs.release}/tracks-all-unzip-first-${version}.tar.gz" includeemptydirs="true" compression="gzip">
<fileset dir="${dirs.release}" excludes="**.zip">
</fileset>
</tar>
<delete dir="${dirs.tmp}" quiet="yes" includeemptydirs="false" />
</target>
<target name="zipplugins">
<echo msg="handling plugins group ${pdirname}" />
<foreach param="dirname" absparam="absname" target="zipfolder">
<property name="myp" value="plugins" />
<fileset dir="${pabsname}">
<type type="dir"/>
<depth max="0" min="0" />
</fileset>
</foreach>
</target>
<target name="zipfolder">
<echo msg="packaging ${dirname} ${absname}" />
<copy todir="${dirs.tmp}/${dirname}" >
<fileset dir="${absname}">
<include name="**" />
</fileset>
<filterchain>
<replacetokens begintoken="##" endtoken="##">
<token key="DATE" value="${build.date}" />
<token key="VERSION" value="${version}" />
</replacetokens>
</filterchain>
</copy>
<mkdir dir="${dirs.release}/${myp}" />
<!-- Create the package -->
<tar basedir="${dirs.tmp}/${dirname}" destfile="${dirs.release}/${myp}/${dirname}-${version}.tar.gz" includeemptydirs="true" compression="gzip" />
<zip basedir="${dirs.tmp}/${dirname}" destfile="${dirs.release}/${myp}/${dirname}-${version}.zip" includeemptydirs="true" />
</target>
<!--
====================================================================================================
Tasks - Copy to test site
====================================================================================================
-->
<target name="site" description="Copies files to a existing joomla site" depends="setup-properties">
<echo message="Copying administrator component..." />
<!-- Manifest & install script -->
<echo message="Copying manifest..." />
<delete dir="${www.dir}/administrator/components/com_${comp.name}" quiet="yes" includeemptydirs="true" />
<copy file="${dirs.component}/${comp.name}.xml"
tofile="${www.dir}/administrator/components/com_${comp.name}/${comp.name}.xml" overwrite="true">
<!-- trick to replace extension folders in the manifest-->
<filterchain>
<replaceregexp>
<regexp pattern="folder="admin"" replace="folder="administrator/components/com_${comp.name}""/>
</replaceregexp>
<replaceregexp>
<regexp pattern="folder="site"" replace="folder="components/com_${comp.name}""/>
</replaceregexp>
<replacetokens begintoken="##" endtoken="##">
<token key="DATE" value="${build.date}" />
<token key="VERSION" value="${version}" />
</replacetokens>
</filterchain>
</copy>
<copy file="${dirs.component}/install.php"
tofile="${www.dir}/administrator/components/com_${comp.name}/install.php" overwrite="true" />
<!-- Backend component -->
<copy todir="${www.dir}/administrator/components/com_${comp.name}" overwrite="true">
<fileset dir="${dirs.component}/admin">
<include name="**" />
<!-- Exclude the manifest to avoid overwriting the previously copied -->
<exclude name="${comp.name}.xml" />
</fileset>
</copy>
<!-- Frontend component -->
<echo message="Copying frontend component..." />
<delete dir="${www.dir}/components/com_${comp.name}" quiet="yes" includeemptydirs="true" />
<copy todir="${www.dir}/components/com_${comp.name}" overwrite="true">
<fileset dir="${dirs.component}/site" />
</copy>
<!-- Media -->
<copy todir="${www.dir}/media" overwrite="true">
<fileset dir="${dirs.component}/media">
<include name="**" />
</fileset>
</copy>
<!-- Library -->
<copy todir="${www.dir}/libraries" overwrite="true">
<fileset dir="${dirs.root}/component/libraries">
<include name="**" />
</fileset>
</copy>
<!-- Modules - Site -->
<copy todir="${www.dir}/modules" overwrite="true">
<fileset dir="${dirs.root}/modules/frontend">
<include name="**" />
</fileset>
<filterchain>
<replacetokens begintoken="##" endtoken="##">
<token key="DATE" value="${build.date}" />
<token key="VERSION" value="${version}" />
</replacetokens>
</filterchain>
</copy>
<!-- Modules - Admin -->
<copy todir="${www.dir}/administrator/modules" overwrite="true">
<fileset dir="${dirs.root}/modules/backend">
<include name="**" />
</fileset>
<filterchain>
<replacetokens begintoken="##" endtoken="##">
<token key="DATE" value="${build.date}" />
<token key="VERSION" value="${version}" />
</replacetokens>
</filterchain>
</copy>
<!-- Plugins -->
<copy todir="${www.dir}/plugins" overwrite="true">
<fileset dir="${dirs.root}/plugins">
<include name="**" />
</fileset>
<filterchain>
<replacetokens begintoken="##" endtoken="##">
<token key="DATE" value="${build.date}" />
<token key="VERSION" value="${version}" />
</replacetokens>
</filterchain>
</copy>
<!-- Templates -->
<if>
<available file="overrides/site/" type="dir"/>
<then>
<copy todir="${www.dir}/templates/${www.template.site}" overwrite="true">
<fileset dir="${dirs.root}/overrides/site">
<include name="**"/>
</fileset>
</copy>
</then>
</if>
<if>
<available file="overrides/admin/" type="dir"/>
<then>
<copy todir="${www.dir}/administrator/templates/${www.template.admin}" overwrite="true">
<fileset dir="${dirs.root}/overrides/admin">
<include name="**"/>
</fileset>
</copy>
</then>
</if>
<!-- Mcv overrides -->
<if>
<available file="overrides/code/site/" type="dir"/>
<then>
<copy todir="${www.dir}/code/" overwrite="true">
<fileset dir="${dirs.root}/overrides/code/site">
<include name="**"/>
</fileset>
</copy>
</then>
</if>
<if>
<available file="overrides/code/admin/" type="dir"/>
<then>
<copy todir="${www.dir}/administrator/code/" overwrite="true">
<fileset dir="${dirs.root}/overrides/code/admin">
<include name="**"/>
</fileset>
</copy>
</then>
</if>
</target>
</project>