forked from stoicflame/enunciate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-site.xml
executable file
·442 lines (384 loc) · 17.5 KB
/
build-site.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
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
<?xml version="1.0" encoding="UTF-8"?>
<project name="site" basedir="." xmlns:mvn="urn:maven-artifact-ant">
<!--global references to other modules-->
<property name="lib.dir" value="${basedir}/lib"/>
<property name="static.docs.dir" value="${basedir}/documentation"/>
<property name="docs.dir" value="${basedir}/target/docs"/>
<property name="docs.resources.dir" value="${docs.dir}/resources"/>
<property name="javadoc.dir" value="${docs.dir}/api"/>
<property name="module.docs.dir" value="${docs.dir}"/>
<property name="getting.started.example.dir" value="${docs.dir}/wannabecool"/>
<target name="clean">
<delete dir="target"/>
</target>
<target name="init">
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant" loaderref="antlib.loader">
<classpath>
<fileset dir="${lib.dir}/build">
<include name="maven-ant-tasks-*.jar"/>
</fileset>
</classpath>
</typedef>
<mvn:pom id="parent.pom" file="${basedir}/pom.xml"/>
<echo message="Current version is: ${parent.pom.version}"/>
<property name="dist.name" value="enunciate-${parent.pom.version}"/>
<property name="full.sources.jar.name" value="enunciate-full-${parent.pom.version}-sources.jar"/>
<mvn:pom id="top.pom" file="${basedir}/top/pom.xml"/>
<fail message="Top pom version (${top.pom.version}) is not the same as the project pom version (${parent.pom.version}).">
<condition>
<not>
<equals arg1="${top.pom.version}" arg2="${parent.pom.version}"/>
</not>
</condition>
</fail>
<mvn:dependencies sourcesFilesetId="core.sources.fileset" pathId="core.libs.path" filesetId="core.libs.fileset" pomRefId="top.pom"/>
<mvn:dependencies filesetId="spring.libs.fileset" pathId="spring.libs.path">
<dependency groupId="org.codehaus.enunciate" artifactId="enunciate-spring-app" version="${top.pom.version}"/>
</mvn:dependencies>
<mvn:dependencies filesetId="spring2.libs.fileset" pathId="spring2.libs.path">
<dependency groupId="org.codehaus.enunciate" artifactId="enunciate-spring-app-rt" version="${top.pom.version}"/>
</mvn:dependencies>
<mvn:dependencies filesetId="spring3.libs.fileset" pathId="spring3.libs.path">
<dependency groupId="org.codehaus.enunciate" artifactId="enunciate-spring3-app-rt" version="${top.pom.version}"/>
</mvn:dependencies>
<mvn:dependencies filesetId="cxf.libs.fileset" pathId="cxf.libs.path">
<dependency groupId="org.codehaus.enunciate" artifactId="enunciate-cxf" version="${top.pom.version}"/>
</mvn:dependencies>
<mvn:dependencies filesetId="jboss.libs.fileset" pathId="jboss.libs.path">
<dependency groupId="org.codehaus.enunciate" artifactId="enunciate-jboss" version="${top.pom.version}"/>
</mvn:dependencies>
<mvn:dependencies filesetId="gwt.libs.fileset" pathId="gwt.libs.path">
<dependency groupId="org.codehaus.enunciate" artifactId="enunciate-gwt" version="${top.pom.version}"/>
</mvn:dependencies>
<mvn:dependencies filesetId="amf.libs.fileset" pathId="amf.libs.path">
<dependency groupId="org.codehaus.enunciate" artifactId="enunciate-amf" version="${top.pom.version}"/>
</mvn:dependencies>
<mvn:dependencies filesetId="swagger.libs.fileset" pathId="swagger.libs.path">
<dependency groupId="org.codehaus.enunciate" artifactId="enunciate-swagger" version="${top.pom.version}"/>
</mvn:dependencies>
<mvn:dependencies pathId="optional.libs.path" filesetId="optional.libs.fileset">
<dependency groupId="commons-fileupload" artifactId="commons-fileupload" version="1.2.1"/>
<dependency groupId="commons-io" artifactId="commons-io" version="1.3.2"/>
</mvn:dependencies>
<!--filters for docs-->
<loadfile srcfile="${static.docs.dir}/topnav.include.html" property="topnav"/>
<loadfile srcfile="${static.docs.dir}/sidenav.include.html" property="sidenav"/>
<loadfile srcfile="${static.docs.dir}/donations.include.html" property="donations"/>
<filterset id="nav.filterset">
<filter token="TOPNAV" value="${topnav}"/>
<filter token="SIDENAV" value="${sidenav}"/>
<filter token="DONATIONS" value="${donations}"/>
</filterset>
</target>
<target name="module-docs" depends="init" description="copies over the module documentation to the right place.">
<echo>Generating the module documentation...</echo>
<mkdir dir="target/module-docs"/>
<pathconvert pathsep="" "" dirsep="${file.separator}" property="module.src.file.args">
<path>
<fileset dir="${basedir}">
<include name="**/src/main/java/**/*.java"/>
<exclude name="**/samples/**"/>
<exclude name="**/*-rt/**"/>
<exclude name="**/integration-tests/**"/>
<exclude name="**/integration-test-support/**"/>
<exclude name="**/maven-enunciate-*/**"/>
<exclude name="**/enunciate-simple-archetype/**"/>
</fileset>
</path>
</pathconvert>
<dirname property="apt.output.dir" file="target/module-docs/any.txt"/>
<path id="module.docs.classpath">
<path refid="core.libs.path"/>
<path refid="spring.libs.path"/>
<path refid="cxf.libs.path"/>
<path refid="jboss.libs.path"/>
<path refid="gwt.libs.path"/>
<path refid="amf.libs.path"/>
<path refid="swagger.libs.path"/>
<path refid="optional.libs.path"/>
<path location="${java.home}/../lib/tools.jar"/>
<fileset dir="${ant.home}/lib">
<include name="*.jar"/>
</fileset>
</path>
<java classname="com.sun.tools.apt.Main" failonerror="true" fork="true">
<classpath location="${java.home}/../lib/tools.jar"/>
<arg value="-cp"/>
<arg pathref="module.docs.classpath"/>
<arg value="-s"/>
<arg value="${apt.output.dir}"/>
<arg value="-nocompile"/>
<arg line="-factory net.sf.jelly.apt.freemarker.FreemarkerProcessorFactory"/>
<arg value="-Atemplate=${basedir}/build-support/module.docs.fmt"/>
<arg line=""${module.src.file.args}""/>
</java>
</target>
<target name="copy-static-docs" depends="module-docs">
<echo>Copying XSD files to ${docs.resources.dir}...</echo>
<mkdir dir="${docs.resources.dir}"/>
<copy todir="${docs.resources.dir}">
<fileset dir="core/src">
<include name="**/*.xsd"/>
</fileset>
<mapper type="flatten"/>
</copy>
<echo>Copying static HTML files to ${docs.dir}...</echo>
<mkdir dir="${docs.dir}"/>
<copy todir="${docs.dir}" overwrite="true">
<!--first copy all the html docs (apply the filter).-->
<fileset dir="${static.docs.dir}">
<include name="**/*.html"/>
<exclude name="**/*.include.html"/>
</fileset>
<fileset dir="target/module-docs"/>
<filterset refid="nav.filterset"/>
</copy>
<echo>Copying static non-HTML files to ${docs.dir}...</echo>
<copy todir="${docs.dir}" overwrite="true">
<!--now copy all the non-html docs except the freemarker templates.-->
<fileset dir="${static.docs.dir}">
<exclude name="**/*.html"/>
<exclude name="**/*.fmt"/>
</fileset>
</copy>
<echo>Copying the license file to ${docs.dir}/license.txt...</echo>
<copy todir="${docs.dir}" overwrite="true" file="${basedir}/license.txt"/>
</target>
<target name="copy-getting-started-source" depends="init">
<taskdef name="java2html" classname="de.java2html.anttasks.Java2HtmlTask">
<classpath>
<fileset dir="${lib.dir}/build">
<include name="**/java2html*.jar"/>
</fileset>
</classpath>
</taskdef>
<mkdir dir="${getting.started.example.dir}/java_step1"/>
<java2html srcdir="src/samples/wannabecool/step1" destdir="${getting.started.example.dir}/java_step1" includes="**/*.java"/>
<copy todir="${getting.started.example.dir}/java_step1" overwrite="true">
<fileset dir="src/samples/wannabecool/step1/">
<exclude name="**/*.java"/>
</fileset>
</copy>
<mkdir dir="${getting.started.example.dir}/java_step4"/>
<java2html srcdir="src/samples/wannabecool/step4" destdir="${getting.started.example.dir}/java_step4" includes="**/*.java"/>
<copy todir="${getting.started.example.dir}/java_step4" overwrite="true">
<fileset dir="src/samples/wannabecool/step4/">
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="getting-started-examples" depends="copy-getting-started-source" description="Generated the getting started examples.">
<taskdef name="enunciate" classname="org.codehaus.enunciate.main.EnunciateTask">
<classpath refid="core.libs.path"/>
</taskdef>
<mkdir dir="${getting.started.example.dir}/step1"/>
<echo message="Generating the step1 examples...."/>
<enunciate target="build" basedir="src/samples/wannabecool/step1">
<include name="**/*.java"/>
<classpath refid="core.libs.path"/>
<export artifactId="docs" destination="${getting.started.example.dir}/step1"/>
</enunciate>
<mkdir dir="${getting.started.example.dir}/step4"/>
<echo message="Generating the step4 examples...."/>
<copy file="src/samples/wannabecool/step4/LICENSE.txt" todir="${user.dir}" overwrite="true"/>
<enunciate target="build" basedir="src/samples/wannabecool/step4" configFile="src/samples/wannabecool/step4/enunciate.xml">
<include name="**/*.java"/>
<classpath refid="core.libs.path"/>
<export artifactId="docs" destination="${getting.started.example.dir}/step4"/>
</enunciate>
<delete file="${user.dir}/LICENSE.txt" failonerror="false"/>
</target>
<target name="javadoc" depends="init">
<mkdir dir="${javadoc.dir}"/>
<echo>Building the Javadocs to ${javadoc.dir}...</echo>
<property name="title" value="enunciate-docs"/>
<javadoc doctitle="enunciate" windowtitle="enunciate" destdir="${javadoc.dir}" author="true" version="true" packagenames="*" verbose="false">
<fileset dir="${basedir}">
<include name="**/src/main/java/**/*.java"/>
<exclude name="**/samples/**"/>
<exclude name="**/integration-tests/**"/>
<exclude name="**/integration-test-support/**"/>
<exclude name="**/maven-enunciate-*/**"/>
<exclude name="**/enunciate-simple-archetype/**"/>
</fileset>
<sourcepath>
<dirset dir="${basedir}">
<include name="**/src/main/resources"/>
<exclude name="**/samples/**"/>
<exclude name="**/integration-tests/**"/>
<exclude name="**/integration-test-support/**"/>
<exclude name="**/maven-enunciate-*/**"/>
<exclude name="**/enunciate-simple-archetype/**"/>
</dirset>
</sourcepath>
<classpath>
<path refid="core.libs.path"/>
<path refid="spring.libs.path"/>
<path refid="spring2.libs.path"/>
<path refid="spring3.libs.path"/>
<path refid="cxf.libs.path"/>
<path refid="jboss.libs.path"/>
<path refid="gwt.libs.path"/>
<path refid="amf.libs.path"/>
<path refid="swagger.libs.path"/>
<pathelement location="${java.home}/../lib/tools.jar"/>
<path path="${java.class.path}"/>
</classpath>
</javadoc>
</target>
<target name="docs" description="generate documentation and javadoc (global)" depends="copy-static-docs, javadoc, getting-started-examples, schemas"/>
<target name="full-sources-jar" depends="init" description="Creates the full jar.">
<mkdir dir="target/full-sources"/>
<unzip dest="target/full-sources">
<fileset refid="core.sources.fileset"/>
<patternset>
<include name="**/org/codehaus/enunciate/**"/>
</patternset>
</unzip>
<jar destfile="target/${full.sources.jar.name}" basedir="target/full-sources"/>
</target>
<target name="copy-dist-libs" depends="init">
<mkdir dir="target/lib"/>
<!--load the maven tasks for handling dependencies-->
<copy todir="target/lib">
<fileset refid="core.libs.fileset"/>
<mapper type="flatten"/>
</copy>
<!--copy the spring module plus deps-->
<mkdir dir="target/lib/modules/spring"/>
<copy todir="target/lib/modules/spring">
<fileset refid="spring.libs.fileset"/>
<fileset refid="spring2.libs.fileset"/>
<mapper type="flatten"/>
</copy>
<delete>
<fileset dir="target/lib/modules/spring">
<present targetdir="target/lib"/>
</fileset>
</delete>
<!--copy the cxf module plus deps-->
<mkdir dir="target/lib/modules/cxf"/>
<copy todir="target/lib/modules/cxf">
<fileset refid="cxf.libs.fileset"/>
<mapper type="flatten"/>
</copy>
<delete>
<fileset dir="target/lib/modules/cxf">
<present targetdir="target/lib"/>
</fileset>
</delete>
<!--copy the jboss module plus deps-->
<mkdir dir="target/lib/modules/jboss"/>
<copy todir="target/lib/modules/jboss">
<fileset refid="jboss.libs.fileset"/>
<mapper type="flatten"/>
</copy>
<delete>
<fileset dir="target/lib/modules/jboss">
<present targetdir="target/lib"/>
</fileset>
</delete>
<!--copy the gwt module plus deps-->
<mkdir dir="target/lib/modules/gwt"/>
<copy todir="target/lib/modules/gwt">
<fileset refid="gwt.libs.fileset"/>
<mapper type="flatten"/>
</copy>
<delete>
<fileset dir="target/lib/modules/gwt">
<present targetdir="target/lib"/>
</fileset>
</delete>
<!--copy the amf module plus deps-->
<mkdir dir="target/lib/modules/amf"/>
<copy todir="target/lib/modules/amf">
<fileset refid="amf.libs.fileset"/>
<mapper type="flatten"/>
</copy>
<delete>
<fileset dir="target/lib/modules/amf">
<present targetdir="target/lib"/>
</fileset>
</delete>
<!--copy the swagger module plus deps-->
<mkdir dir="target/lib/modules/swagger"/>
<copy todir="target/lib/modules/swagger">
<fileset refid="swagger.libs.fileset"/>
<mapper type="flatten"/>
</copy>
<delete>
<fileset dir="target/lib/modules/swagger">
<present targetdir="target/lib"/>
</fileset>
</delete>
</target>
<target name="scripts" depends="copy-dist-libs" description="Generates the executable scripts.">
<path id="script.classpath">
<fileset dir="target">
<include name="lib/*.jar"/>
</fileset>
</path>
<pathconvert property="unix.script.classpath" targetos="unix" refid="script.classpath">
<mapper type="regexp" from="/(lib/.*.jar)$$" to="$ENUNCIATE_HOME/\1"/>
</pathconvert>
<pathconvert property="windows.script.classpath" targetos="windows" refid="script.classpath">
<mapper type="regexp" from="/(lib/.*.jar)$$" to="%ENUNCIATE_HOME%\\\1"/>
</pathconvert>
<mkdir dir="target/bin"/>
<copy file="src/bin/enunciate.sh" tofile="target/bin/enunciate" overwrite="true">
<filterset begintoken="{" endtoken="}">
<filter token="UNIX_CLASSPATH" value="${unix.script.classpath}"/>
</filterset>
</copy>
<chmod perm="766" file="target/bin/enunciate"/>
<copy file="src/bin/enunciate.bat" tofile="target/bin/enunciate.bat" overwrite="true">
<filterset begintoken="{" endtoken="}">
<filter token="WINDOWS_CLASSPATH" value="${windows.script.classpath}"/>
</filterset>
</copy>
</target>
<target name="samples" depends="init" description="packages up the samples">
<mkdir dir="target/samples"/>
<exec executable="mvn" dir="target/samples">
<arg value="archetype:generate"/>
<arg value="-DarchetypeGroupId=org.codehaus.enunciate.archetypes"/>
<arg value="-DarchetypeArtifactId=enunciate-simple-archetype"/>
<arg value="-DarchetypeVersion=${parent.pom.version}"/>
<arg value="-DgroupId=org.codehaus.enunciate"/>
<arg value="-DartifactId=wannabecool"/>
<arg value="-DarchetypeRepository=local"/>
<arg value="-Dbasedir=target/samples"/>
<arg value="-DinteractiveMode=false"/>
</exec>
</target>
<target name="schemas" depends="init">
<mkdir dir="${docs.dir}/schemas"/>
<copy todir="${docs.dir}/schemas">
<fileset dir="top/src/main/resources/META-INF">
<include name="*.xsd"/>
</fileset>
</copy>
</target>
<target name="dist" depends="docs, scripts, samples, copy-dist-libs, full-sources-jar" description="Creates the distribution bundle.">
<!--create the zip dist.-->
<zip destfile="target/${dist.name}.zip">
<zipfileset dir="${docs.dir}" prefix="${dist.name}/docs" excludes="*.txt"/>
<zipfileset dir="${basedir}" prefix="${dist.name}/docs" includes="license.txt notice.txt"/>
<zipfileset dir="target/bin" prefix="${dist.name}/bin"/>
<zipfileset dir="target/lib" prefix="${dist.name}/lib"/>
<zipfileset dir="target/samples" prefix="${dist.name}/samples"/>
<zipfileset dir="." includes="license.txt notice.txt" prefix="${dist.name}"/>
<zipfileset dir="target" prefix="${dist.name}" includes="enunciate-full*.jar"/>
</zip>
<!--create the tar.gz dist.-->
<tar destfile="target/${dist.name}.tar.gz" compression="gzip">
<tarfileset dir="${docs.dir}" prefix="${dist.name}/docs" excludes="*.txt"/>
<tarfileset dir="${basedir}" prefix="${dist.name}/docs" includes="license.txt notice.txt"/>
<tarfileset dir="target/bin" prefix="${dist.name}/bin" mode="766"/>
<tarfileset dir="target/lib" prefix="${dist.name}/lib"/>
<tarfileset dir="target/samples" prefix="${dist.name}/samples"/>
<tarfileset dir="." includes="license.txt notice.txt" prefix="${dist.name}"/>
<tarfileset dir="target" prefix="${dist.name}" includes="enunciate-full*.jar"/>
</tar>
</target>
</project>