-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
325 lines (287 loc) · 11.7 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="hyphenation-info" basedir="." default="build"
xmlns:if="ant:if"
xmlns:unless="ant:unless">
<description>Additional properties and targets used when developing
'hyphenation-info' and making a release.</description>
<!--
Copyright 2015-2022 Antenna House, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!--
BEFORE making a release on GitHub:
- Commit all hand-modified files
- Make sure that ${version} in build.properties is correct
- Run the 'release' target with '-Dforce=yes'
- Commit build.properties and the generated files with a
'Releasing hyphenation-info x.y.z.' commit message
- Push the commits to GitHub.
AFTER making a release on GitHub:
- Increment ${version} in build.properties so it's not possible
to accidentally overwrite a release's Zip file with different
versions of files.
-->
<!-- Build file with properties and targets useful for running
'hyphenation-info'. -->
<import file="build-hyphenation-info.xml" />
<!-- Additional input and output file properties not needed in
'build-hyphenation-info.xml'. -->
<!-- Expression parser XSLT stylesheet generated by REx. -->
<property name="rex-generated-parser.xsl"
value="axf-expression.xslt" />
<!-- XSLT stylesheet for dumping Schematron for checking property values. -->
<property name="property-schematron-dump.xsl"
value="axf-property-schematron-override.xsl" />
<!-- Location of Calabash jar. -->
<property name="calabash.jar"
value="${basedir.converted}/lib/calabash-1.0.25-96/calabash.jar"/>
<!-- Location of XML catalog resolver library. -->
<property name="resolver.jar"
value="${hyphenation-info.basedir.converted}/lib/resolver.jar"/>
<!-- Directory containing stf tests. -->
<property name="tests.dir"
value="${hyphenation-info.basedir.converted}/test/stf"/>
<!-- Additional housekeeping properties not needed in
'build-hyphenation-info.xml'. -->
<tstamp>
<format property="timestamp" pattern="yyyy-MM-dd"/>
</tstamp>
<!-- ${saxon.jar} set in 'build-hyphenation-info.xml'. -->
<!-- trang.jar location depends on if run from oXygen or on OS. -->
<condition property="trang.jar" value="${ant.home}/../../lib/trang.jar">
<contains string="${ant.home}" substring="oxygen" casesensitive="false" />
</condition>
<condition property="trang.jar" value="${trang.jar.windows}">
<os family="windows" />
</condition>
<condition property="trang.jar" value="${trang.jar.mac}">
<os family="mac" />
</condition>
<property name="trang.jar" value="${trang.jar.unix}" />
<!-- Targets -->
<target name="trang">
<fail message="Could not locate 'trang.jar'.">
<condition>
<not>
<available file="${trang.jar}" />
</not>
</condition>
</fail>
</target>
<target name="-rng.uptodate">
<uptodate property="rng.uptodate">
<srcfiles dir= "${rnc.dir}" includes="*.rnc"/>
<mapper type="glob" from="*.rnc" to="rng/*.rng"/>
</uptodate>
</target>
<target name="rng" depends="trang, -rng.uptodate"
unless="rng.uptodate">
<java jar="${trang.jar}" fork="true">
<arg value="${rnc.dir}/${schema.basename}.rnc" />
<arg value="${rng.dir}/${schema.basename}.rng" />
</java>
</target>
<target name="-dtd.uptodate">
<uptodate property="dtd.uptodate">
<srcfiles dir= "${rnc.dir}" includes="*.rnc"/>
<mapper type="glob" from="*.rnc" to="${dtd}/*.dtd"/>
</uptodate>
</target>
<target name="dtd" depends="trang, -dtd.uptodate"
unless="dtd.uptodate">
<java jar="${trang.jar}" fork="true">
<arg value="${rnc.dir}/${schema.basename}.rnc" />
<arg value="${dtd.dir}/${schema.basename}.dtd" />
</java>
</target>
<target name="-xsd.uptodate">
<uptodate property="xsd.uptodate">
<srcfiles dir= "${rnc.dir}" includes="*.rnc"/>
<mapper type="glob" from="*.rnc" to="xsd/*.xsd"/>
</uptodate>
</target>
<target name="xsd" depends="trang, -xsd.uptodate"
unless="xsd.uptodate">
<java jar="${trang.jar}" fork="true">
<arg value="${rnc.dir}/${xsd.schema.basename}.rnc" />
<arg value="${xsd.dir}/${xsd.schema.basename}.xsd" />
</java>
</target>
<target name="build"
depends="rng, xsd, dtd"
description="Build the generated files." />
<!-- Testing targets -->
<!-- Translation targets. -->
<target name="translate" depends="rng">
<mkdir dir="${hyphenation-info.basedir.converted}/omegat/target" />
<!-- Preserve modification dates for ease of comparison with
'reference' OmegaT project where original translations are
done. -->
<copy todir="${hyphenation-info.basedir.converted}/omegat/source"
preservelastmodified="true"
force="${force}">
<fileset dir="${hyphenation-info.basedir.converted}/schematron"
includes="*.sch" />
</copy>
<copy todir="${hyphenation-info.basedir.converted}/omegat/source"
preservelastmodified="true"
force="${force}">
<fileset dir="${rng.dir}"
includes="*.rng" />
</copy>
<java jar="omegat/OmegaT.jar" fork="true">
<arg value="${hyphenation-info.basedir.converted}/omegat" />
<arg value="--config-dic=${hyphenation-info.basedir.converted}/omegat/config" />
<arg value="--mode=console-translate" />
<!--<arg value="- -quiet" />-->
</java>
<copy todir="${hyphenation-info.basedir.converted}/schematron-ja"
preservelastmodified="true"
force="${force}">
<fileset dir="${hyphenation-info.basedir.converted}/omegat/target"
includes="*.sch" />
</copy>
<chmod dir="${hyphenation-info.basedir.converted}/schematron-ja"
includes="**/*.sch"
perm="644" />
<copy todir="${hyphenation-info.basedir.converted}/schema-ja/rng"
preservelastmodified="true"
force="${force}">
<fileset dir="${hyphenation-info.basedir.converted}/omegat/target"
includes="*.rng" />
</copy>
<chmod dir="${hyphenation-info.basedir.converted}/schema-ja/rng"
includes="**/*.rng"
perm="644" />
</target>
<target name="rnc-ja" depends="trang"
unless="rng.uptodate">
<java jar="${trang.jar}" fork="true">
<arg value="${hyphenation-info.basedir.converted}/schema-ja/rng/${schema.basename}.rng" />
<arg value="${hyphenation-info.basedir.converted}/schema-ja/${schema.basename}.rnc" />
</java>
<chmod dir="${hyphenation-info.basedir.converted}/schema-ja"
includes="**/*.rnc"
perm="644" />
</target>
<target name="xsd-ja" depends="trang">
<java jar="${trang.jar}" fork="true">
<arg value="${hyphenation-info.basedir.converted}/schema-ja/rng/${xsd.schema.basename}.rng" />
<arg value="${hyphenation-info.basedir.converted}/schema-ja/xsd/${xsd.schema.basename}.xsd" />
</java>
</target>
<!-- Release targets. -->
<target name="add-on.xml.uptodate">
<condition property="add-on.xml.uptodate">
<and>
<uptodate srcfile="${basedir.converted}/build.properties"
targetfile="${basedir.converted}/add-on.xml" />
<isfalse value="${force}" />
</and>
</condition>
</target>
<target name="add-on.xml" depends="add-on.xml.uptodate"
unless="add-on.xml.uptodate"
description="Update the version information in 'add-on.xml'.">
<replaceregexp file="${hyphenation-info.basedir.converted}/add-on.xml"
encoding="UTF-8">
<regexp pattern="<xt:version>[^<]+</xt:version>" />
<substitution expression="<xt:version>${version}</xt:version>"/>
</replaceregexp>
<replaceregexp file="${hyphenation-info.basedir.converted}/add-on.xml"
encoding="UTF-8">
<regexp pattern='releases/download/[^"]+' />
<substitution
expression="releases/download/v${version}/${ant.project.name}-framework-${version}.zip"/>
</replaceregexp>
</target>
<target name="framework.zip" depends="build, add-on.xml"
description="Make a Zip archive of just the oXygen framework.">
<mkdir dir="${hyphenation-info.basedir.converted}/releases" />
<zip destfile="${hyphenation-info.basedir.converted}/releases/${ant.project.name}-framework-${version}.zip"
basedir="${hyphenation-info.basedir.converted}"
excludes="**"
update="true">
<zipfileset dir="."
includes="README.md, LICENSE*.md, hyphenation-info.framework"
prefix="${ant.project.name}" />
<zipfileset dir="css" includes="*.css"
prefix="${ant.project.name}/css" />
<zipfileset dir="schema" includes="catalog.xml, *.ent"
prefix="${ant.project.name}/schema" />
<zipfileset dir="${rng.dir}" includes="*.rng"
prefix="${ant.project.name}/rng" />
<zipfileset dir="${dtd.dir}" includes="*.dtd, catalog*.xml"
prefix="${ant.project.name}/dtd" />
<zipfileset dir="schematron" includes="*.sch"
prefix="${ant.project.name}/schematron" />
<zipfileset dir="template" includes="*.xml, *.properties"
prefix="${ant.project.name}/template" />
<zipfileset dir="xsl"
includes="*.xsl"
prefix="${ant.project.name}/xsl" />
</zip>
</target>
<target name="add-on-ja.xml.uptodate">
<condition property="add-on-ja.xml.uptodate">
<and>
<uptodate srcfile="${basedir.converted}/build.properties"
targetfile="${basedir.converted}/add-on-ja.xml" />
<isfalse value="${force}" />
</and>
</condition>
</target>
<target name="add-on-ja.xml" depends="add-on-ja.xml.uptodate"
unless="add-on-ja.xml.uptodate"
description="Update the version information in 'add-on-ja.xml'.">
<replaceregexp file="${hyphenation-info.basedir.converted}/add-on-ja.xml"
encoding="UTF-8">
<regexp pattern="<xt:version>[^<]+</xt:version>" />
<substitution expression="<xt:version>${version}</xt:version>"/>
</replaceregexp>
<replaceregexp file="${hyphenation-info.basedir.converted}/add-on-ja.xml"
encoding="UTF-8">
<regexp pattern='releases/download/[^"]+' />
<substitution
expression="releases/download/v${version}/${ant.project.name}-framework-ja-${version}.zip"/>
</replaceregexp>
</target>
<target name="framework-ja.zip"
depends="build, translate, rnc-ja, xsd-ja, add-on-ja.xml"
description="Make a Zip archive of just the oXygen framework.">
<mkdir dir="${hyphenation-info.basedir.converted}/releases" />
<zip destfile="${hyphenation-info.basedir.converted}/releases/${ant.project.name}-framework-ja-${version}.zip"
basedir="${hyphenation-info.basedir.converted}"
excludes="**"
update="true">
<zipfileset dir="."
includes="README.md, LICENSE*.md, hyphenation-info-ja.framework"
prefix="${ant.project.name}-ja" />
<!--<zipfileset dir="css" includes="*.css" prefix="${ant.project.name}/css" />-->
<zipfileset dir="schema-ja" includes="catalog.xml, *.ent"
prefix="${ant.project.name}-ja/schema-ja" />
<zipfileset dir="schema-ja/rng" includes="*.rng"
prefix="${ant.project.name}-ja/schema-ja/rng" />
<zipfileset dir="schematron-ja" includes="*.sch"
prefix="${ant.project.name}-ja/schematron-ja" />
<zipfileset dir="template" includes="*.xml, *.fo, *.properties"
prefix="${ant.project.name}-ja/template" />
<zipfileset dir="xsl"
includes="*.xsl}"
prefix="${ant.project.name}-ja/xsl" />
</zip>
</target>
<target name="release" depends="add-on.xml, add-on-ja.xml, framework.zip, framework-ja.zip" />
<!-- Utility targets. -->
<target name="echoproperties">
<echoproperties />
</target>
</project>