-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.xml
183 lines (164 loc) · 8.07 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
<project basedir=".">
<description>
This is the base ant build file for the ATOP project. Eventually it will
provide one access method for all build and test functionality. At
present it just has a few targets we are using in the early development
phase of ATOP.
</description>
<!-- Globals file which defines various properties and also imports build.properties. -->
<import file="buildGlobals.xml"/>
<!-- Validation file which provides generic validation targets. -->
<import file="buildValidate.xml"/>
<basename property="ploddName" file="${inputPlodd}" suffix=".plodd"/>
<!-- Any single Schematron file we want to compile and use. -->
<property name="schSchemaFile" value=""/>
<target name="preclean" description="Clean out the results of any previous runs">
<description>
TARGET preClean
This target is designed to clean out the results of any previous processing
runs so that they don't get in the way or get re-transformed.
</description>
<dirname property="ploddDir" file="${inputPlodd}"/>
<echo message="Cleaning out detritus generated by prior builds from ${ploddDir}."/>
<delete dir="${ploddDir}">
<include name="*_preprocessed.plodd"/>
<include name="*.svrl"/>
<include name="*_svrl.txt"/>
</delete>
</target>
<target name="preValidatePloddWithSch" description="Validate the incoming PLODD with Schematron.">
<description>
TARGET preValidatePloddWithSch
This target validates the incoming unprocessed PLODD file with a local Schematron schema.
</description>
<antcall target="validateWithSchematron">
<param name="xmlFile" value="${inputPlodd}"/>
<param name="schSchemaFile" value="${basedir}/Schemas/pre-transpile.sch"/>
</antcall>
</target>
<target name="preValidatePloddWithRng" description="Validate the incoming PLODD with RELAXNG.">
<description>
TARGET preValidatePloddWithRng
This target validates the incoming unprocessed PLODD file with a local RELAXNG schema.
</description>
<dirname property="ploddDir" file="${inputPlodd}"/>
<echo message="Validating ${ploddDir}/${ploddName}.plodd with ../Schemas/ploddSchemaSpecification.rng"/>
<jing rngfile="${basedir}/Schemas/ploddSchemaSpecification.rng" failonerror="true">
<fileset file="${ploddDir}/${ploddName}.plodd"/>
</jing>
</target>
<target name="preprocessPlodd" description="Do some minor preprocessing on the PLODD file before the transpile stage.">
<description>
TARGET preprocessPlodd
This target runs some XSLT to do minor fix-ups on the PLODD file before the full transpile is run.
</description>
<dirname property="ploddDir" file="${inputPlodd}"/>
<echo message="Preprocessing ${ploddDir}/${ploddName}.plodd to ${ploddDir}/${ploddName}_preprocessed.plodd"/>
<java failonerror="true" fork="true" classname="net.sf.saxon.Transform" classpath="${saxon}" dir="${basedir}">
<arg value="-xsl:${basedir}/XSLT/pre-transpile.xslt"/>
<arg value="-s:${ploddDir}/${ploddName}.plodd"/>
<arg value="-o:${ploddDir}/${ploddName}_preprocessed.plodd"/>
<arg value="-xi"/>
</java>
</target>
<target name="ploddToRng" description="Do the final transpile to create RNG/SCH from the preprocessed PLODD file.">
<description>
TARGET ploddToRng
This runs the final transpile of the preprocessed PLODD to output a RELAX NG file
incorporating Schematron.
</description>
<dirname property="ploddDir" file="${inputPlodd}"/>
<echo message="Preprocessing ${ploddDir}/${ploddName}_preprocessed.plodd to ${ploddDir}/${ploddName}.rng"/>
<java failonerror="true" fork="true" classname="net.sf.saxon.Transform" classpath="${saxon}" dir="${basedir}">
<arg value="-xsl:${basedir}/XSLT/transpile.xslt"/>
<arg value="-s:${ploddDir}/${ploddName}_preprocessed.plodd"/>
<arg value="-o:${ploddDir}/${ploddName}.rng"/>
<arg value="-xi"/>
</java>
</target>
<target name="extractSchematron" description="Extract the Schematron from the RELAXNG file.">
<description>
TARGET extractSchematron
This target extracts the Schematron (if any) from the RELAXNG file generated from
a PLODD, and outputs it to a Schematron file with the same name.
</description>
<dirname property="ploddDir" file="${inputPlodd}"/>
<echo message="Extracting Schematron from ${ploddDir}/${ploddName}.rng to ${ploddDir}/${ploddName}.sch"/>
<java failonerror="true" fork="true" classname="net.sf.saxon.Transform" classpath="${saxon}" dir="${basedir}">
<arg value="-xsl:${basedir}/XSLT/extract_schematron.xslt"/>
<arg value="-s:${ploddDir}/${ploddName}.rng"/>
<arg value="-o:${ploddDir}/${ploddName}.sch"/>
<arg value="-xi"/>
</java>
</target>
<target name="validateRngWithRnc" description="Validate generated RELAXNG with its own schema.">
<description>
TARGET validateRngWithRnc
This target validates the generated RELAX NG file with its own RELAX NG (rnc) schema.
</description>
<dirname property="ploddDir" file="${inputPlodd}"/>
<echo message="Validate ${ploddDir}/${ploddName}.rng with ../Schemas/relaxng.rnc."/>
<jing compactsyntax="true" rngfile="${basedir}/Schemas/relaxng.rnc" failonerror="true">
<fileset file="${ploddDir}/${ploddName}.rng"/>
</jing>
</target>
<target name="validateSchematronWithRng" description="Validate extracted Schematron with its own schema.">
<description>
TARGET validateSchematronWithRng
This target validates the extracted Schematron file with its own RELAX NG schema.
</description>
<dirname property="ploddDir" file="${inputPlodd}"/>
<echo message="Validate ${ploddDir}/${ploddName}.sch with ../Schemas/schematron.rng."/>
<jing rngfile="${basedir}/Schemas/schematron.rng" failonerror="true">
<fileset file="${ploddDir}/${ploddName}.sch"/>
</jing>
</target>
<target name="validateSchematronWithSch" description="Validate the extracted Schematron with Schematron.">
<description>
TARGET validateSchematronWithSch
This target validates an extracted Schematron file with a local Schematron schema.
</description>
<dirname property="ploddDir" file="${inputPlodd}"/>
<antcall target="validateWithSchematron">
<param name="xmlFile" value="${ploddDir}/${ploddName}.sch"/>
<param name="schSchemaFile" value="${basedir}/Schemas/schematron.sch"/>
</antcall>
</target>
<target name="transpilePlodd" description="Run the full sequence of steps to create RNG and Schematron from a PLODD file.">
<description>
TARGET transpilePlodd
This runs the sequence of steps required to check the validity of a PLODD,
create RELAX NG and Schematron from a PLODD file, and thoroughly check the
results.
</description>
<antcall target="preclean"/>
<antcall target="preValidatePloddWithRng"/>
<antcall target="preValidatePloddWithSch"/>
<antcall target="preprocessPlodd"/>
<antcall target="ploddToRng"/>
<antcall target="extractSchematron"/>
<antcall target="validateRngWithRnc"/>
<antcall target="validateSchematronWithRng"/>
<antcall target="validateSchematronWithSch"/>
</target>
<target name="test">
<description>
TARGET test
This is a convenience target to run the test suite using the
buildTest.xml ant file.
</description>
<ant antfile="buildTest.xml" target="runXSpecTests"/>
<ant antfile="buildTest.xml" target="runTranspileTests"/>
</target>
<target name="showProperties" description="Simple debug output to show the input properties and their derivations.">
<description>
TARGET showProperties
This is a utility debugging target which simply echoes a number of properties
which are passed as parameters, or are derived from those parameters.
</description>
<echo message="schSchemaFile = ${schSchemaFile}"/>
<echo message="schSchemaName = ${schSchemaName}"/>
<echo message="schSchemaDir = ${schSchemaDir}"/>
<echo message="schSchemaXslt = ${schSchemaXslt}"/>
</target>
</project>