-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathbuild.xml
355 lines (292 loc) · 13.9 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
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
<?xml version="1.0"?>
<!-- ===================================================================
Build file for 'nextreports-server' application
Most useful targets:
- compile -> compile all java sources
- jar -> creates the application's jar file
- clean -> removes all the generated files and directories
- war -> create war
- dist -> creates the distribution
- release -> creates the artifacts
Authors:
Decebal Suiu <decebal.suiu@asf.ro>
client
Copyright:
Copyright (c) 2009-2013, The NextReports team. All rights reserved.
==================================================================== -->
<project name="nextreports-server" default="release" xmlns:ivy="antlib:org.apache.ivy.ant">
<property file="local.properties"/>
<property file="build.properties"/>
<property name="ivy.lib.dir" value="${app.lib}"/>
<import file="ivy-build.xml"/>
<!-- Classpath -->
<path id="classpath">
<fileset dir="${app.jetty.lib}" includes="*.jar"/>
<fileset dir="${app.lib}" includes="*.jar"/>
<fileset dir="${ant.tasks.dir}" includes="*.jar"/>
</path>
<!-- ================================================================== -->
<!-- I V Y . I N I T -->
<!-- ================================================================== -->
<target name="ivy.init" depends="ivy.download">
<!-- Download the ivy jar and defines ivy tasks -->
<path id="ivy.lib.path">
<pathelement location="${ivy.jar.file}"/>
</path>
<!-- The ivy tasks are dependent by ivy.lib.path declared above -->
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
</target>
<!-- ================================================================== -->
<!-- I V Y . R E S O L V E -->
<!-- ================================================================== -->
<!-- resolve dependent libraries -->
<target name="ivy.resolve" depends="ivy.init">
<ivy:configure file="ivysettings.xml"/>
<ivy:resolve conf="*(public)" file="ivy.xml"/>
<!--
<ivy:retrieve pattern="${ivy.lib.dir}/[artifact].[ext]" conf="runtime"/>
-->
<ivy:retrieve sync="true" changing="true" overwriteMode="newer"/>
<mkdir dir="ivy-report"/>
<ivy:report todir="ivy-report"/>
</target>
<!-- ================================================================== -->
<!-- C O M P I L E -->
<!-- ================================================================== -->
<target name="compile" depends="ivy.resolve,version">
<!-- Create the ${app.classes} directory -->
<mkdir dir="${app.classes}"/>
<!-- Compile the java code from ${app.src} into ${app.classes} -->
<javac
source="${javac.version}"
target="${javac.version}"
srcdir="${app.src}"
excludes="**/JettyLauncher.java"
destdir="${app.classes}"
debug="${javac.debug}"
verbose="${javac.verbose}"
deprecation="${javac.deprecation}"
classpathref="classpath"
executable="${javac.executable}"
memoryInitialSize="${javac.memory.initial}"
memoryMaximumSize="${javac.memory.maximum}"
fork="${javac.fork}">
<!--
<compilerarg value="-Xlint:unchecked"/>
-->
</javac>
<!-- Move logo to classpath so an installed next-server can found it for pushing to JCR storage -->
<copy file="${app.home}/webapp/themes/default/images/Nextreports-logo.png" todir="${app.classes}"/>
</target>
<!-- ================================================================== -->
<!-- J A R -->
<!-- ================================================================== -->
<target name="jar" depends="compile">
<!-- Create jar file -->
<jar jarfile="${app.target}/${app.jar}" compress="true">
<fileset dir="${app.classes}" excludes="ro/nextreports/server/JettyLauncher.class"/>
<fileset dir="${app.home}" includes="public.key"/>
<fileset dir="${app.src}">
<include name="**/*.gif"/>
<include name="**/*.png"/>
<include name="**/*.jpg"/>
<include name="**/*.properties"/>
<include name="**/*.xml"/>
<include name="**/*zip"/>
</fileset>
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Implementation-Version" value="${app.version}"/>
</manifest>
</jar>
</target>
<!-- ================================================================== -->
<!-- W A R -->
<!-- ================================================================== -->
<target name="war" depends="compile">
<!-- Delete old WAR file -->
<delete file="${app.name}.war"/>
<!-- Create WAR file -->
<war destfile="${app.target}/${app.war}" webxml="${app.home}/webapp/WEB-INF/web.xml">
<classes dir="${app.classes}"/>
<classes dir="${app.src}">
<exclude name="**/*.java"/>
</classes>
<classes dir="${app.config}"/>
<classes dir="${app.home}">
<include name="public.key"/>
</classes>
<fileset dir="${app.home}/webapp">
<exclude name="WEB-INF/web.xml"/>
<exclude name="reports/**"/>
</fileset>
<lib dir="${app.lib}">
<exclude name="jersey-client-*.jar"/>
</lib>
<lib dir="jdbc-drivers"/>
</war>
</target>
<!-- ================================================================== -->
<!-- C L I E N T . J A R -->
<!-- ================================================================== -->
<target name="client.jar" depends="compile">
<jar destfile="${app.target}/${app.client.jar}" compress="true">
<fileset dir="${app.classes}">
<include name="ro/nextreports/server/api/client/**/*.class"/>
<include name="ro/nextreports/server/exception/DuplicationException.class"/>
</fileset>
</jar>
</target>
<!-- ================================================================== -->
<!-- C L I E N T -->
<!-- ================================================================== -->
<target name="client" depends="client.jar">
<property name="client.zip.dir" location="${app.target}/${app.name}-client-${app.version}"/>
<!-- Create a temporary dir -->
<mkdir dir="${client.zip.dir}"/>
<!-- Copy client jar file in the temporary dir -->
<copy file="${app.target}/${app.client.jar}" todir="${client.zip.dir}"/>
<!-- Copy some files in the temporary dir -->
<copy todir="${client.zip.dir}">
<fileset dir="${app.lib}">
<include name="jersey-client-*.jar"/>
<include name="jersey-core-*.jar"/>
<include name="jsr311-api-*.jar"/>
<include name="commons-logging-*.jar"/>
<include name="commons-codec-*.jar"/>
<include name="xstream-*.jar"/>
</fileset>
<fileset dir="${app.src}">
<include name="ro/nextreports/server/api/client/test/*.java"/>
</fileset>
</copy>
<!-- Create the zip with dist -->
<zip destfile="${app.target}/${app.name}-client-${app.version}.zip" basedir="${client.zip.dir}"/>
<!-- Delete the temporary dir -->
<delete dir="${client.zip.dir}"/>
</target>
<!-- ================================================================== -->
<!-- V E R S I O N -->
<!-- ================================================================== -->
<target name="version">
<!-- Add ant task -->
<taskdef
name="jreleaseinfo"
classname="ch.oscg.jreleaseinfo.anttask.JReleaseInfoAntTask"
classpath="${ant.tasks.dir}/jreleaseinfo-1.3.0.jar"
/>
<property name="app.src.dir" location="${app.src}"/>
<property environment="env"/>
<!-- 'BUILD_NUMBER' variable is created by HUDSON CI SERVER before each build run -->
<property name="env.BUILD_NUMBER" value="0"/>
<property name="build.number" value="${env.BUILD_NUMBER}"/>
<!-- Create release info -->
<jreleaseinfo
classname="ReleaseInfo"
packagename="ro.nextreports.server"
targetdir="${app.src.dir}"
project="NextReports Server"
version="${app.version}">
<parameter name="company" value="NextReports"/>
<parameter name="home" value="http://www.next-reports.com"/>
<parameter name="buildNumber" value="${build.number}" type="int"/>
<parameter name="copyright" value="${app.copyright}"/>
</jreleaseinfo>
</target>
<!-- ================================================================== -->
<!-- D A T A . Z I P -->
<!-- ================================================================== -->
<target name="data.zip">
<property name="data.zip.dir" location="${app.target}/${app.version}"/>
<!-- Create a temporary dir -->
<mkdir dir="${data.zip.dir}"/>
<!-- Copy demo database in temporary dir -->
<copy todir="${data.zip.dir}">
<!-- Copy demo -->
<fileset dir="${app.home}">
<include name="demo/**"/>
</fileset>
</copy>
<!-- Copy demo jcr data in temporary dir -->
<copy todir="${data.zip.dir}/data">
<!-- Copy demo -->
<fileset dir="${app.home}/data_demo">
<include name="**"/>
</fileset>
</copy>
<!-- Create the zip with data dist -->
<zip destfile="${app.target}/${app.name}-data-${app.version}.zip" basedir="${app.target}/${app.version}"/>
<copy file="${app.target}/${app.name}-data-${app.version}.zip" todir="${app.src}"/>
<!-- Delete the temporary dir -->
<delete dir="${app.target}/${app.version}"/>
</target>
<!-- ================================================================== -->
<!-- D I S T -->
<!-- ================================================================== -->
<target name="dist" depends="war">
<!-- Copy the minimum jetty distributuion -->
<copy todir="${app.dist}">
<fileset dir="jetty"/>
<fileset dir="${app.home}">
<include name="run.bat"/>
<include name="run.sh"/>
</fileset>
</copy>
<!-- Make run.sh executable -->
<chmod file="${app.dist}/run.sh" perm="ugo+rx"/>
<property name="jetty.webapps" value="${app.dist}/webapps"/>
<copy file="${app.target}/${app.war}" todir="${jetty.webapps}"/>
<mkdir dir="${jetty.webapps}/${app.name}"/>
<unzip src="${jetty.webapps}/${app.war}" dest="${jetty.webapps}/${app.name}"/>
<delete file="${jetty.webapps}/${app.war}"/>
</target>
<!-- ================================================================== -->
<!-- D I S T . Z I P -->
<!-- ================================================================== -->
<target name="dist.zip" depends="dist">
<property name="app.zip.dir" location="${app.target}/${app.version}/${app.name}-${app.version}"/>
<!-- Create a temporary dir -->
<mkdir dir="${app.zip.dir}"/>
<!-- Copy dist in temporary dir -->
<copy todir="${app.zip.dir}">
<fileset dir="${app.dist}"/>
</copy>
<!-- Replace some variables -->
<replace file="${app.zip.dir}/etc/jetty.xml">
<replacetoken>@httpPort@</replacetoken>
<replacevalue>8081</replacevalue>
</replace>
<replace file="${app.zip.dir}/contexts/reports.xml">
<replacetoken>@reportsHome@</replacetoken>
<replacevalue>reports</replacevalue>
</replace>
<!-- Create the zip with dist -->
<zip destfile="${app.target}/${app.name}-${app.version}.zip"
basedir="${app.target}/${app.version}"
/>
<!-- Delete the temporary dir -->
<delete dir="${app.target}/${app.version}"/>
</target>
<!-- ================================================================== -->
<!-- R E L E A S E -->
<!-- ================================================================== -->
<target name="release" depends="dist.zip">
<copy todir="${app.artifacts}">
<fileset dir="${app.target}">
<include name="${app.name}*"/>
</fileset>
</copy>
</target>
<!-- ================================================================== -->
<!-- C L E A N -->
<!-- ================================================================== -->
<target name="clean">
<delete dir="${app.target}"/>
<delete dir="${app.dist}"/>
<delete dir="${app.artifacts}"/>
<delete dir="${ivy.lib.dir}"/>
</target>
<target name="ivy.cleancache">
<ivy:cleancache/>
</target>
</project>