forked from music-encoding/music-encoding
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
550 lines (497 loc) · 28.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
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
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
<?xml version="1.0" encoding="UTF-8"?>
<!--
NOTICE: Copyright (c) by the Music Encoding Initiative (MEI) Board (formerly known as "MEI Council").
Licensed under the Educational Community 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 https://opensource.org/licenses/ECL-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.
This is a derivative work based on earlier versions of the schema © 2001-2006 Perry Roland
and the Rector and Visitors of the University of Virginia; licensed under the Educational
Community License version 1.0.
CONTACT: [email protected]
-->
<project name="music-encoding" default="dist" xmlns:if="ant:if" xmlns:unless="ant:unless">
<!-- import version properties -->
<property file="build.properties"/>
<property environment="env">
<!-- set environment variable -->
</property>
<property name="version" value="dev"/>
<!-- in XSLT version = att.meiversion defaultVal -->
<property name="github.sha" value="">
<!-- string external The current GitHub sha -->
</property>
<property name="github.event_name" value="github.event_name">
<!--string external The name of the event that triggered the workflow run. e.g.: push, pull_request; cf. https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows -->
</property>
<property name="github.ref" value="">
<!-- string external The branch or tag ref that triggered the workflow run. For branches this in the format refs/heads/<branch_name>, and for tags it is refs/tags/<tag_name> -->
</property>
<loadresource property="github.ref-type" quiet="true">
<string value="${github.ref}"/>
<filterchain>
<tokenfilter>
<replaceregex pattern="([^\/]+\/)([^\/]+)(\/[^\/]+)" replace="\2"/>
</tokenfilter>
</filterchain>
</loadresource>
<loadresource property="github.ref-name" quiet="true">
<string value="${github.ref}"/>
<filterchain>
<tokenfilter>
<replaceregex pattern="([^\/]+\/)+" replace=""/>
</tokenfilter>
</filterchain>
</loadresource>
<loadresource property="windir" quiet="true">
<string value="${basedir}"/>
<filterchain>
<tokenfilter>
<replaceregex pattern="\\" replace="/"/>
</tokenfilter>
</filterchain>
</loadresource>
<condition property="basedir.cross_platform" value="${basedir}" else="file:/${windir}">
<not>
<os family="windows"/>
</not>
</condition>
<condition property="verbose" value="true" else="false">
<contains string="${sun.java.command}" substring="-v" />
</condition>
<!-- directories -->
<property name="dir.build" value="build"/>
<property name="dir.dist" value="dist"/>
<property name="dir.lib" value="lib"/>
<property name="dir.validation" value="source/validation"/>
<property name="dir.dist.guidelines" value="${dir.dist}/guidelines/web"/>
<property name="dir.dist.schemata" location="${dir.dist}/schemata/"/>
<property name="dir.lib.saxon" value="${dir.lib}/saxon"/>
<property name="dir.lib.schematron" value="${dir.lib}/schematron"/>
<property name="dir.lib.stylesheets" value="${dir.lib}/stylesheets"/>
<property name="dir.lib.xerces" value="${dir.lib}/xerces"/>
<!-- canonicalization -->
<property name="canonicalized.file.prefix" value="mei-source_canonicalized_v"/>
<property name="canonicalized.file.latest" value="${canonicalized.file.prefix}${meiversion.latest}.xml"/>
<property name="canonicalized.file.next" value="${canonicalized.file.prefix}${meiversion.next}.xml"/>
<property name="canonicalized.source.path" value="${dir.build}/${canonicalized.file.next}"/>
<property name="canonicalized.source.path.cross_platform" value="${basedir.cross_platform}/${canonicalized.source.path}"/>
<!-- jar dependencies -->
<property name="oxygen.basic.utilites.jar.file" value="oxygen-basic-utilities-${xerces.version}.jar"/>
<property name="saxon.jar.file" value="saxon-he-${saxon.version}.jar"/>
<property name="schematron.jar.file" value="ph-schematron-ant-task-${schematron.version}-jar-with-dependencies.jar"/>
<property name="xerces.jar.file" value="oxygen-patched-xerces-${xerces.version}.jar"/>
<target name="help">
<antcall target="echo-mei"/>
<echo>================================================</echo>
<echo>= Welcome to the MEI music-encoding ant-script! =</echo>
<echo>================================================</echo>
<echo/>
<echo>This is the default build target with some usage information.</echo>
<echo>You can also call this via 'ant help'</echo>
<echo/>
<echo>To build distribution of canonicalized source, compiled ODDs and customization RNGs run the default target `dist` by executing:</echo>
<echo>ant dist</echo>
<echo>OR just</echo>
<echo>ant</echo>
<echo/>
<echo>run 'ant -projecthelp' or 'ant -p' to get more information on the available build targets.</echo>
<echo/>
<echo>The following buildproperties are configured in your environment:</echo>
<echo/>
<antcall target="echo-properties"/>
</target>
<target name="clean" description="Deletes the following directories: `build`, `dist` and `temp`." depends="info">
<delete dir="build"/>
<delete dir="dist"/>
<delete dir="temp"/>
</target>
<target name="echo-classpath" description="Echos the mei.classpath." depends="init-mei-classpath">
<echo message="${ant.refid:mei.classpath}"></echo>
</target>
<target name="echo-mei">
<loadfile srcfile="source/assets/images/meilogo_ascii_100.txt" property="mei" />
<echo message="${mei}"/>
</target>
<target name="echo-properties" description="Echos all ant properties.">
<echoproperties/>
</target>
<target name="get-local-git-sha" description="Retrieves the local git sha.">
<exec executable="git" outputproperty="github.sha.local">
<arg value="describe"/>
<arg value="--match=NeVeRmAtCh"/>
<arg value="--always"/>
<arg value="--abbrev"/>
<arg value="--dirty"/>
</exec>
<echo>Local github.sha: ${github.sha.local}</echo>
</target>
<target name="get-local-git-branch" description="Retrieves the current git branch via command line.">
<exec executable="git" outputproperty="github.branch.local">
<arg value="branch"/>
<arg value="--show-current"/>
</exec>
<echo>Local github.branch: ${github.branch.local}</echo>
</target>
<target name="reset" description="Resets the build environment. Same as `clean`, but additionally deletes the `lib` directory with the jar files.">
<antcall target="clean"/>
<delete dir="lib"/>
</target>
<target name="info" description="Displays the versions of Ant and Java (JDK).">
<echo>Ant version: ${ant.version}</echo>
<echo>Java version (JDK): ${ant.java.version}</echo>
</target>
<target name="init" description="Initializes the build environment, i.e., checks if TEI Stylesheets, Saxon, Xerces and Schematron are available, and if not, it downloads everything into the `lib` folder. Checks if Prince is available." depends="info">
<!-- check if Xerces is available -->
<condition property="xerces-available">
<or>
<available file="${dir.lib.xerces}/${xerces.jar.file}"/>
<available classname="org.apache.xerces.jaxp.SAXParserFactoryImpl"/>
</or>
</condition>
<echo if:set="xerces-available" message="xerces available: ${xerces-available}"/>
<echo unless:set="xerces-available" message="xerces available: false"/>
<!-- check if Saxon is available -->
<condition property="saxon-available">
<or>
<available file="${dir.lib.saxon}/${saxon.jar.file}"/>
<available classname="net.sf.saxon.Transform"/>
</or>
</condition>
<echo if:set="saxon-available" message="saxon available: ${saxon-available}"/>
<echo unless:set="saxon-available" message="saxon available: false"/>
<!-- check if Schematron is available -->
<condition property="schematron-available">
<or>
<available file="${dir.lib.schematron}/${schematron.jar.file}"/>
<available classname="com.helger.schematron.ant.Schematron"/>
</or>
</condition>
<echo if:set="schematron-available" message="schematron available: ${schematron-available}"/>
<echo unless:set="schematron-available" message="schematron available: false"/>
<!-- check if Stylesheets are available -->
<fileset id="stylesheets.version.file" dir="${dir.lib.stylesheets}">
<patternset>
<include name="VERSION"/>
</patternset>
<contains text="${stylesheets.version}" />
</fileset>
<condition property="stylesheets-available">
<and>
<available file="${dir.lib.stylesheets}"/>
<resourcecount when="equal" count="1" refid="stylesheets.version.file"/>
</and>
</condition>
<echo if:set="stylesheets-available" message="stylesheets available: ${stylesheets-available}"/>
<echo unless:set="stylesheets-available" message="stylesheets available: false"/>
<!-- check if Prince is available -->
<condition property="prince-available">
<available file="prince" filepath="${env.PATH}" />
</condition>
<echo if:set="prince-available" message="prince available: ${prince-available}"/>
<echo unless:set="prince-available" message="prince available: false"/>
<antcall target="stylesheets-prepare" unless:true="${stylesheets-available}"/>
<antcall target="saxon-prepare" unless:true="${saxon-available}"/>
<antcall target="schematron-download" unless:true="${schematron-available}"/>
<antcall target="xerces-download" unless:true="${xerces-available}"/>
<echo>initialized</echo>
</target>
<target name="saxon-download" unless="${saxon-available}">
<mkdir dir="temp"/>
<get src="https://github.com/Saxonica/Saxon-HE/releases/download/${saxon.edition.version}/${saxon.edition.version}J.zip" dest="temp/download"/>
</target>
<target name="saxon-prepare" depends="saxon-unzip" unless="${saxon-available}">
<delete dir="temp/"/>
</target>
<target name="saxon-unzip" depends="saxon-download" unless="${saxon-available}">
<mkdir dir="${dir.lib.saxon}"/>
<unzip src="temp/download" overwrite="true" dest="${dir.lib.saxon}"/>
<echo>downloaded saxon jar</echo>
</target>
<target name="schematron-download" unless="${schematron-available}">
<mkdir dir="${dir.lib.schematron}"/>
<get src="https://repo1.maven.org/maven2/com/helger/schematron/ph-schematron-ant-task/${schematron.version}/${schematron.jar.file}" dest="${dir.lib.schematron}"/>
<echo>downloaded schematron jar</echo>
</target>
<target name="stylesheets-download" unless="${stylesheets-available}">
<mkdir dir="temp"/>
<get src="https://github.com/TEIC/Stylesheets/releases/download/v${stylesheets.version}/tei-xsl-${stylesheets.version}.zip" dest="temp/download"/>
</target>
<target name="stylesheets-prepare" depends="stylesheets-unzip" unless="${stylesheets-available}">
<delete dir="temp/"/>
</target>
<target name="stylesheets-unzip" depends="stylesheets-download" unless="${stylesheets-available}">
<mkdir dir="${dir.lib.stylesheets}"/>
<unzip src="temp/download" overwrite="true" dest="${dir.lib.stylesheets}">
<patternset>
<include name="xml/tei/stylesheet/**"/>
</patternset>
<mapper>
<globmapper from="xml/tei/stylesheet/*" to="*"/>
</mapper>
</unzip>
<echo>downloaded tei stylesheets</echo>
</target>
<target name="xerces-download" unless="${xerces-available}">
<mkdir dir="${dir.lib.xerces}"/>
<get src="https://www.oxygenxml.com/maven/com/oxygenxml/oxygen-patched-xerces/${xerces.version}/${xerces.jar.file}" dest="${dir.lib.xerces}"/>
<get src="https://www.oxygenxml.com/maven/com/oxygenxml/oxygen-basic-utilities/${xerces.version}/${oxygen.basic.utilites.jar.file}" dest="${dir.lib.xerces}"/>
<echo>downloaded xerces jars</echo>
</target>
<target name="init-mei-classpath" description="Initializes the mei.classpath, which is essential for the schema generation, by prepending the jar files contained in the lib directory to the java classpath. Will be called automatically if needed." depends="init">
<path id="mei.classpath">
<fileset dir="lib" erroronmissingdir="false">
<include name="saxon/*.jar"/>
<include name="xerces/*.jar"/>
<include name="schematron/*.jar"/>
</fileset>
<pathelement path="${java.class.path}"/>
</path>
<echo>mei.classpath set</echo>
</target>
<target name="canonicalize-source" description="Creates a canonicalized version of the mei-source.xml, i.e., resolves xincludes and puts result in `build/mei-source_canonicalized_v{mei-version}`." depends="init-mei-classpath">
<echo unless:set="canonicalize-source.done">canonicalizing source...</echo>
<java unless:set="canonicalize-source.done" classname="net.sf.saxon.Transform" classpathref="mei.classpath" failonerror="true" fork="true">
<arg value="-s:${basedir}/source/mei-source.xml"/>
<arg value="-xsl:${basedir}/utils/canonicalization/copy.xsl"/>
<arg value="-o:${canonicalized.source.path}"/>
<arg value="-xi:on"/>
</java>
<property name="canonicalize-source.done" value="true"/>
<echo>canonicalized source available: ${canonicalize-source.done}</echo>
</target>
<target name="validate-source" depends="canonicalize-source" description="Validates the canonicalized source. This target will be triggered before all `build-...` targets.">
<echo unless:set="validate-source.done">validating source...</echo>
<taskdef name="schematron" classname="com.helger.schematron.ant.Schematron" classpathref="mei.classpath" loaderref="mei.classpath.loader" />
<schematron unless:set="validate-source.done" schematronFile="${dir.validation}/mei-source.sch" expectSuccess="true" schematronProcessingEngine="schematron" languageCode="en" failOnError="true" failOnValidationError="true">
<fileset dir="${dir.build}">
<include name="${canonicalized.file.next}" ></include>
</fileset>
</schematron>
<property name="validate-source.done" value="true"/>
<echo>canonicalized source validated: ${validate-source.done}</echo>
</target>
<target name="build-compiled-odd" description="Builds the compiled ODD of a specific customization submitted as absolute path with -Dcustomization.path input param." depends="validate-source">
<basename property="selectedSchema" file="${customization.path}" suffix=".xml"/>
<ant dir="${dir.lib.stylesheets}/odd/" antfile="build-to.xml" target="go" inheritall="true">
<property name="inputFile" value="${customization.path}"/>
<property name="outputFile" value="${dir.dist.schemata}/${selectedSchema}_compiled.odd"/>
<property name="defaultSource" value="${canonicalized.source.path.cross_platform}"/>
<property name="verbose" value="${verbose}"/>
<property name="summaryDoc" value="false"/>
<property name="suppressTEIexamples" value="true"/>
<reference refid="mei.classpath" torefid="classpath"/>
</ant>
</target>
<target name="build-customization-specs" depends="validate-source" description="Builds the specs for a customization submitted as absolute path with -Dcustomization.path input param.">
<basename property="selectedSchema" file="${customization.path}" suffix=".xml"/>
<antcall target="build-compiled-odd">
<param name="customization.path" value="${customization.path}"></param>
</antcall>
<ant dir="${dir.lib.stylesheets}/html5" antfile="build-to.xml" target="odd" inheritall="true">
<property name="inputFile" value="${dir.dist.schemata}/${selectedSchema}_compiled.odd"/>
<property name="outputFile" value="${dir.dist.schemata}/${selectedSchema}_compiled.html"/>
<property name="verbose" value="${verbose}"/>
<property name="processODD">true</property>
<reference refid="mei.classpath" torefid="classpath"/>
</ant>
</target>
<target name="build-rng" description="Builds the RNG schema of a specific customization submitted as absolute path with -Dcustomization.path input param." depends="validate-source">
<basename property="selectedSchema" file="${customization.path}" suffix=".xml"/>
<echo>building rng ${selectedSchema} from ${customization.path}</echo>
<echo> source: ${canonicalized.source.path.cross_platform}</echo>
<echo> output: ${dir.dist.schemata}/${selectedSchema}.rng</echo>
<ant dir="${dir.lib.stylesheets}/rng/" antfile="build-to.xml" target="dist" inheritall="true" usenativebasedir="true"><!-- check whether nativebasdir is required -->
<property name="inputFile" value="${customization.path}"/>
<property name="outputFile" value="${dir.dist.schemata}/${selectedSchema}.rng"/>
<property name="defaultSource" value="${canonicalized.source.path.cross_platform}"/>
<property name="verbose">true</property>
<reference refid="mei.classpath" torefid="classpath"/>
<property name="verbose" value="${verbose}"/>
</ant>
</target>
<target name="build-guidelines-html" description="Builds the HTML version of the MEI guidelines." depends="validate-source" unless="${build-guidelines-html.done}">
<!-- TODO: check dependency try with mei-source.xml -->
<antcall target="get-local-git-sha" if:blank="${github.sha}"/>
<antcall target="get-local-git-branch" if:blank="${github.ref}"/>
<basename property="selectedSchema" file="${customization.path}" suffix=".xml"/>
<echo message="building HTML guidelines for ${selectedSchema} from ${customization.path} on branch ${github.branch.local}"/>
<echo>github.sha: ${github.sha}</echo>
<echo>github.sha.local: ${github.sha.local}</echo>
<condition property="hash" value="${github.sha}" else="${github.sha.local}">
<not>
<equals arg1="${github.sha}" arg2="" forcestring="true"/>
</not>
</condition>
<condition property="branch" value="${github.ref-name}" else="${github.branch.local}">
<not>
<equals arg1="${github.ref}" arg2="" forcestring="true"/>
</not>
</condition>
<antcall target="copy-guidelines-assets"/>
<java classname="net.sf.saxon.Transform" classpathref="mei.classpath" failonerror="true" fork="true">
<arg value="-s:${canonicalized.source.path}"/>
<arg value="-xsl:${basedir}/utils/guidelines_xslt/odd2html.xsl"/>
<arg value="-xi:on"/>
<arg value="output.folder=${basedir}/${dir.build}/"/>
<arg value="hash=${hash}"/>
<arg value="branch=${branch}"/>
<arg value="basedir=${basedir.cross_platform}"/>
</java>
<antcall target="generate-images"/>
<antcall target="copy-generated-images"/>
</target>
<target name="build-guidelines-pdf" description="Builds the PDF version of the MEI guidelines. (Calls `build-guidelines-html` before execution.)" depends="build-guidelines-html">
<!-- create output directory for PDF -->
<mkdir dir="${dir.dist}/guidelines/pdf"/>
<!-- get HTML input file -->
<pathconvert property="build.dir.filelist" pathsep="${line.separator}">
<map from="${basedir}${file.separator}" to=""/>
<fileset dir="${dir.build}">
<include name="MEI_Guidelines_*.html"/>
</fileset>
</pathconvert>
<!-- set the prince.input property -->
<loadresource property="prince.input">
<string value="${build.dir.filelist}"/>
<filterchain>
<headfilter lines="1"/>
</filterchain>
</loadresource>
<!-- set the prince.output.filename and prince.output.path properties -->
<basename file="${prince.input}" property="prince.output.basename" suffix=".html"/>
<property name="prince.output.filename" value="${prince.output.basename}.pdf"/>
<property name="prince.output.path" value="${dir.dist}/guidelines/pdf/${prince.output.filename}"/>
<!-- run Prince to convert HTML guidelines to PDF -->
<exec executable="prince" failonerror="true">
<arg prefix="--log=" value="${dir.build}/prince.log"/>
<arg prefix="--output=" value="${prince.output.path}"/>
<arg file="${prince.input}"/>
</exec>
</target>
<target name="copy-guidelines-assets">
<echo message="copying guidelines assets from source to build and dist folders"/>
<copy todir="${dir.build}/assets">
<fileset dir="source/assets"/>
</copy>
<copy todir="${dir.dist.guidelines}/assets">
<fileset dir="source/assets"/>
</copy>
</target>
<target name="generate-images" description="Generates SVG images of MEI files in assets/images/GeneratedImages; depends on docker-mei container image." if="${docker}">
<exec executable="node" dir="${basedir}/../">
<arg value="index.js"/>
</exec>
</target>
<target name="generate-images-py" description="Generates SVG images of MEI files in assets/images/GeneratedImages; depends on python3 with Verovio installed.">
<exec executable="python3" logerror="true" dir="${basedir}/utils/examples" failifexecutionfails="true" failonerror="true">
<arg value="generate-examples.py"/>
<arg value="--clean"/>
<arg value="--verbose"/>
</exec>
</target>
<target name="copy-generated-images" description="Copies generated images to dist after they're created by running Docker image.">
<copy todir="${dir.dist.guidelines}/assets/images/GeneratedImages">
<fileset dir="${dir.build}/assets/images/GeneratedImages">
<include name="*.svg"/>
</fileset>
</copy>
</target>
<target name="build-customizations" description="Builds the RNG schemata for all MEI customizations." depends="validate-source">
<antcall target="build-rng">
<param name="customization.path" value="${basedir}/customizations/mei-all.xml"/>
</antcall>
<antcall target="build-rng">
<param name="customization.path" value="${basedir}/customizations/mei-all_anyStart.xml"/>
</antcall>
<antcall target="build-rng">
<param name="customization.path" value="${basedir}/customizations/mei-basic.xml"/>
</antcall>
<antcall target="build-rng">
<param name="customization.path" value="${basedir}/customizations/mei-CMN.xml"/>
</antcall>
<antcall target="build-rng">
<param name="customization.path" value="${basedir}/customizations/mei-Mensural.xml"/>
</antcall>
<antcall target="build-rng">
<param name="customization.path" value="${basedir}/customizations/mei-Neumes.xml"/>
</antcall>
</target>
<target name="build-compiled-odds" description="Builds the compiled ODD files for all MEI customizations." depends="validate-source">
<antcall target="build-compiled-odd">
<param name="customization.path" value="${basedir}/customizations/mei-all.xml"/>
</antcall>
<antcall target="build-compiled-odd">
<param name="customization.path" value="${basedir}/customizations/mei-all_anyStart.xml"/>
</antcall>
<antcall target="build-compiled-odd">
<param name="customization.path" value="${basedir}/customizations/mei-basic.xml"/>
</antcall>
<antcall target="build-compiled-odd">
<param name="customization.path" value="${basedir}/customizations/mei-CMN.xml"/>
</antcall>
<antcall target="build-compiled-odd">
<param name="customization.path" value="${basedir}/customizations/mei-Mensural.xml"/>
</antcall>
<antcall target="build-compiled-odd">
<param name="customization.path" value="${basedir}/customizations/mei-Neumes.xml"/>
</antcall>
</target>
<target name="compare-versions" description="Compares the canonicalized sources of the MEI dev version with the previous stable version and creates an HTML output; custom versions and output folder can be set via -Dsource, -Dold and -Doutput input params." depends="validate-source">
<!-- set source file -->
<property name="source.default" value="${canonicalized.source.path}"/>
<echo level="verbose">source.default: ${source.default}</echo>
<echo level="verbose">source user input: ${source}</echo>
<condition property="source.file" value="${source}" else="${source.default}">
<isset property="source"/>
</condition>
<echo>Using source.file: ${source.file}</echo>
<!-- set old file to compare with -->
<property name="old.default" value="${dir.build}/${canonicalized.file.latest}"/>
<condition property="old.default-available" value="true">
<available file="${old.default}"/>
</condition>
<get src="https://raw.githubusercontent.com/music-encoding/schema/main/${meiversion.latest}/${canonicalized.file.latest}" dest="${old.default}" unless:true="${old.default-available}"/>
<echo level="verbose">old.default: ${old.default}</echo>
<echo level="verbose">old user input: ${old}</echo>
<condition property="old.file" value="${old}" else="${old.default}">
<isset property="old"/>
</condition>
<echo>Using old.file: ${old.file}</echo>
<!-- check if old.file is available, otherwise fail early -->
<condition property="old.available" value="true" else="false">
<available file="${old.file}"/>
</condition>
<echo message="old.file available: ${old.available}"></echo>
<fail unless:true="${old.available}">Unfortunately, the $old.file ${old.file} is not available at the specified location.</fail>
<!-- set ouput folder -->
<property name="output.default" value="./utils/compare_versions/"/>
<echo level="verbose">output.default: ${output.default}</echo>
<echo level="verbose">output user input: ${output}</echo>
<condition property="output.folder" value="${output}" else="${output.default}">
<isset property="output"/>
</condition>
<echo>Using output folder: ${output.folder}</echo>
<!-- compare versions -->
<java classname="net.sf.saxon.Transform" classpathref="mei.classpath" failonerror="true" fork="true">
<arg value="-s:${source.file}"/>
<arg value="-xsl:${basedir}/utils/compare_versions/comparison.xsl"/>
<arg value="-xi:on"/>
<arg value="output.folder=${output.folder}"/>
<arg value="old.version.filename=file:${old.file}"/>
</java>
<echo>Comparison done. See ${output.folder}/comparison.html for results.</echo>
</target>
<target name="dist" description="Default main target; equivalent to calling ant without any target. Builds all artifacts, i.e., RNG and compiled ODDs of all customizations, guidelines html and PDF." depends="validate-source">
<classfileset refid="mei.classpath"/>
<antcall target="echo-mei"/>
<antcall target="build-customizations"/>
<antcall target="build-compiled-odds"/>
<antcall target="build-guidelines-html"/>
<property name="${build-guidelines-html.done}" value="true"/>
<antcall target="build-guidelines-pdf" if:true="${prince-available}"/>
</target>
</project>