/[volute]/trunk/projects/dm/vo-dml-org/build.xml
ViewVC logotype

Contents of /trunk/projects/dm/vo-dml-org/build.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4146 - (show annotations)
Tue Jul 11 08:52:16 2017 UTC (3 years ago) by lmichel
File MIME type: text/xml
File size: 17879 byte(s)
Old folder renamed. Should be removed soon
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <!DOCTYPE project [
4 <!ENTITY buildJava SYSTEM "./build_java.xml">
5 <!ENTITY buildJalopy SYSTEM "./build_jalopy.xml">
6 ]>
7
8 <project name="VO-DML-builder" default="run_vo-dml" basedir=".">
9
10 <description>
11 This build file can be considered as the transformer tool for any data model in VO-DML format,
12 the official IVOA VO-DML data model language.
13 Such files can be generated from an xmi file formatted with MagicDraw CE 12.1. [TODO add more info about this].
14 But can also be written by hand or generated any other way.
15 Further targets exist for
16 - updating utype-s of a VO-DML file with a version conforming to the UTYPEs grammar
17 [TODO define this explicitly].
18 - validating a vo-dml file.
19 - generating HTML documentation with UTYPE assignments (html)
20 - generating GraphViz file + PNG image +cmap for use in generated HTML file.
21
22 Note: the targets starting with run_ generally require ant-contrib to be available.
23 See http://ant-contrib.sourceforge.net/
24 This will allow one to run targets for multiple models in one go.
25 Otherwise the targets without the run_ must be used.
26 TBD do a check if ant-contrib exists and
27
28
29 TODO: add other generation targets, e.g. XML schema, TAP, DDL, Java.
30 In VO-URP we had XSLT for that as well,
31 we may decide for alternative generation mechanisms here.
32
33 Authors : lemson@mpa-garching.mpg.de, [Laurent Bourges]
34
35 Version : 2012-11-23
36 </description>
37
38
39 <property file="build.properties" />
40 <property file="${model}/vo-dml.properties" />
41 <property name="ant.contrib.jar" value="./xslt/libs/ant-contrib-0.6.jar"/>
42
43
44 <!-- define XSLT2 task -->
45 <presetdef name="xslt2">
46 <!-- The processor=SaxonLiaison setting causes our custom XSLTLiaison class to be used. -->
47 <!-- This works around bug #41314: http://issues.apache.org/bugzilla/show_bug.cgi?id=41314 -->
48 <xslt force="true" classpath="./xslt/libs/saxon9.jar:./xslt/libs/ant-trax.jar:./xslt/libs" processor="SaxonLiaison">
49 <outputproperty name="{http://saxon.sf.net/}indent-spaces" value="2" />
50 </xslt>
51 </presetdef>
52
53 <target name="set-ant-contrib" if="ant.contrib.jar">
54 <taskdef resource="net/sf/antcontrib/antlib.xml">
55 <classpath>
56 <pathelement location="${ant.contrib.jar}" />
57 </classpath>
58 </taskdef>
59 </target>
60
61 <!-- allow use of schematron to validate vo-dml -->
62 <!--
63 <taskdef name="schematron" classname="com.schematron.ant.SchematronTask" classpath="./xslt/libs/ant-schematron-2010-04-14.jar" />
64 -->
65 <!-- set global properties for this build -->
66
67 <!-- Get build properties (model dependent) -->
68
69 <tstamp>
70 <format property="build.date" pattern="yyyy-MM-dd HH:mm:ss" />
71 </tstamp>
72 <!--
73 -->
74 <property name="source_checked" value="${dm.filename.prefix}_CHECK.xml" />
75
76 <property name="vo-dml.source" value="${dm.filename.prefix}.vo-dml.xml" />
77 <property name="html.target" value="${dm.filename.prefix}.html" />
78 <property name="rdf.target" value="${dm.filename.prefix}.ttl"/>
79 <property name="paths.target" value="${dm.filename.prefix}.paths.html" />
80 <property name="paths.target.xml" value="${dm.filename.prefix}.paths.xml" />
81 <property name="pojo.target" value="${dm.filename.prefix}.pojo.xml" />
82 <property name="uml" location="./uml" />
83 <property name="xslt" location="./xslt" />
84 <property name="java.gen" location="./java/gen" />
85 <property name="sources.gen" location="${java.gen}" />
86 <property name="libs" location="./libs" />
87 <property name="sources" location="./java/src" />
88 <property name="jaxb" location="./java/jaxb" />
89 <property name="jaxb.preserve" location="./java/jaxb-preserve" />
90 <property name="jaxb.libs" location="${libs}/jaxb" />
91
92 <property name="xsd" location="./xsd" />
93 <property name="xsd.gen" location="./models-xsd" />
94 <property name="build" location="./build"/>
95 <property name="build.jaxb" location="${build}/jaxb" />
96 <property name="build.jaxb.jar" value="vo-dml.jaxb.jar" />
97 <property name="build.src" location="${build}/src" />
98 <property name="build.src.jar" value="vo-dml.src.jar" />
99 <property name="build.gen" location="${build}/gen" />
100 <property name="build.gen.jar" value="vo-dml.models.jar" />
101
102 <property name="graphviz.gvd" value="${dm.filename.prefix}.gvd" />
103 <property name="graphviz.png" value="${dm.filename.prefix}.png" />
104 <property name="graphviz.map" value="${dm.filename.prefix}.cmap" />
105 <property name="graphviz.map.placeholder" value="___GRAPHVIZ_MAP___" />
106
107
108 <fileset id="jarfiles" dir="${libs}">
109 <!-- eclipselink (2.2.0) JPA 2.0 reference implementation -->
110 <include name="eclipselink.jar" />
111 <include name="kxml2-2.3.0.jar" />
112 <include name="mongo-java-driver-2.9.3.jar" />
113 </fileset>
114
115
116 <!-- target about : -->
117 <target name="about" depends="init" description="show information for public targets">
118 <echo>available ant targets : </echo>
119 <echo>-------------------------------------------------------------------------------</echo>
120 <echo> - updateSpec : make all transformations (uml -> metaModel -> others) </echo>
121 <echo> required for the specification </echo>
122 <echo>-------------------------------------------------------------------------------</echo>
123 </target>
124
125
126
127
128 <!-- target init : timestamp -->
129 <target name="init">
130 <echo>-------------------------------------------------------------------------------</echo>
131 <echo> project name : ${dm.filename.prefix} </echo>
132 <echo>-------------------------------------------------------------------------------</echo>
133 </target>
134
135
136
137 <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
138 vo-dml generation
139 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
140 <!-- run all vo-dml targets -->
141
142 <target name="run_xmi2vo-dml" depends="set-ant-contrib"
143 description="generate VO-DML/XML from XMI for all indicated models, requires ant-contrib">
144 <fail unless="models" message="Must define property 'models' in build.properties before running run_vo-dml_all target !" />
145 <for list="${models}" param="model">
146 <sequential>
147 <ant target="xmi2vo-dml" inheritall="false">
148 <property name="model" value="@{model}" />
149 </ant>
150 </sequential>
151 </for>
152 </target>
153
154 <target name="run_vo-dml2html" depends="set-ant-contrib"
155 description="generate HTML documentation for all indicated models, requires ant-contrib">
156 <fail unless="models" message="Must define property 'models' in build.properties before running run_vo-dml_all target !" />
157 <for list="${models}" param="model">
158 <sequential>
159 <ant target="vo-dml2html" inheritall="false">
160 <property name="model" value="@{model}"/>
161 </ant>
162 </sequential>
163 </for>
164 </target>
165
166
167 <target name="vo-dml2html" depends="vo-dml2gvd" if="model" >
168 <echo>run_vo-dml2html : starting generate HTML from file ${model}/${dm.filename.prefix}</echo>
169 <xslt2 in="${model}/${vo-dml.source}" out="${model}/${html.target}" style="${xslt}/vo-dml2html.xsl">
170 <param name="project_name" expression="${dm.filename.prefix}" />
171 <param name="graphviz_png" if="graphviz.path" expression="${graphviz.png}" />
172 <param name="graphviz_map" if="graphviz.path" expression="${graphviz.map.placeholder}" />
173 <param name="preamble" expression="${html.preamble}" />
174 </xslt2>
175 <ant target="postGenerateHTML" />
176 <echo>run_vo-dml2html : done.</echo>
177 </target>
178
179 <target name="run_vo-dml2pojo" description="Generate POJO java classes for all models identified in mapping.file">
180 <fail unless="mapping.file" message="Must define property 'mapping.file' in build.properties (the source VO-DML file) !" />
181 <echo>run_vo-dml2pojo : starting generate Java code for all models in mapping file ${mapping.file}</echo>
182
183 <xslt2 in="${mapping.file}" out="${java.gen}/run_pojo.txt" style="${xslt}/vo-dml2pojo.xsl">
184 <param name="mapping_file" expression="${mapping.file}" />
185 <param name="vo-dml_package" expression="${vodml.package}" />
186 </xslt2>
187
188 <ant target="format"/>
189 <!--
190 -->
191 </target>
192
193 <target name="run_vo-dml2rdf" depends="set-ant-contrib"
194 description="generate HTML documentation for all indicated models, requires ant-contrib">
195 <fail unless="models" message="Must define property 'models' in build.properties before running run_vo-dml_all target !" />
196 <for list="${models}" param="model">
197 <sequential>
198 <ant target="vo-dml2rdf" inheritall="false">
199 <property name="model" value="@{model}"/>
200 </ant>
201 </sequential>
202 </for>
203 </target>
204
205
206 <target name="run_vo-dml" depends="set-ant-contrib" description="generate VO-DML/XML, validate it and generate HTML for all generated model, requires ant-contrib">
207 <fail unless="models" message="Must define property 'models' in build.properties before running run_vo-dml_all target !" />
208 <for list="${models}" param="model">
209 <sequential>
210 <ant target="run_xmi2vo-dml" inheritAll="true"/>
211 <ant target="run_validate_vo-dml" inheritAll="true"/>
212 <ant target="run_vo-dml2html" inheritAll="true"/>
213 </sequential>
214 </for>
215 </target>
216
217
218
219 <target name="run_validate_vo-dml" depends="set-ant-contrib"
220 description="validate all VO-MDL/XML models in the list of input models">
221 <fail unless="ant.contrib.jar" message="ant.contrib.jar is not specified, use validate_vo-dml instead with single model in input variable"/>
222 <fail unless="models" message="Must define property 'models' in build.properties before running run_vo-dml_all target !" />
223 <for list="${models}" param="model">
224 <sequential>
225 <ant target="validate_vo-dml" inheritall="false">
226 <property name="model" value="@{model}"/>
227 </ant>
228 </sequential>
229 </for>
230 </target>
231
232
233 <!-- =========================================================================================== -->
234 <!-- Targets to be run when ant.contrib,jar is not set and input parameter in build.properties MUST identify a single model -->
235 <!-- =========================================================================================== -->
236
237 <!-- target run_xmi2vo-dml : transform the source model (xmi) to the vo-dml model
238 then generate the utype-s-->
239 <target name="xmi2vo-dml" if="xmi.source">
240 <fail unless="model" message="Must define property 'model' in build.properties !" />
241 <fail unless="xmi.source.profile" message="Must define property 'xmi.source.profile' in ${model}/vo-dml.properties (the profile according to which XMI file is structured) !" />
242 <echo> Running xmi2vo-dml for ${model}/${xmi.source}</echo>
243 <ant target="xmi2vo-dml_${xmi.source.profile}"/>
244 <xslt2 in="${model}/__TEMP__.vo-dml.xml" out="${model}/${vo-dml.source}" style="${xslt}/generate-utypes4vo-dml.xsl"/>
245 <!--
246 <delete file="${model}/__TEMP__.vo-dml.xml" />
247 -->
248 </target>
249 <!-- TODO as all the concrete targets below have ame content we can remove them. -->
250 <target name="xmi2vo-dml_MD_CE_12.1" if="model">
251 <xslt2 in="${model}/${xmi.source}" out="${model}/__TEMP__.vo-dml.xml" style="${xslt}/xmi2vo-dml_${xmi.source.profile}.xsl">
252 </xslt2>
253 </target>
254
255 <target name="xmi2vo-dml_MD17.0.5_Arnold" if="model">
256 <xslt2 in="${model}/${xmi.source}" out="${model}/__TEMP__.vo-dml.xml" style="${xslt}/xmi2vo-dml_${xmi.source.profile}.xsl">
257 </xslt2>
258 </target>
259
260 <target name="xmi2vo-dml_Altova_UML2.0" if="model">
261 <xslt2 in="${model}/${xmi.source}" out="${model}/__TEMP__.vo-dml.xml" style="${xslt}/xmi2vo-dml_${xmi.source.profile}.xsl"/>
262 </target>
263
264 <target name="xmi2vo-dml_Altova_UML2.1.2" if="model">
265 <xslt2 in="${model}/${xmi.source}" out="${model}/__TEMP__.vo-dml.xml" style="${xslt}/xmi2vo-dml_${xmi.source.profile}.xsl"/>
266 </target>
267
268 <target name="xmi2vo-dml_Modelio_UML2.4.1" if="model">
269 <xslt2 in="${model}/${xmi.source}" out="${model}/__TEMP__.vo-dml.xml" style="${xslt}/xmi2vo-dml_${xmi.source.profile}.xsl"/>
270 </target>
271
272
273
274 <!-- validate vo-dml file using schematron schema -->
275 <!-- TODO add validation by schema itself -->
276 <target name="validate_vo-dml" depends="schematron-compile" if="model">
277 <echo>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</echo>
278 <echo>Validating against schema, writing :</echo>
279
280
281 <echo>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</echo>
282 <echo>Validating against schematron, output written to ${model}/${vo-dml.source}.svrlt:</echo>
283 <echo>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</echo>
284 <xslt2 basedir="./xslt" style="./xslt/vo-dml.sch.xsl" in="${model}/${vo-dml.source}" out="${model}/${vo-dml.source}.svrlt" />
285 <!--
286 <schematron schema="./xsd/vo-dml.sch.xml" failonerror="false" file="${model}/${vo-dml.source}"
287 queryLanguageBinding="xslt2" outputFilename="${model}/${vo-dml.source}.svrlt" debugMode="true"
288 resolver="net.sf.saxon.StandardURIResolver"/>
289 -->
290 <!-- find errors -->
291 <echo>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</echo>
292 <xslt2 basedir="." style="./xslt/inspect-validation-result.xsl"
293 in="${model}/${vo-dml.source}.svrlt"
294 out="${model}/validation.log">
295 <param name="outputfile" expression="${vo-dml.source}.validation-report.txt" />
296 </xslt2>
297 <echo>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</echo>
298 <record name="${models}/${vo-dml.source}.validation-report.txt" action="start" append="yes"/>
299 <schemavalidate file="${model}/${vo-dml.source}" failonerror="false" >
300 <schema namespace="http://www.ivoa.net/xml/VODML/v1.0" file="./xsd/vo-dml-v1.0.xsd"/>
301 </schemavalidate>
302 <record name="${models}/${vo-dml.source}.validation-report.txt" action="stop"/>
303
304 <delete file="${model}/validation.log" />
305 </target>
306
307 <target name="validate_vo-dml-instance" >
308 <echo>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</echo>
309 <echo>Validating against schema, writing :</echo>
310
311 <schemavalidate file="${vo-dml-instance.file}" failonerror="false" >
312 <schema namespace="http://volute.g-vo.org/dm/vo-dml-instance/v0.x" file="./xsd/vo-dml-instance.xsd"/>
313 </schemavalidate>
314 </target>
315
316
317
318
319 <target name="validateVOTable" description="For testing an annotated VOTable file against the updated VOTable schema">
320 <schemavalidate file="${votable.file}" failonerror="false" >
321 <schema namespace="http://www.ivoa.net/xml/VOTable/v1.4_vodml"
322 file="./xsd/ext/VOTable-1.4_vodml.xsd"/>
323 </schemavalidate>
324 </target>
325
326 <target name="schematron-compile">
327 <xslt2 basedir="." style="./xslt/schematron/iso_svrl_for_xslt2.xsl" in="./xsd/vo-dml.sch.xml" out="./xslt/vo-dml.sch.xsl" />
328 </target>
329
330 <target name="vo-dml2rdf" if="model">
331 <echo>vo-dml2html : starting generate RDF from file ${model}/${dm.file.prefix}</echo>
332
333 <xslt2 in="${model}/${vo-dml.source}" out="${model}/${rdf.target}" style="${xslt}/vo-dml2rdf.xsl">
334 </xslt2>
335 <echo>run_vo-dml2rdf : done.</echo>
336 </target>
337
338 <target name="run_vo-dml2xsd" description="Generate XML schema files for all models identified in mapping.file">
339 <fail unless="mapping.file" message="Must define property 'mapping.file' in build.properties (the source VO-DML file) !" />
340 <echo>run_vo-dml2xsd : starting generate XML schema files for all models in mapping file ${mapping.file}</echo>
341
342 <xslt2 in="${mapping.file}" out="${xsd.gen}/run_xsd.txt" style="${xslt}/vo-dml2xsd.xsl">
343 <param name="mapping_file" expression="${mapping.file}" />
344 <param name="schemalocation_root" expression="${schemalocation_root}" />
345 </xslt2>
346 </target>
347
348 <!-- target run_vo-dml2gvd : generates Object Graphs (graphviz tool) from vo-dml model
349 then generate model diagrams from GVD file and a cmap
350 -->
351 <target name="vo-dml2gvd" if="graphviz.path">
352 <fail unless="model" message="Must define property 'model' !" />
353 <echo>run_vo-dml2gvd : starting generate GraphViz from file ${model}/${vo-dml.source}</echo>
354
355 <xslt2 in="${model}/${vo-dml.source}" out="${model}/${graphviz.gvd}" style="${xslt}/vo-dml2gvd.xsl" />
356
357 <exec executable="${graphviz.path}" dir="${model}">
358 <arg value="-Tcmapx" />
359 <arg value="-o${graphviz.map}" />
360 <arg value="-Tpng" />
361 <arg value="-o${graphviz.png}" />
362 <arg value="${graphviz.gvd}" />
363 </exec>
364 <echo>run_vo-dml2gvd : done.</echo>
365
366 </target>
367
368 <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
369 <!-- if a cmap file is created, insert it in the HTML file -->
370 <target name="postGenerateHTML" if="graphviz.path">
371 <loadfile property="map" srcfile="${model}/${graphviz.map}" />
372
373 <replace file="${model}/${html.target}" token="${graphviz.map.placeholder}" value="${map}" />
374 </target>
375
376
377 <!-- transformation from XSD to Java classes suited for XmlPullParser -->
378 <target name="run_vo-dml-xsd2java" description="Generate Java classes form XML schema">
379 <echo>run_xsd2java : starting generate XML schema files for all models in mapping file ${mapping.file}</echo>
380
381 <xslt2 in="${xsd}/vo-dml-v1.0.xsd" out="${sources}/log_xsd2pojo.txt" style="${xslt}/xsd2pojo.xsl">
382 <param name="dir" expression="org/ivoa/vodml/xml/gen" />
383 <param name="package" expression="org.ivoa.vodml.xml.gen" />
384 </xslt2>
385 </target>
386
387
388
389
390
391 <!-- include java realated targets for compiling generated code and generating some infrastructure classes
392 using JAXB. Latter targets require value for jaxb.dir property in build.properties -->
393 <!--
394 -->
395 &buildJava;
396
397
398
399 </project>

Properties

Name Value
svn:mime-type text/xml

msdemlei@ari.uni-heidelberg.de
ViewVC Help
Powered by ViewVC 1.1.26