-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.xml
357 lines (301 loc) · 17.3 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
356
357
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ This file (build.xml) is part of the Echolot Project (hereinafter "Echolot").
~ Copyright (C) 2008-2011 eXXcellent Solutions GmbH.
~
~ Version: MPL 1.1/GPL 2.0/LGPL 2.1
-->
<project name="echolot" default="dist" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<property name="dir.dist" value="dist"/>
<property name="dir.site" value="target/site"/>
<property name="dir.tools" value="build-tools"/>
<property name="profile" value="custom"/>
<property file="etc/${profile}-build.properties"/> <!-- defaults to read a custom-build.properties -->
<property file="etc/build.properties"/>
<import file="build-tools/build-tools.xml"/>
<property name="app.path" value="echolot-app"/>
<property name="webcontainer.path" value="echolot-webcontainer"/>
<property name="demo.path" value="echolot-demo"/>
<property name="licensing.path" value="licensing"/>
<property name="documentation.path" value="documentation"/>
<!-- Minimize -->
<target name="minimize" depends="clean"
description="Removes all non-essential files, including Eclipse temporary/build output files">
<delete dir="${dir.build}"/>
<delete dir="${app.path}/lib"/>
<delete dir="${webcontainer.path}/lib"/>
</target>
<target name="clean" unless="skip.clean">
<delete dir="${dir.dist}"/>
<delete dir="target"/>
<ant antfile="${app.path}/build.xml" target="clean.module" inheritall="false" inheritrefs="false"/>
<ant antfile="${webcontainer.path}/build.xml" target="clean.module" inheritall="false" inheritrefs="false"/>
<ant antfile="${demo.path}/build.xml" target="clean.module" inheritall="false" inheritrefs="false"/>
</target>
<!-- Dependencies -->
<target name="-check.dependencies">
<available file="${app.path}/lib/echo3-app-${echo.version}.jar" property="dependencies.present"/>
</target>
<target name="mvn.dependencies" depends="-mvn.inittasks"
description="Fetches the required dependencies from Maven Central into the lib dir">
<artifact:dependencies filesetId="app.dependency.fileset">
<dependency groupId="com.nextapp" artifactId="echo3-app" version="${echo.version}"/>
<dependency groupId="com.nextapp" artifactId="echo3-app" version="${echo.version}" classifier="sources"/>
<dependency groupId="com.nextapp" artifactId="echo3-webcontainer" version="${echo.version}"/>
<dependency groupId="com.nextapp" artifactId="echo3-webcontainer" version="${echo.version}" classifier="sources"/>
<dependency groupId="javax.servlet" artifactId="servlet-api" version="2.4"/>
<dependency groupId="javax.servlet" artifactId="servlet-api" version="2.4" classifier="sources"/>
</artifact:dependencies>
<artifact:dependencies filesetId="webcontainer.dependency.fileset">
<dependency groupId="javax.servlet" artifactId="servlet-api" version="2.4"/>
<dependency groupId="javax.servlet" artifactId="servlet-api" version="2.4" classifier="sources"/>
<dependency groupId="org.codehaus.jettison" artifactId="jettison" version="1.1"/>
<dependency groupId="org.codehaus.jettison" artifactId="jettison" version="1.1" classifier="sources"/>
<dependency groupId="com.thoughtworks.xstream" artifactId="xstream" version="1.4.4"/>
<dependency groupId="com.thoughtworks.xstream" artifactId="xstream" version="1.4.4" classifier="sources"/>
<dependency groupId="com.googlecode.jslint4java" artifactId="jslint4java-ant" version="1.4.2"/>
<dependency groupId="junit" artifactId="junit" version="4.5"/>
</artifact:dependencies>
<copy todir="${app.path}/lib">
<fileset refid="app.dependency.fileset" />
<mapper type="flatten" />
</copy>
<copy todir="${webcontainer.path}/lib">
<fileset refid="webcontainer.dependency.fileset" />
<mapper type="flatten" />
</copy>
</target>
<target name="dependencies" depends="-check.dependencies" unless="dependencies.present"
description="Spot checks for dependency JARs availability and fetches via Maven Central if required">
<antcall target="mvn.dependencies"/>
</target>
<target name="generate" description="Call generation targets of all modules">
<ant antfile="${app.path}/build.xml" target="generate" inheritall="false" inheritrefs="false"/>
<ant antfile="${webcontainer.path}/build.xml" target="generate" inheritall="false" inheritrefs="false"/>
<ant antfile="${demo.path}/build.xml" target="generate" inheritall="false" inheritrefs="false"/>
</target>
<target name="build" depends="dependencies" description="Build echolot ">
<mkdir dir="dist"/>
<ant antfile="${app.path}/build.xml" target="build.module" inheritall="false" inheritrefs="false"/>
<ant antfile="${webcontainer.path}/build.xml" target="build.module" inheritall="false" inheritrefs="false"/>
<ant antfile="${demo.path}/build.xml" target="build.module" inheritall="false" inheritrefs="false"/>
</target>
<target name="test" depends="dependencies" description="Run all tests available for echolot">
<ant antfile="${app.path}/build.xml" target="test" inheritall="false" inheritrefs="false"/>
<ant antfile="${webcontainer.path}/build.xml" target="test" inheritall="false" inheritrefs="false"/>
<ant antfile="${demo.path}/build.xml" target="test" inheritall="false" inheritrefs="false"/>
</target>
<target name="run" depends="dependencies" description="Builds the Echolot demo application and runs it inline">
<ant antfile="${demo.path}/build.xml" target="run" inheritall="false" inheritrefs="false" />
</target>
<target name="deploy" depends="dependencies" description="Deploys the demo instance of this application">
<ant antfile="echolot-demo/build.xml" target="war" inheritall="false" inheritrefs="false"/>
<ant antfile="echolot-demo/build.xml" target="remote.deploy" inheritall="false" inheritrefs="false"/>
</target>
<target name="dist" depends="clean, dependencies" description="Generates a complete echolot distribution">
<echo>=== Building distributions of modules</echo>
<ant antfile="${app.path}/build.xml" target="dist" inheritall="false" inheritrefs="false"/>
<ant antfile="${webcontainer.path}/build.xml" target="dist" inheritall="false" inheritrefs="false"/>
<ant antfile="${demo.path}/build.xml" target="dist" inheritall="false" inheritrefs="false"/>
<!--
<antcall target="releasenotes"/>
-->
<property name="dir.build.dist" value="${dir.build}/dist"/>
<echo>=== Assembling now overall echolot distribution</echo>
<mkdir dir="${dir.build}"/>
<mkdir dir="${dir.build.dist}"/>
<mkdir dir="${dir.build.dist}/bin"/>
<mkdir dir="${dir.build.dist}/demo"/>
<mkdir dir="${dir.build.dist}/documentation"/>
<mkdir dir="${dir.build.dist}/licensing"/>
<copy todir="${dir.build.dist}/bin">
<fileset dir="${app.path}/dist" includes="*.*"/>
<fileset dir="${webcontainer.path}/dist" includes="*.*"/>
</copy>
<copy todir="${dir.build.dist}/bin/lib">
<fileset dir="${app.path}/dist/lib" includes="*.*"/>
<fileset dir="${webcontainer.path}/dist/lib" includes="*.*"/>
</copy>
<copy todir="${dir.build.dist}">
<fileset dir="${basedir}" includes="readme*.txt"/>
<fileset dir="${basedir}" includes="release*.txt"/>
</copy>
<copy todir="${dir.build.dist}/documentation">
<fileset dir="${documentation.path}" includes="developer-guide/*.*"/>
</copy>
<copy todir="${dir.build.dist}/demo">
<fileset dir="${demo.path}/dist" includes="*.*"/>
</copy>
<copy todir="${dir.build.dist}/licensing">
<fileset dir="${licensing.path}" includes="*.*"/>
</copy>
<!-- zip it all together -->
<zip destfile="${dir.dist}/${ant.project.name}-${release.version}-distribution.zip">
<fileset dir="${dir.build.dist}"/>
</zip>
</target>
<!--
=== SITE RELATED TARGETS ========================================================================================
-->
<target name="site" depends="dist, site.javadoc"
description="Generates a web site of echolot with download, test-results, etc.">
<mkdir dir="${dir.site}"/>
<concat destfile="${dir.site}/test/TEST-RESULTS.txt" append="true">
<fileset dir="${app.path}/target/test-reports/" includes="*.txt"/>
<fileset dir="${webcontainer.path}/target/test-reports/" includes="*.txt"/>
</concat>
<copy todir="${dir.site}">
<fileset dir="documentation/project-site"/>
<filterset refid="site.filters"/>
</copy>
</target>
<target name="site.javadoc" description="Creates a joined javadoc for all modules">
<mkdir dir="${dir.site}/apidoc"/>
<echo message="Creating joined JavaDoc for echolot"/>
<javadoc author="false"
version="true"
use="true"
windowtitle="echolot API"
destdir="${dir.site}/apidoc"
useexternalfile="yes"
encoding="utf-8">
<doctitle><![CDATA[<h1>echolot API</h1>]]></doctitle>
<bottom><![CDATA[<i>Copyright applies due to LICENCE. All Rights Reserved.</i>]]></bottom>
<link offline="true" href="http://java.sun.com/j2se/1.5.0/docs/api/" packagelistLoc="${dir.sun.javadoc}"/>
<classpath>
<fileset dir="." includes="**/main/lib/**/*.jar" excludes="**/*-sources.jar,**/*-javadoc.jar"/>
</classpath>
<packageset dir="${app.path}/src/main/java" defaultexcludes="yes">
<include name="*/**"/>
</packageset>
</javadoc>
</target>
<target name="site.test" description="Creates a testsite for testing the components">
<mkdir dir="${dir.site}/test"/>
<echo message="Creating test application site for echolot"/>
<property name="dir.test.web" value="${webcontainer.path}/src/test/web/"/>
<property name="dir.main.resources" value="${webcontainer.path}/src/main/resources"/>
<!--
1. gather test application
-->
<copy todir="${dir.site}/test/image">
<fileset includes="**/*" dir="${dir.test.web}/image"/>
</copy>
<copy todir="${dir.site}/test/lib">
<fileset includes="**/*" dir="${dir.test.web}/lib"/>
</copy>
<copy todir="${dir.site}/test/testscreen">
<fileset includes="**/*" dir="${dir.test.web}/testscreen"/>
</copy>
<!--
2. gather libraries used in test
-->
<copy todir="${dir.site}/test/js">
<fileset dir="${dir.main.resources}/js" includes="**/*"/>
</copy>
<!--
3. include index.html and rewrite the path to the js files.
-->
<copy todir="${dir.site}/test">
<fileset dir="${dir.test.web}" includes="*.html"/>
</copy>
<replaceregexp byline="true">
<regexp pattern="../../main/resources/js"/>
<substitution expression="js/"/>
<fileset dir="${dir.site}/test">
<include name="index.html"/>
</fileset>
</replaceregexp>
<!--
4. include a whole node.js based server
-->
<copy todir="${dir.site}/test">
<fileset dir="${dir.test.web}" includes="*.js"/>
</copy>
</target>
<!-- Maven deployment -->
<target name="-mvn.inittasks" unless="mvntasks.initialized">
<taskdef resource="de/exxcellent/ant/tasks.properties" classpath="resource/maven/ant-exxtasks-1.0.jar"/>
<extendclasspath path="resource/maven/maven-ant-tasks-2.1.3.jar"/>
<available property="mvntasks.initialized" classname="org.apache.maven.project.MavenProject"/>
</target>
<target name="-mvn.generate.pom">
<mkdir dir="${dir.build}/maven-pom"/>
<copy todir="${dir.build}/maven-pom" filtering="true" overwrite="true">
<fileset dir="resource/maven" includes="*.xml"/>
<filterset id="maven.pom.filters" begintoken="$${" endtoken="}">
<filter token="version" value="${release.version}"/>
<filter token="echo.version" value="${echo.version}"/>
</filterset>
</copy>
</target>
<target name="mvn.install" depends="dist, -mvn.generate.pom, -mvn.inittasks"
description="Installs the current release into the local maven repository">
<!-- Install Echo API module -->
<artifact:pom id="app-pom" file="${dir.build}/maven-pom/echolot-app-pom.xml" />
<artifact:install file="${dir.build.dist}/bin/echolot-app-${release.version}.jar">
<pom refid="app-pom"/>
<attach file="${dir.build.dist}/bin/echolot-app-${release.version}-sources.jar" type="jar" classifier="sources"/>
<attach file="${dir.build.dist}/bin/echolot-app-${release.version}-javadoc.jar" type="jar" classifier="javadoc"/>
</artifact:install>
<!-- Install Echo Web Servlet module -->
<artifact:pom id="webcontainer-pom" file="${dir.build}/maven-pom/echolot-webcontainer-pom.xml" />
<artifact:install file="${dir.build.dist}/bin/echolot-webcontainer-${release.version}.jar">
<pom refid="webcontainer-pom"/>
<attach file="${dir.build.dist}/bin/echolot-webcontainer-${release.version}-sources.jar" type="jar" classifier="sources"/>
<attach file="${dir.build.dist}/bin/echolot-webcontainer-${release.version}-javadoc.jar" type="jar" classifier="javadoc"/>
</artifact:install>
</target>
<target name="mvn.snapshot" depends="dist, -mvn.generate.pom, -mvn.inittasks"
description="Deploy snapshot version to configured Maven snapshot repository">
<!-- The artifact:deploy tasks do not repesct settings.xml for proxy/auth, so we use the mvn task -->
<!-- Deploy Echo App API module. -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-deploy-plugin:2.6:deploy-file" />
<arg value="-Durl=${maven.repository.snapshots.url}" />
<arg value="-DrepositoryId=${maven.repository.snapshots.id}" />
<arg value="-DpomFile=${dir.build}/maven-pom/echolot-app-pom.xml" />
<arg value="-Dfile=${dir.build.dist}/bin/echolot-app-${release.version}.jar" />
<arg value="-Dsources=${dir.build.dist}/bin/echolot-app-${release.version}-sources.jar" />
<arg value="-Djavadoc=${dir.build.dist}/bin/echolot-app-${release.version}-javadoc.jar" />
<arg value="-e" />
</artifact:mvn>
<!-- Deploy Echo Webcontainer API module. -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-deploy-plugin:2.6:deploy-file" />
<arg value="-Durl=${maven.repository.snapshots.url}" />
<arg value="-DrepositoryId=${maven.repository.snapshots.id}" />
<arg value="-DpomFile=${dir.build}/maven-pom/echolot-webcontainer-pom.xml" />
<arg value="-Dfile=${dir.build.dist}/bin/echolot-webcontainer-${release.version}.jar" />
<arg value="-Dsources=${dir.build.dist}/bin/echolot-webcontainer-${release.version}-sources.jar" />
<arg value="-Djavadoc=${dir.build.dist}/bin/echolot-webcontainer-${release.version}-javadoc.jar" />
<arg value="-e" />
</artifact:mvn>
</target>
<target name="mvn.stage" depends="dist, -mvn.generate.pom, -mvn.inittasks"
description="Deploy snapshot version to configured Maven snapshot repository">
<macrodef name="deploysigned">
<attribute name="module"/>
<attribute name="file"/>
<attribute name="classifier"/>
<sequential>
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${maven.repository.staging.url}" />
<arg value="-DrepositoryId=${maven.repository.staging.id}" />
<arg value="-DpomFile=${dir.build}/maven-pom/echolot-@{module}-pom.xml" />
<arg value="-Dfile=${dir.build.dist}/bin/@{file}" />
<arg value="-Dclassifier=@{classifier}" />
<arg value="-e" />
<arg value="-Pgpg" />
</artifact:mvn>
</sequential>
</macrodef>
<deploysigned module="app" classifier="" file="echolot-app-${release.version}.jar"/>
<deploysigned module="app" classifier="sources" file="echolot-app-${release.version}-sources.jar"/>
<deploysigned module="app" classifier="javadoc" file="echolot-app-${release.version}-javadoc.jar"/>
<deploysigned module="webcontainer" classifier="" file="echolot-webcontainer-${release.version}.jar"/>
<deploysigned module="webcontainer" classifier="sources" file="echolot-webcontainer-${release.version}-sources.jar"/>
<deploysigned module="webcontainer" classifier="javadoc" file="echolot-webcontainer-${release.version}-javadoc.jar"/>
</target>
</project>