forked from dita-ot/dita-ot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
378 lines (342 loc) · 14.2 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
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
<?xml version="1.0" encoding="UTF-8"?>
<!-- This file is part of the DITA Open Toolkit project.
See the accompanying license.txt file for applicable licenses.-->
<!-- (c) Copyright IBM Corp. 2004, 2006 All Rights Reserved. -->
<!-- build whole binary package for DITA Open Toolkit -->
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="build_DITA-OT_package" default="build" basedir=".">
<description>Build binary packages for DITA Open Toolkit</description>
<property file="${basedir}/src/main/lib/configuration.properties"/>
<condition property="HTMLHelpCompiler" value="C:\Program Files\HTML Help Workshop\hhc.exe">
<available file="C:\Program Files\HTML Help Workshop\hhc.exe"/>
</condition>
<condition property="HTMLHelpCompiler" value="C:\Program Files (x86)\HTML Help Workshop\hhc.exe">
<available file="C:\Program Files (x86)\HTML Help Workshop\hhc.exe"/>
</condition>
<property name="src.dir" location="${basedir}/src/main"/>
<property name="java.dir" location="${src.dir}/java/"/>
<property name="lib.dir" location="${src.dir}/lib/"/>
<property name="doc.dir" location="${src.dir}/docsrc/"/>
<property name="package.output.dir" location="${basedir}/target/dist"/>
<property name="bin.dir" location="${basedir}/target/classes"/>
<tstamp>
<format property="current.date" pattern="yyyyMMddHHmmssSSS"/>
</tstamp>
<property name="work.dir" location="${src.dir}/temp/${current.date}/"/>
<property name="build.dir" location="${bin.dir}/build"/>
<property name="out.dir" location="${work.dir}/out/"/>
<property name="doc.out.dir" location="${out.dir}/doc"/>
<property name="dost.jar" location="${lib.dir}/dost.jar"/>
<property name="binary-client" value="dita-ot-${otversion}"/>
<target name="init-java" depends="clean-java, init-ivy">
<mkdir dir="${lib.dir}"/>
<mkdir dir="${bin.dir}"/>
<ivy:retrieve pattern="${lib.dir}/[artifact](-[classifier]).[ext]" conf="compile"/>
<ivy:cachepath pathid="compile.path" conf="compile"/>
</target>
<target name="clean-java">
<delete dir="${lib.dir}/dost.jar"/>
<delete dir="${bin.dir}"/>
</target>
<target name="compile" depends="init-java" description="Compile Java">
<javac srcdir="${java.dir}" destdir="${bin.dir}"
debug="on"
source="1.7" target="1.7"
classpathref="compile.path"/>
</target>
<target name="jar" depends="compile" description="Build Java libraries">
<copy todir="${bin.dir}">
<fileset dir="${java.dir}" includes="**/*.properties, **/*.xml"/>
</copy>
<jar destfile="${dost.jar}">
<fileset dir="${bin.dir}"/>
<fileset dir="${src.dir}/resources">
<exclude name="messages.*"/>
<exclude name="messages_template.*"/>
</fileset>
</jar>
</target>
<target name="jar.plug-ins" depends="compile" description="Build plug-in Java libraries">
<path id="base.compile.path">
<pathelement location="${bin.dir}"/>
<path refid="compile.path"/>
</path>
<ant antfile="${src.dir}/plugins/org.dita.pdf2/buildPackage.xml" target="jar" inheritAll="false">
<property name="basedir" value="${src.dir}/plugins/org.dita.pdf2"/>
<reference refid="base.compile.path"/>
</ant>
</target>
<target name="build" depends="jar, jar.plug-ins">
<path id="base.compile.path">
<pathelement location="${bin.dir}"/>
<path refid="compile.path"/>
<pathelement location="${src.dir}/resources"/>
</path>
<ant antfile="${src.dir}/integrator.xml" dir="${src.dir}">
<reference refid="base.compile.path" torefid="dost.class.path"/>
</ant>
</target>
<!-- Distribution -->
<patternset id="pattern.global.excludes">
<exclude name=".*"/>
<exclude name="local.properties"/>
<exclude name="build.log"/>
<exclude name="lib/commons-logging-1.1.1.jar"/>
<exclude name="plugins/org.dita-ot.html/**"/>
<exclude name="plugins/org.dita.pdf2/bin/**"/>
<exclude name="plugins/org.dita.pdf2/lib/xep/**"/>
<!-- docs -->
<exclude name="docsrc/*.md"/>
<exclude name="docsrc/site.xml"/>
</patternset>
<patternset id="pattern.package.client">
<patternset refid="pattern.global.excludes"/>
<exclude name="buildPackage.*"/>
<exclude name="startcmd.*"/>
<include name="build_demo.xml"/>
<exclude name="catalog-dita.txt"/>
<include name="*.*"/>
<include name="plugins/org.dita.specialization.eclipsemap/**"/>
<include name="plugins/org.dita.specialization.dita11/**"/>
<include name="plugins/org.dita.specialization.dita132/**"/>
<exclude name="plugins/org.dita.pdf2/src/**"/>
<include name="plugins/org.dita.pdf2/**"/>
<include name="plugins/com.sophos.tocjs/**"/>
<include name="bin/dita"/>
<include name="bin/dita.bat"/>
<include name="docsrc/**"/>
<exclude name="demo/**"/>
<include name="dtd/**"/>
<include name="plugins/**"/>
<include name="resources/**"/>
<include name="samples/**"/>
<include name="xsl/**"/>
<include name="lib/**"/>
</patternset>
<patternset id="pattern.package.ext-plugins.client">
<exclude name="**/*"/>
<!--include name="h2d/**"/>
<include name="legacypdf/**"/-->
</patternset>
<patternset id="pattern.package.doc">
<include name="relnotes.html"/>
<include name="doc/**"/>
<exclude name="**/*.hhp"/>
<exclude name="**/*.hhc"/>
<exclude name="**/*.hhk"/>
<exclude name="**/*.fo"/>
<exclude name="**/*.log"/>
<exclude name="**/*.list"/>
<exclude name="**/*.temp"/>
<exclude name="**/*.db"/>
</patternset>
<target name="build-package-binary" depends="jar, jar.plug-ins, update-doc">
<property name="temp.dist.dir" location="${work.dir}/${binary-client}/${binary-client}"/>
<!-- Build distribution into temporary directory -->
<delete dir="${temp.dist.dir}"/>
<mkdir dir="${temp.dist.dir}"/>
<copy todir="${temp.dist.dir}">
<fileset dir="${src.dir}">
<patternset refid="pattern.package.client"/>
</fileset>
</copy>
<copy todir="${temp.dist.dir}/plugins">
<fileset dir="${src.dir}/ext-plugins">
<patternset refid="pattern.package.ext-plugins.client"/>
</fileset>
</copy>
<copy todir="${temp.dist.dir}">
<fileset dir="${out.dir}" erroronmissingdir="false">
<patternset refid="pattern.package.doc"/>
</fileset>
</copy>
<!-- Run integrator -->
<ant antfile="${temp.dist.dir}/integrator.xml" dir="${temp.dist.dir}"/>
<!-- Package distribution -->
<zip destfile="${package.output.dir}/${binary-client}.zip" filesonly="true">
<zipfileset dir="${work.dir}/${binary-client}">
<exclude name="${binary-client}/bin/*"/>
</zipfileset>
<zipfileset dir="${work.dir}/${binary-client}" filemode="755">
<include name="${binary-client}/bin/*"/>
</zipfileset>
</zip>
<tar destfile="${package.output.dir}/${binary-client}.tar.gz" compression="gzip" longfile="gnu">
<tarfileset dir="${work.dir}/${binary-client}">
<exclude name="${binary-client}/bin/*"/>
</tarfileset>
<tarfileset dir="${work.dir}/${binary-client}" mode="755">
<include name="${binary-client}/bin/*"/>
</tarfileset>
</tar>
</target>
<target name="dist" description="Build distribution packages"
depends="init-package, build-package-binary, cleanup"/>
<target name="init-package">
<delete dir="${package.output.dir}"/>
<mkdir dir="${package.output.dir}"/>
</target>
<target name="cleanup" unless="skip.cleanup">
<delete dir="${work.dir}"/>
</target>
<target name="update-doc" unless="doc.skip">
<mkdir dir="${out.dir}"/>
<!--ant antfile="${src.dir}/integrator.xml" target="integrate" dir="${src.dir}"/-->
<ant antfile="${doc.dir}/build.xml" dir="${doc.dir}">
<property name="dita.home" location="${src.dir}"/>
<property name="output.dir" location="${work.dir}/htmlhelp"/>
<property name="base.temp.dir" location="${work.dir}"/>
<property name="preprocess.copy-generated-files.skip" value="true"/>
<property name="args.gen.task.lbl" value="YES"/>
<property name="args.css" value="dita-ot-doc.css"/>
<property name="args.cssroot" value="${doc.dir}/resource"/>
</ant>
<delete failonerror="yes" includeemptydirs="true">
<fileset dir="${doc.out.dir}">
<include name="**/dita.list"/>
<include name="**/dita.xml.properties"/>
</fileset>
</delete>
</target>
<target name="doc" depends="update-doc" description="Build documentation">
<copy todir="${src.dir}">
<fileset dir="${out.dir}">
<patternset refid="pattern.package.doc"/>
</fileset>
</copy>
</target>
<!-- Test -->
<property name="test.src.dir" location="${basedir}/src/test"/>
<property name="test.java.dir" location="${test.src.dir}/java"/>
<property name="test.lib.dir" location="${test.src.dir}/lib"/>
<property name="test.bin.dir" location="${basedir}/target/test-classes"/>
<property name="test.log.dir" location="${test.src.dir}/log"/>
<property name="test.suite.dir" location="${test.src.dir}/testsuite"/>
<target name="test-init">
<ivy:retrieve pattern="${test.lib.dir}/[artifact](-[classifier]).[ext]" conf="test"/>
<ivy:cachepath pathid="test.path" conf="test"/>
</target>
<target name="test-compile" depends="test-init, compile">
<delete failonerror="false">
<fileset dir="${test.bin.dir}" erroronmissingdir="false"/>
</delete>
<mkdir dir="${test.bin.dir}"/>
<javac destdir="${test.bin.dir}"
debug="on"
source="1.6" target="1.6">
<src>
<pathelement location="${test.java.dir}"/>
</src>
<classpath>
<path refid="test.path"/>
<pathelement location="${bin.dir}"/>
<path refid="compile.path"/>
</classpath>
</javac>
</target>
<target name="test-recources">
<copy todir="${test.bin.dir}">
<fileset dir="${test.src.dir}/resources"/>
</copy>
</target>
<target name="test" depends="compile, test-compile, test-recources" description="Run unit tests">
<delete failonerror="false">
<fileset dir="${test.log.dir}" erroronmissingdir="false"/>
</delete>
<mkdir dir="${test.log.dir}"/>
<junit printsummary="yes" haltonfailure="yes" showoutput="true">
<classpath>
<pathelement location="${test.bin.dir}"/>
<path refid="test.path"/>
<pathelement location="${bin.dir}"/>
<pathelement location="${src.dir}/resources"/>
<path refid="compile.path"/>
</classpath>
<formatter type="plain"/>
<batchtest fork="yes" todir="${test.log.dir}">
<fileset dir="${test.java.dir}">
<include name="**/Test*.java"/>
<include name="**/*Test.java"/>
<exclude name="org/dita/dost/TestUtils.java"/>
<exclude name="org/dita/dost/IntegrationTest.java"/>
</fileset>
</batchtest>
</junit>
</target>
<property name="integration-test.bin.dir" location="${basedir}/target/integration-test-classes"/>
<target name="integration-test-compile" depends="compile, test-compile">
<delete failonerror="false">
<fileset dir="${integration-test.bin.dir}" erroronmissingdir="false"/>
</delete>
<mkdir dir="${integration-test.bin.dir}"/>
<javac destdir="${integration-test.bin.dir}"
debug="on"
source="1.6" target="1.6">
<src>
<pathelement location="${test.suite.dir}/src/main/java"/>
</src>
<classpath>
<pathelement location="${test.bin.dir}"/>
<path refid="test.path"/>
<pathelement location="${bin.dir}"/>
<path refid="compile.path"/>
</classpath>
</javac>
</target>
<target name="integration-test" depends="compile, test-compile, test-recources, integration-test-compile" description="Run integration tests">
<condition property="only-test.name" value="${test}" else="">
<isset property="test"/>
</condition>
<delete failonerror="false">
<fileset dir="${test.log.dir}" erroronmissingdir="false"/>
</delete>
<mkdir dir="${test.log.dir}"/>
<junit printsummary="false" haltonfailure="yes" showoutput="false" logfailedtests="true">
<classpath>
<pathelement location="${integration-test.bin.dir}"/>
<pathelement location="${test.bin.dir}"/>
<path refid="test.path"/>
<pathelement location="${bin.dir}"/>
<pathelement location="${src.dir}/resources"/>
<path refid="compile.path"/>
</classpath>
<sysproperty key="dita.dir" value="${src.dir}"/>
<sysproperty key="basedir" value="${test.suite.dir}"/>
<sysproperty key="only-test" value="${only-test.name}"/>
<formatter type="plain" usefile="false"/>
<formatter type="plain" usefile="true"/>
<test name="org.dita.dost.IntegrationTest" fork="no" todir="${test.log.dir}"/>
</junit>
</target>
<target name="clean" depends="clean-java">
<delete includeemptydirs="true" failonerror="false">
<fileset dir="${test.bin.dir}" erroronmissingdir="false"/>
<fileset dir="${test.log.dir}" erroronmissingdir="false"/>
<fileset dir="${integration-test.bin.dir}" erroronmissingdir="false"/>
</delete>
</target>
<!-- Ivy -->
<target name="check-ivy">
<available property="ivy.available" classname="org.apache.ivy.ant.IvyResolve"/>
</target>
<target name="download-ivy" unless="ivy.available">
<property name="ivy.install.version" value="2.3.0" />
<condition property="ivy.home" value="${env.IVY_HOME}">
<isset property="env.IVY_HOME" />
</condition>
<property name="ivy.home" value="${user.home}/.ant" />
<property name="ivy.jar.dir" value="${ivy.home}/lib" />
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />
<mkdir dir="${ivy.jar.dir}"/>
<get src="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ivy.jar.file}"
usetimestamp="true"/>
</target>
<target name="init-ivy" depends="check-ivy, download-ivy" unless="ivy.available">
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant"
classpathref="ivy.lib.path"/>
</target>
</project>