forked from winponta/ongonline
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.xml
331 lines (278 loc) · 11.4 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="Ong Online" default="default">
<target name="ini">
<exec command="clear" />
<property file="build.properties"/>
<input propertyName="deploy.env" defaultValue="Test" validargs="Test,Production">
Type the environment to deploy
</input>
<input propertyName="app.releaseType" defaultValue="Bugfix" validargs="Major,Minor,Bugfix">
Wich type of release is this?
</input>
<version releasetype="${app.releaseType}" file="version.txt" property="version.number"/>
<loadfile property="app.version" file="version.txt"/>
<if>
<equals arg1="${deploy.env}" arg2="Production" />
<then>
<php expression="preg_replace('/(*ANYCRLF)\n/', '', '${app.version}')" returnProperty="app.version"/>
</then>
</if>
<tstamp />
<tstamp>
<format property="app.released.date" pattern="%G.%m.%d"/>
<format property="app.released.time" pattern="%H.%M"/>
</tstamp>
<echo>Defining last build date and time</echo>
<tstamp>
<format property="builddate" pattern="%Y/%m/%d" />
<format property="buildtime" pattern="%H:%M:%S" />
</tstamp>
<property file="lastbuild.properties"/>
<echo>Will deploy files changed after ${lastbuild.date}</echo>
<if>
<equals arg1="${deploy.env}" arg2="Production" />
<then>
<echo msg="Seting version ${versioning.tag.base} ${app.version} on ${app.released.date} at ${app.released.time} in config file"/>
<reflexive>
<fileset dir="./configs">
<include pattern="*.ini" />
</fileset>
<filterchain>
<replaceregexp>
<regexp pattern="agana.app.version = .*" replace="agana.app.version = "${app.version}"" />
<regexp pattern="agana.app.deploydate = .*" replace="agana.app.deploydate = "${app.released.date} ${app.released.time}""/>
</replaceregexp>
</filterchain>
</reflexive>
</then>
</if>
</target>
<target name="define.tag">
<property name="versioning.tag" value="${versioning.tag.base}-v.${app.version}-r.d.${app.released.date}.t.${app.released.time}" />
<echo>Defined Tag: ${versioning.tag}</echo>
<echo msg="Creating version ${versioning.tag.base} ${app.version} on ${app.released.date} at ${app.released.time}"/>
</target>
<target name="copy.files.delete.build">
<echo msg="Deleting ${build.dir}"/>
<delete dir="${build.dir}" includeemptydirs="true" verbose="false" failonerror="false" />
</target>
<target name="copy.files.app.public">
<echo msg="Copying ${build.app.dir}"/>
<copy todir="${build.app.dir}">
<fileset refid="app"/>
</copy>
<if>
<equals arg1="deploy.by" arg2="ftp"/>
<then>
<echo>Sending PUBLIC files by FTP ...</echo>
<ftpdeploy
host="${ftp.host}"
port="${ftp.port}"
username="${ftp.username}"
password="${ftp.password}"
dir="${ftp.dir.public}"
passive="false"
mode="${ftp.mode}"
depends="true"
level="debug">
<fileset dir="${build.app.dir}"/>
</ftpdeploy>
</then>
</if>
</target>
<target name="copy.files.app.lib">
<echo msg="Copying ${build.hsm.dir} LIB"/>
<copy todir="${build.hsm.dir}/lib">
<fileset refid="lib"/>
</copy>
<if>
<equals arg1="deploy.by" arg2="ftp"/>
<then>
<echo>Sending LIB files by FTP ...</echo>
<ftpdeploy
host="${ftp.host}"
port="${ftp.port}"
username="${ftp.username}"
password="${ftp.password}"
dir="${ftp.dir.public}/lib/"
passive="false"
mode="${ftp.mode}"
depends="true"
level="debug">
<fileset dir="${build.hsm.app}/lib"/>
</ftpdeploy>
</then>
</if>
</target>
<target name="copy.files.app.core">
<echo msg="Copying ${build.hsm.dir} CORE"/>
<copy todir="${build.hsm.dir}/agana">
<fileset refid="agana"/>
</copy>
<copy todir="${build.hsm.dir}/configs">
<fileset refid="configs"/>
</copy>
<if>
<equals arg1="deploy.by" arg2="ftp"/>
<then>
<echo>Sending CONFIG files by FTP ...</echo>
<ftpdeploy
host="${ftp.host}"
port="${ftp.port}"
username="${ftp.username}"
password="${ftp.password}"
dir="${ftp.dir.public}/configs/"
passive="false"
mode="${ftp.mode}"
depends="true"
level="debug">
<fileset dir="${build.hsm.dir}/configs"/>
</ftpdeploy>
<echo>Sending CORE files by FTP ...</echo>
<ftpdeploy
host="${ftp.host}"
port="${ftp.port}"
username="${ftp.username}"
password="${ftp.password}"
dir="${ftp.dir.public}/agana/"
passive="false"
mode="${ftp.mode}"
depends="true"
level="debug">
<fileset dir="${build.hsm.dir}/agana/modules/aganacore"/>
</ftpdeploy>
</then>
</if>
</target>
<target name="default" depends="ini, define.tag">
<input propertyName="deploy" defaultValue="ui.core" validargs="full,lib,ui.core,ui,core">
Wich deploy?
</input>
<input propertyName="run.git.push" defaultValue="y" validargs="y,n">
Run GIT push?
</input>
<input propertyName="run.git.tag" defaultValue="y" validargs="y,n">
Tag this release?
</input>
<input propertyName="deploy.by" defaultValue="none" validargs="none,ftp,ssh">
Deploy files by?
</input>
<if>
<equals arg1="${deploy.by}" arg2="ftp"/>
<then>
<input propertyName="ftp.password" defaultValue="">
FTP password
</input>
</then>
</if>
<input propertyName="lastbuild.update" defaultValue="y" validargs="y,n">
Update last build date?
</input>
<if>
<equals arg1="${lastbuild.update}" arg2="y"/>
<then>
<echo msg="lastbuild.date=${builddate} ${buildtime}" file="lastbuild.properties" append="false" />
</then>
</if>
<echo>Commit GIT deploy changes</echo>
<exec
command="git commit -am 'Last agana.app version ${app.version} and deploy date ${app.released.date} and time ${app.released.time} updated'"
checkreturn="true" />
<if>
<equals arg1="${run.git.tag}" arg2="y" />
<then>
<echo>Tag ${versioning.tag}</echo>
<exec
command="git tag ${versioning.tag}"
checkreturn="true" />
</then>
</if>
<if>
<equals arg1="${run.git.push}" arg2="y" />
<then>
<input propertyName="git.refspec" defaultValue="dev" validargs="dev,master">
Wich branch to git push?
</input>
<echo>Pushing GIT commit to origin ${git.refspec}</echo>
<exec
command="git push origin ${git.refspec}"
checkreturn="true" />
<echo>Pushing GIT tags to origin ${git.refspec}</echo>
<exec
command="git push origin --tags"
checkreturn="true" />
</then>
</if>
<phingcall target="deploy.${deploy}"/>
</target>
<target name="deploy.full">
<echo>Generate the FULL deployment of app</echo>
<echo>Preparing ${build.dir}</echo>
<phingcall target="copy.files.delete.build"></phingcall>
<phingcall target="copy.files.app.public"></phingcall>
<phingcall target="copy.files.app.lib"></phingcall>
<phingcall target="copy.files.app.core"></phingcall>
</target>
<target name="deploy.lib">
<echo>Generate the LIB deployment of app</echo>
<echo>Preparing ${build.dir}</echo>
<phingcall target="copy.files.delete.build"></phingcall>
<phingcall target="copy.files.app.lib"></phingcall>
</target>
<target name="deploy.ui.core">
<echo>Generate the UI and CORE deployment of app</echo>
<echo>Preparing ${build.dir}</echo>
<phingcall target="copy.files.delete.build"></phingcall>
<phingcall target="copy.files.app.public"></phingcall>
<phingcall target="copy.files.app.core"></phingcall>
</target>
<target name="deploy.ui">
<echo>Generate the UI and CORE deployment of app</echo>
<echo>Preparing ${build.dir}</echo>
<phingcall target="copy.files.delete.build"></phingcall>
<phingcall target="copy.files.app.public"></phingcall>
</target>
<target name="deploy.core">
<echo>Generate the UI and CORE deployment of app</echo>
<echo>Preparing ${build.dir}</echo>
<phingcall target="copy.files.delete.build"></phingcall>
<phingcall target="copy.files.app.core"></phingcall>
</target>
<fileset id="lib" dir="./agana/lib">
<date datetime="${lastbuild.date}" when="after" checkdirs="true"/>
<exclude name="**/.hg/" />
<exclude name="**/.hg/*" />
<exclude name="**/.hgignore" />
<exclude name="**/.hgtags" />
</fileset>
<fileset id="agana" dir="./agana/agana">
<date datetime="${lastbuild.date}" when="after" checkdirs="true"/>
<exclude name="**/.hg/" />
<exclude name="**/.hg/*" />
<exclude name="**/.hgignore" />
<exclude name="**/.hgtags" />
<exclude name="**/configs/" />
<exclude name="**/docs/" />
</fileset>
<fileset id="configs" dir="./configs">
<date datetime="${lastbuild.date}" when="after" checkdirs="true"/>
<exclude name="**/.hg/" />
<exclude name="**/.hg/*" />
<exclude name="**/.hgignore" />
<exclude name="**/.hgtags" />
</fileset>
<fileset id="app" dir="./app">
<date datetime="${lastbuild.date}" when="after" checkdirs="true"/>
<exclude name="**/.hg/" />
<exclude name="**/.hg/*" />
<exclude name="**/.hgignore" />
<exclude name="**/.hgtags" />
<exclude name="**/*.zip" />
<exclude name="**/assets/" />
<exclude name="**/jquery-ui-*/" />
</fileset>
<fileset id="app.teste" dir="./app">
<date datetime="${lastbuild.date}" when="after" checkdirs="true"/>
<include name="teste.txt" />
</fileset>
</project>