-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathbuild.xml
348 lines (286 loc) · 12.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
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="help" name="dita-rng2dtdxsd">
<!-- NOTE: This ant script is implemented against the 3.0.x version
of the DITA Open Toolkit. It may need adjustment to work
with other Toolkit versions.
-->
<!-- <property environment="env"/> -->
<property file=".build.properties"/>
<property file="build.properties"/>
<property file="${user.home}/.build.properties"/>
<property file="${user.home}/build.properties"/>
<property name="xsl.src" location="${basedir}/xsl"/>
<property name="doctypes.src" location="${basedir}/doctypes"/>
<property name="plugin.src" location="${basedir}/toolkit_plugins"/>
<property name="dist" location="${basedir}/dist"/>
<property name="plugin.dist" location="${basedir}/dist/plugins"/>
<property name="package.dist" location="${basedir}/dist/package"/>
<property name="ditaver" description="The DITA version to generate (1.2, 1.3, 2.0, etc.)"
value="1.3"
/>
<fail message="- [ERROR]
 Required property dita-ot-dir is not set.
 It should be set in your build.properties or
 .build.properties file or on the command line
 using -Ddita-ot-dir={location of DITA OT}">
<condition>
<not>
<isset property="dita-ot-dir"/>
</not>
</condition>
</fail>
<property name="doctypesDir" location="${dita-ot-dir}/plugins/org.oasis-open.dita.v1_3"/>
<!-- This is the tools/ dir under the doctypes DIR in the TC-managed
source repository.
-->
<property name="toolsDir" location="${basedir}/../../tools"/>
<property name="javaLibDir" location="${basedir}/lib"/>
<property name="catalogType" value="'all'"/>
<!-- The catalogType parameter specifies the type of catlaog
to be produced:
- 'all' : Entries for each type of schema are included
- 'dtd' : Only DTD entries
- 'rng' : Only RNG entries
- 'rnc' : Only RNC entries
- 'schema' : The XSDs that use URNs to reference modules
- 'schema-url' : The XSDs that use URls to reference modules
-->
<property name="outdir" description="Root output directory for the generated files"
location="${basedir}/build"
/>
<property name="verSpecificOutDir"
location="${outdir}/${ditaver}"
/>
<property name="catalogOutDir" description="Directory containing the XML entity resolution catalogs"
location="${verSpecificOutDir}"
/>
<echo>catalogOutDir=${catalogOutDir}</echo>
<property name="dtd-outdir" description="Output directory for DTD files"
location="${verSpecificOutDir}/dtd"
/>
<property name="xsd-urn-outdir" description="Output directory for URN-based XSD files"
location="${verSpecificOutDir}/schema"
/>
<property name="xsd-url-outdir" description="Output directory for URL-based XSD files"
location="${verSpecificOutDir}/schema-url"
/>
<property name="rnc-urn-outdir" description="Output directory for URN-based RNC files"
location="${verSpecificOutDir}/rnc"
/>
<property name="manifestOutputDir" description="Directory to put the generation manifest in"
location="${verSpecificOutDir}/generationManifests"
/>
<property name="xslsrc" location="${basedir}/xsl"/>
<property name="src" description="root source directory for the doctypes"
location="${doctypesDir}"
/>
<property name="rngsrc" description="Parent source dir for all RNG files"
location="${src}/rng"
/>
<property name="foreignsrc" description="Directory containing foreign vocabulary declarations"
location="${src}/foreign"
/>
<property name="usePublicIDsInShell" value="true"/>
<property name="masterCatalog" location="${dita-ot-dir}/catalog-dita.xml"/>
<property name="dtdGenerationXsl" location="${xslsrc}/rng2ditadtd/rng2ditadtd.xsl"/>
<property name="catalogGenerationXsl" location="${xslsrc}/rng2catalogs/rng2catalogs.xsl"/>
<property name="rncGenerationXsl" location="${xslsrc}/rng2ditarnc/rng2ditarnc.xsl"/>
<property name="xsdGenerationXsl" location="${xslsrc}/rng2ditaxsd/rng2ditaxsd.xsl"/>
<property name="catalogPath" location="${dita-ot-dir}/catalog-dita.xml"/>
<makeurl property="catalogPathUrl" file="${catalogPath}"/>
<echo>catalogPathUri="${catalogPathUrl}"</echo>
<property name="debug" value="false"/>
<condition property="doGenerateModules" value="${generateModules}">
<isset property="generateModules"/>
</condition>
<condition property="doGenerateModules" value="false">
<not>
<isset property="generateModules"/>
</not>
</condition>
<condition property="doGenerateStandardModules" value="${generateStandardModules}">
<isset property="generateStandardModules"/>
</condition>
<condition property="doGenerateStandardModules" value="false">
<not>
<isset property="generateStandardModules"/>
</not>
</condition>
<condition property="doGenerateCatalogs" value="${generateCatalogs}">
<isset property="generateCatalogs"/>
</condition>
<condition property="doGenerateCatalogs" value="false">
<not>
<isset property="generateCatalogs"/>
</not>
</condition>
<target name="init">
<echo>outdir=${outdir}</echo>
<echo>catalogOutDir="${catalogOutDir}"</echo>
<buildnumber/>
<tstamp/>
</target>
<tstamp>
<format property="build-date-time"
pattern="yyyy-MM-dd HH:mm:SSS z"/>
</tstamp>
<path id="saxonClasspath">
<fileset dir="${javaLibDir}">
<include name="**/saxon9*.jar"/>
<include name="**/xml-resolver*.jar"/>
<include name="**/resolver*.jar"/>
</fileset>
</path>
<target name="clean">
<delete failonerror="false">
<fileset dir="${manifestOutputDir}">
<include name="**/*"/>
</fileset>
</delete>
<mkdir dir="${verSpecificOutDir}"/>
</target>
<target name="help">
<echo>
[generate-all|generate-dtd|generate-catalogs]
-Drngsrc={directory containing the RELAX NG document type shells to process}
-Doutdir={directory to put the generated files into}
-DcatalogOutDir={directory to put any generated catalogs into}
-DusePublicIDsInShell=[true|FALSE]
Use public IDs (URNs) rather than direct URLs for references to modules from shells.
-DgenerateModules=[true|FALSE]
Generate vocabulary modules in addition to document type shells.
-DgenerateCatalogs=[true|FALSE]
Generate entity resolution catalogs
-DgenerateStandardModules=[true|FALSE]
Generate the standard OASIS-defined modules as well as any other
modules.
-Dditaver=1.2|1.3|2.0 Default is "1.3"
-D debug=[true|FALSE]
Turns on debug messages.
NOTE: The generate-catalogs target only generates catalogs, it does not
generate any shells or modules.
</echo>
</target>
<target name="generate-all"
description="Generates all shells and modules for both DTD and XSD syntax"
depends="init, clean, generate-dtd, generate-xsd-url, generate-xsd-urn, generate-catalogs"
>
</target>
<!-- NOTE: In the XSLT tasks below, I'm not sure that the
<factory> specification is necessary since we're also
putting the saxon jar on the classpath. However, it doesn't
seem to hurt and may help when the effective class path
doesn't end up with Saxon first.
-->
<target name="generate-dtd" description="Generates the DTDs from the RNGs"
depends="init, clean, generate-catalogs"
>
<!-- <echoproperties regex="gen|out|debug|dir|Dir|ditaver|src|do"/>-->
<!-- NOTE: the -catalog Saxon parameter is not available with Saxon 9.1, so
this use of Saxon requires a newer version, e.g., 9.6.
-->
<makeurl property="rngsrcUrl" file="${rngsrc}"/>
<java classname="net.sf.saxon.Transform" failonerror="true"
classpathref="saxonClasspath"
>
<arg line="-o:"${manifestOutputDir}/dtd-generation-manifest.xml""/>
<arg line="-it:processDir"/>
<!-- <arg line="-t"/>--><!-- Uncomment this to turn on Saxon version and tracing output -->
<arg line="-xsl:"${dtdGenerationXsl}""/>
<arg line="-catalog:"${catalogPathUrl}""/>
<arg line="generateCatalogs=${doGenerateCatalogs}"/>
<arg line="outdir="${dtd-outdir}""/>
<arg line="usePublicIDsInShell=${usePublicIDsInShell}"/>
<arg line="ditaVersion=${ditaver}"/>
<arg line="debug=${debug}"/>
<arg line="rootDir="${rngsrcUrl}""/>
<arg line="generateModules=${doGenerateModules}"/>
<arg line="generateStandardModules=${doGenerateStandardModules}"/>
<arg line="generateCatalogs=${doGenerateCatalogs}"/>
<arg line="catalogs="${catalogPathUrl}""/>
</java>
</target>
<target name="generate-xsd-url"
depends="init, clean"
>
<!-- Catalog path is not needed for processing TC-defined RNGs as they
use relative URLs, but for non-TC RNGs will need a catalog to resolve
URNs, e.g., the OT master catalog.
-->
<makeurl property="rngsrcUrl" file="${rngsrc}"/>
<java classname="net.sf.saxon.Transform" failonerror="true"
classpathref="saxonClasspath"
>
<arg line="-o:${manifestOutputDir}/xsd-url-generation-manifest.xml"/>
<arg line="-it:processDir"/>
<arg line="-xsl:${xsdGenerationXsl}"/>
<arg line="-catalog:${catalogPathUrl}"/>
<arg line="outdir=${xsd-url-outdir}"/>
<arg line="useURNsInShell=false"/>
<arg line="ditaVersion=${ditaver}"/>
<arg line="debug=${debug}"/>
<arg line="rootDir=${rngsrcUrl}"/>
<arg line="generateModules=${doGenerateModules}"/>
<arg line="generateStandardModules=${doGenerateStandardModules}"/>
<arg line="generateCatalogs=${doGenerateCatalogs}"/>
<arg line="catalogs="${catalogPathUrl}""/>
</java>
</target>
<target name="generate-xsd-urn"
depends="init, clean"
>
<makeurl property="rngsrcUrl" file="${rngsrc}"/>
<java classname="net.sf.saxon.Transform" failonerror="true"
classpathref="saxonClasspath"
>
<arg line="-o:${manifestOutputDir}/xsd-urn-generation-manifest.xml"/>
<arg line="-it:processDir"/>
<arg line="-xsl:${xsdGenerationXsl}"/>
<arg line="-catalog:${catalogPathUrl}"/>
<arg line="outdir=${xsd-urn-outdir}"/>
<arg line="useURNsInShell=true"/>
<arg line="ditaVersion=${ditaver}"/>
<arg line="debug=${debug}"/>
<arg line="rootDir=${rngsrcUrl}"/>
<arg line="generateModules=${doGenerateModules}"/>
<arg line="generateStandardModules=${doGenerateStandardModules}"/>
<arg line="catalogs="${catalogPathUrl}""/>
</java>
</target>
<target name="generate-rnc-urn"
depends="init, clean"
>
<echo>- [WARN] RNC generation not yet fully implemented. </echo>
<makeurl property="rngsrcUrl" file="${rngsrc}"/>
<java classname="net.sf.saxon.Transform" failonerror="true"
classpathref="saxonClasspath"
>
<arg line="-o:${manifestOutputDir}/rnc-urn-generation-manifest.xml"/>
<arg line="-it:processDir"/>
<arg line="-xsl:${rncGenerationXsl}"/>
<arg line="-catalog:${catalogPathUrl}"/>
<arg line="outdir=${rnc-urn-outdir}"/>
<arg line="usePublicIDsInShell=true"/>
<arg line="ditaVersion=${ditaver}"/>
<arg line="debug=${debug}"/>
<arg line="rootDir=${rngsrcUrl}"/>
<arg line="generateModules=${doGenerateModules}"/>
<arg line="generateStandardModules=${doGenerateStandardModules}"/>
<arg line="catalogs="${catalogPathUrl}""/>
</java>
</target>
<target name="generate-catalogs" description="Generate all the entity resolution catalogs for a specific DITA version"
depends="init, clean"
if="${doGenerateCatalogs}"
>
<makeurl property="rngsrcUrl" file="${rngsrc}"/>
<java classname="net.sf.saxon.Transform" failonerror="true"
classpathref="saxonClasspath"
>
<arg line="-xsl:"${catalogGenerationXsl}""/>
<arg line="-it:processDir"/>
<arg line="-catalog:"${catalogPathUrl}""/>
<arg line="rootDir="${rngsrcUrl}""/>
<arg line="ditaVersion=${ditaver}"/>
<arg line="outdir="${verSpecificOutDir}""/>
<arg line="catalogType=${catalogType}"/>
<arg line="catalogs="${catalogPathUrl}""/>
</java>
</target>
</project>