-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.xml
429 lines (380 loc) · 15.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
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
<?xml version="1.0" encoding="UTF-8"?>
<project name="org.dita-community.i18n" default="all">
<property file=".build.properties" />
<property file="build.properties"/>
<property file="version.properties"/>
<property file="new-build.properties"/>
<!-- Uncomment the following property if no tests compilation is needed -->
<!--
<property name="skip.tests" value="true"/>
-->
<property name="workspace-dir" location="${basedir}/.."/>
<property name="ghpages-dirname" value="gh-pages_org.dita-community.i18n"/>
<property name="ghpages-dir" location="${workspace-dir}/${ghpages-dirname}"/>
<property name="plugin.dir" value="${basedir}/plugin"/>
<property name="package.dir" value="${basedir}/dist"/>
<property name="docs.dirname" value="documentation"/>
<property name="docs.dir" value="${basedir}/${docs.dirname}"/>
<!-- Compiler options -->
<property name="compiler.debug" value="on"/>
<property name="compiler.generate.no.warnings" value="off"/>
<property name="compiler.args" value=""/>
<property name="compiler.max.memory" value="700m"/>
<patternset id="ignored.files">
<exclude name="**/*.hprof/**"/>
<exclude name="**/*.pyc/**"/>
<exclude name="**/*.pyo/**"/>
<exclude name="**/*.rbc/**"/>
<exclude name="**/*.yarb/**"/>
<exclude name="**/*~/**"/>
<exclude name="**/.DS_Store/**"/>
<exclude name="**/.git/**"/>
<exclude name="**/.hg/**"/>
<exclude name="**/.svn/**"/>
<exclude name="**/CVS/**"/>
<exclude name="**/RCS/**"/>
<exclude name="**/SCCS/**"/>
<exclude name="**/__pycache__/**"/>
<exclude name="**/_svn/**"/>
<exclude name="**/rcs/**"/>
<exclude name="**/vssver.scc/**"/>
<exclude name="**/vssver2.scc/**"/>
</patternset>
<patternset id="library.patterns">
<include name="*.war"/>
<include name="*.swc"/>
<include name="*.apk"/>
<include name="*.zip"/>
<include name="*.ear"/>
<include name="*.egg"/>
<include name="*.ane"/>
<include name="*.jar"/>
</patternset>
<patternset id="compiler.resources">
<exclude name="**/?*.java"/>
<exclude name="**/?*.form"/>
<exclude name="**/?*.class"/>
<exclude name="**/?*.groovy"/>
<exclude name="**/?*.scala"/>
<exclude name="**/?*.flex"/>
<exclude name="**/?*.kt"/>
<exclude name="**/?*.clj"/>
<exclude name="**/?*.aj"/>
</patternset>
<!-- JDK definitions -->
<property name="jdk.bin.1.8" value="${jdk.home.1.8}/bin"/>
<path id="jdk.classpath.1.8">
<fileset dir="${jdk.home.1.8}">
<include name="jre/lib/charsets.jar"/>
<include name="jre/lib/deploy.jar"/>
<include name="jre/lib/ext/dnsns.jar"/>
<include name="jre/lib/ext/localedata.jar"/>
<include name="jre/lib/ext/sunec.jar"/>
<include name="jre/lib/ext/sunjce_provider.jar"/>
<include name="jre/lib/ext/sunpkcs11.jar"/>
<include name="jre/lib/ext/zipfs.jar"/>
<include name="jre/lib/htmlconverter.jar"/>
<include name="jre/lib/javaws.jar"/>
<include name="jre/lib/jce.jar"/>
<include name="jre/lib/jfr.jar"/>
<include name="jre/lib/jfxrt.jar"/>
<include name="jre/lib/jsse.jar"/>
<include name="jre/lib/management-agent.jar"/>
<include name="jre/lib/plugin.jar"/>
<include name="jre/lib/resources.jar"/>
<include name="jre/lib/rt.jar"/>
<include name="lib/ant-javafx.jar"/>
<include name="lib/dt.jar"/>
<include name="lib/javafx-doclet.jar"/>
<include name="lib/javafx-mx.jar"/>
<include name="lib/jconsole.jar"/>
<include name="lib/sa-jdi.jar"/>
<include name="lib/tools.jar"/>
</fileset>
</path>
<property name="project.jdk.home" value="${jdk.home.1.8}"/>
<property name="project.jdk.bin" value="${jdk.bin.1.8}"/>
<property name="project.jdk.classpath" value="jdk.classpath.1.8"/>
<!-- Project Libraries -->
<path id="library.lib.classpath">
<fileset dir="${basedir}/lib">
<patternset refid="library.patterns"/>
</fileset>
</path>
<!-- Modules -->
<!-- Module org.dita-community.i18n -->
<dirname property="module.org.dita-community.i18n.basedir" file="${ant.file}"/>
<property name="module.jdk.home.org.dita-community.i18n" value="${project.jdk.home}"/>
<property name="module.jdk.bin.org.dita-community.i18n" value="${project.jdk.bin}"/>
<property name="module.jdk.classpath.org.dita-community.i18n" value="${project.jdk.classpath}"/>
<property name="compiler.args.org.dita-community.i18n" value="-encoding UTF-8 -source 1.8 -target 1.8 ${compiler.args}"/>
<property name="org.dita-community.i18n.output.dir" value="${module.org.dita-community.i18n.basedir}/target/classes/production/org.dita-community.i18n"/>
<property name="org.dita-community.i18n.testoutput.dir" value="${module.org.dita-community.i18n.basedir}/target/classes/test/org.dita-community.i18n"/>
<path id="org.dita-community.i18n.module.bootclasspath">
<!-- Paths to be included in compilation bootclasspath -->
</path>
<path id="org.dita-community.i18n.module.production.classpath">
<path refid="${module.jdk.classpath.org.dita-community.i18n}"/>
<path refid="library.lib.classpath"/>
<pathelement location="${dita-ot-dir}/lib/dost.jar"/>
</path>
<path id="org.dita-community.i18n.runtime.production.module.classpath">
<pathelement location="${org.dita-community.i18n.output.dir}"/>
<path refid="library.lib.classpath"/>
</path>
<path id="org.dita-community.i18n.module.classpath">
<path refid="${module.jdk.classpath.org.dita-community.i18n}"/>
<pathelement location="${org.dita-community.i18n.output.dir}"/>
<path refid="library.lib.classpath"/>
</path>
<path id="org.dita-community.i18n.runtime.module.classpath">
<pathelement location="${org.dita-community.i18n.testoutput.dir}"/>
<pathelement location="${org.dita-community.i18n.output.dir}"/>
<path refid="library.lib.classpath"/>
</path>
<patternset id="excluded.from.module.org.dita-community.i18n">
<patternset refid="ignored.files"/>
</patternset>
<patternset id="excluded.from.compilation.org.dita-community.i18n">
<patternset refid="excluded.from.module.org.dita-community.i18n"/>
</patternset>
<path id="org.dita-community.i18n.module.sourcepath">
<dirset dir="${module.org.dita-community.i18n.basedir}">
<include name="src/main/java"/>
</dirset>
</path>
<target name="compile.module.org.dita-community.i18n"
depends="compile.module.org.dita-community.i18n.production, compile.module.org.dita-community.i18n.tests"
description="Compile module org.dita-community.i18n"/>
<target name="compile.module.org.dita-community.i18n.production"
description="Compile module org.dita-community.i18n; production classes">
<mkdir dir="${org.dita-community.i18n.output.dir}"/>
<javac destdir="${org.dita-community.i18n.output.dir}" includeantruntime="no"
debug="${compiler.debug}" nowarn="${compiler.generate.no.warnings}"
memorymaximumsize="${compiler.max.memory}" fork="true"
executable="${module.jdk.bin.org.dita-community.i18n}/javac">
<compilerarg line="${compiler.args.org.dita-community.i18n}"/>
<bootclasspath refid="org.dita-community.i18n.module.bootclasspath"/>
<classpath refid="org.dita-community.i18n.module.production.classpath"/>
<src refid="org.dita-community.i18n.module.sourcepath"/>
<patternset refid="excluded.from.compilation.org.dita-community.i18n"/>
</javac>
<copy todir="${org.dita-community.i18n.output.dir}">
<fileset dir="${module.org.dita-community.i18n.basedir}/src/main/java">
<patternset refid="compiler.resources"/>
<type type="file"/>
</fileset>
</copy>
<copy todir="${org.dita-community.i18n.output.dir}/org/ditacommunity/i18n/saxon">
<fileset dir="${basedir}">
<include name="version.properties"/>
</fileset>
</copy>
</target>
<target name="compile.module.org.dita-community.i18n.tests"
depends="compile.module.org.dita-community.i18n.production"
description="compile module org.dita-community.i18n; test classes" unless="skip.tests"/>
<target name="clean.module.org.dita-community.i18n" description="cleanup module">
<delete dir="${org.dita-community.i18n.output.dir}"/>
<delete dir="${org.dita-community.i18n.testoutput.dir}"/>
<delete dir="${package.dir}"/>
</target>
<target name="init" description="Build initialization">
<!-- Perform any build initialization in this target -->
<tstamp/>
</target>
<target name="clean" depends="clean.module.org.dita-community.i18n" description="cleanup all">
</target>
<target name="build.modules" depends="init, clean, compile.module.org.dita-community.i18n" description="build all modules"/>
<target name="jar" depends="build.modules">
<delete failonerror="false" dir="${basedir}/target/lib">
<include name="*.jar"/>
</delete>
<jar destfile="${basedir}/target/lib/dita-community-i18n-saxon.jar"
>
<manifest>
<attribute name="Main-Class" value="org.ditacommunity.i18n.collation.CollationAnalyzer"/>
</manifest>
<service
type="javax.xml.transform.TransformerFactory"
provider="org.ditacommunity.i18n.saxon.DCI18nSaxonTransformerFactoryImpl"
/>
<service
type="net.sf.saxon.lib.ExtensionFunctionDefinition"
>
<provider classname="org.ditacommunity.i18n.saxon.functions.TextAnalysisSplitWords"/>
<provider classname="org.ditacommunity.i18n.saxon.functions.TextAnalysisSplitLines"/>
<provider classname="org.ditacommunity.i18n.saxon.functions.TextMetricsGetRenderedLength"/>
</service>
<service
type="org.dita.dost.module.saxon.DelegatingCollationUriResolver"
>
<provider classname="org.ditacommunity.i18n.saxon.DCI18nCollationUriResolver"/>
</service>
<fileset dir="${basedir}/target/classes/production/org.dita-community.i18n" >
<include name="**.*" />
<include name="**/**.*" />
</fileset>
<fileset dir="${basedir}/src/main/java">
<include name="**/resources/**.*" />
</fileset>
</jar>
</target>
<target name="all" depends="build.modules" description="build all"/>
<target name="package" depends="jar"
description="Package the OT plugin for distribution"
>
<copy todir="${package.dir}/plugins/org.dita-community.i18n">
<fileset dir="${plugin.dir}">
<include name="**/*"/>
</fileset>
<fileset dir="${basedir}/target">
<include name="lib/*.jar"/>
</fileset>
</copy>
<replace encoding="utf-8"
file="${package.dir}/plugins/org.dita-community.i18n/plugin.xml"
token="^version^"
value="${version}"
/>
</target>
<target name="dist" depends="package">
<zip basedir="${package.dir}/plugins" destfile="${package.dir}/org_dita-community_i18n_plugin_${version}.zip">
<include name="org.dita-community.i18n/**/*"/>
</zip>
</target>
<target name="deploy" depends="package"
description="Deploy the plugin to a local OT instance">
<copy todir="${dita-ot-dir}/plugins">
<fileset dir="${package.dir}/plugins">
<include name="**/*"/>
</fileset>
</copy>
<exec dir="${dita-ot-dir}/bin" executable="/bin/bash">
<arg value="dita"/>
<arg value="--install"/>
<arg value="--force"/>
<!--<arg value="-v"/>-->
</exec>
</target>
<target name="check-doc-source-changed">
<uptodate property="doc-source-modified">
<srcfiles dir="${docs.dir}">
<include name="**/*" />
<exclude name="out/**"/>
<exclude name="temp/**"/>
</srcfiles>
<identitymapper/>
</uptodate>
<echo>doc-source-modified="${doc-source-modified}"</echo>
</target>
<target name="generate-docs" depends="check-doc-source-changed" if="${doc-source-modified}"
description="Generate renditions of the project documentation"
>
<exec searchpath="true"
executable="git"
failonerror="true"
dir="${ghpages-dir}"
>
<arg value="checkout"/>
<arg value="gh-pages"/>
</exec>
<!--
docker run -v /Users/ekimber/workspace-dfst:/opt/dita-ot/data ditacommunity/dita-ot-i18n
ant -Dargs.input=/opt/dita-ot/data/org.diat-community-i18n/documentation/dita-community-i18n-manual.ditamap
-Dtranstype=d4p-html5
-Doutput.dir=/opt/dita-ot/data/gh-pages_org.dita-community-i18n
-->
<exec
searchpath="true"
executable="docker"
failonerror="true"
>
<arg value="run"/>
<arg value="-v"/>
<arg value="${workspace-dir}:/opt/dita-ot/data"/>
<arg value="dfst/dita-ot"/>
<arg value="ant"/>
<arg value="-Dargs.input=/opt/dita-ot/data/org.dita-community.i18n/${docs.dirname}/dita-community-i18n-manual.ditamap"/>
<arg value="-Dtranstype=d4p-html5"/>
<arg value="-Doutput.dir=/opt/dita-ot/data/${ghpages-dirname}"/>
</exec>
</target>
<target name="publish-docs" depends="generate-docs"
description="Generate the project docs and publish to GitHub"
>
<!-- Do git commit and push of the generated docs -->
<exec searchpath="true"
executable="git"
failonerror="true"
dir="${ghpages-dir}"
>
<arg value="checkout"/>
<arg value="gh-pages"/>
</exec>
<exec searchpath="true"
executable="git"
failonerror="true"
dir="${ghpages-dir}"
>
<arg value="pull"/>
</exec>
<exec searchpath="true"
executable="git"
failonerror="true"
dir="${ghpages-dir}"
>
<arg value="add"/>
<arg value="."/>
</exec>
<exec searchpath="true"
executable="git"
failonerror="true"
dir="${ghpages-dir}"
>
<arg value="commit"/>
<arg value="-m"/>
<arg value="Documentation updated via Ant process on ${TODAY} by ${user.name}"/>
</exec>
<exec searchpath="true"
executable="git"
failonerror="true"
dir="${ghpages-dir}"
>
<arg value="push"/>
<arg value="origin"/>
<arg value="gh-pages"/>
</exec>
</target>
<target name="test-saxon-extension-functions" depends="jar"
description="Test the saxon extension functions by running Saxon directly"
>
<property name="test.result.file" location="${basedir}/temp/test-result.xml"/>
<java
classname="org.ditacommunity.i18n.saxon.ExtensionRegisteringTransform"
>
<classpath>
<fileset dir="${basedir}/lib">
<include name="saxon9he.jar"/>
<include name="commons-io*.jar"/>
<include name="icu4j*.jar"/>
</fileset>
<fileset dir="${basedir}/target/lib">
<include name="*.jar"/>
</fileset>
</classpath>
<arg line='-xsl:"${basedir}/src/test/xsl/test-extension-functions.xsl"'/>
<arg line='-s:"${basedir}/src/test/xsl/test-extension-functions.xsl"'/>
<arg line='-o:"${test.result.file}"'/>
</java>
<fileset id="build.failures" file="${test.result.file}">
<contains text='passed="false"'/>
</fileset>
<fail status="1" message="One or more failures detected, see ${test.result.file}">
<condition>
<resourcecount when="greater" count="0" refid="build.failures" />
</condition>
</fail>
<echo>Tests passed. See ${test.result.file}</echo>
</target>
</project>